fix(671): make session-less control events (server_start) readable by harness + AI#684
Merged
Merged
Conversation
…ibility) The control_events read path hard-required player_id, so the global server_start marker (#672) was archived but unreadable via harness + AI. And the read handler never even read an 'event' filter, so harness query control --event was a silent no-op. Plumb a real event filter + optional player_id across all four read layers, gated so a query always has >=1 discriminating predicate (player_id | play_id | event | label_has) and never scans the whole table: - internal/plays/control.go: ControlEventsFilter gains Events[]; guard replaces the player_id-required hard error (AI + HTTP share this). - v2_handlers.go: read repeatable ?event=, optional player_id, same guard. - llm_tools_tier1.go: get_control_events gains an 'event' arg, drops the required:[player_id]; description notes server_start / session-less lookups. - harness query.go: positional play_id now optional — omit it and pass --event/--label-has to query global events. - data-fields.md: correct the server_start query examples to the now-working forms (the old --label-has-on-plays example couldn't surface a play-less event). Guard unit-tested; forwarder + harness-cli build/vet/gofmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes #671 part 1's visibility goal. The
server_startboot marker (#672) was archived in ClickHouse with the right label, but unreadable through any operator/AI path — verified live:GET /api/v2/control_events?event=server_startreturned400 player_id required.Two root causes, both fixed:
player_id, butserver_startis deliberately session-less.eventfilter at all — soharness query control --event …was a silent no-op (the generated client sent it; the server ignored it).Plumbed across all four read layers
A query now needs ≥1 discriminating predicate (
player_id|play_id|event|label_has) so it can never scan the whole table — butplayer_idis no longer mandatory.internal/plays/control.go—ControlEventsFiltergainsEvents []string; the player_id-required hard error becomes the discriminator guard (shared by AI + HTTP).v2_handlers.go— reads repeatable?event=,player_idoptional, same guard.llm_tools_tier1.go—get_control_eventsgains aneventarg, dropsrequired:[player_id]; description tells the AI it can queryserver_start(and other global events) by event name with no player_id.tools/harness-cli/.../query.go— the positionalplay_idis now optional; omit it and pass--event/--label-hasto query global events..claude/standards/data-fields.md— corrected theserver_startquery examples to the now-working forms (harness query control --event server_start); the old--label-has-on-plays example couldn't surface a play-less event.Now works
Tests
Guard rejection unit-tested (
internal/plays/control_test.go). Forwarder +playssuites pass; harness-cli builds;go vet+ gofmt clean. Positive path will be verified live post-deploy (query theserver_startrows that already exist on test-dev).🤖 Generated with Claude Code