Skip to content

fix(671): make session-less control events (server_start) readable by harness + AI#684

Merged
jonathaneoliver merged 1 commit into
devfrom
fix/control-events-global-read-671
Jun 7, 2026
Merged

fix(671): make session-less control events (server_start) readable by harness + AI#684
jonathaneoliver merged 1 commit into
devfrom
fix/control-events-global-read-671

Conversation

@jonathaneoliver
Copy link
Copy Markdown
Owner

Completes #671 part 1's visibility goal. The server_start boot 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_start returned 400 player_id required.

Two root causes, both fixed:

  1. The read path hard-required player_id, but server_start is deliberately session-less.
  2. The handler never read an event filter at all — so harness 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 — but player_id is no longer mandatory.

  • internal/plays/control.goControlEventsFilter gains Events []string; the player_id-required hard error becomes the discriminator guard (shared by AI + HTTP).
  • v2_handlers.go — reads repeatable ?event=, player_id optional, same guard.
  • llm_tools_tier1.goget_control_events gains an event arg, drops required:[player_id]; description tells the AI it can query server_start (and other global events) by event name with no player_id.
  • tools/harness-cli/.../query.go — the positional play_id is now optional; omit it and pass --event/--label-has to query global events.
  • .claude/standards/data-fields.md — corrected the server_start query 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

harness query control --event server_start
GET /api/v2/control_events?event=server_start
get_control_events(event="server_start")   # AI tool, no player_id

Tests

Guard rejection unit-tested (internal/plays/control_test.go). Forwarder + plays suites pass; harness-cli builds; go vet + gofmt clean. Positive path will be verified live post-deploy (query the server_start rows that already exist on test-dev).

🤖 Generated with Claude Code

…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>
@github-actions github-actions Bot added the bug Something isn't working label Jun 7, 2026
@jonathaneoliver jonathaneoliver merged commit d52c4fe into dev Jun 7, 2026
1 check passed
@jonathaneoliver jonathaneoliver deleted the fix/control-events-global-read-671 branch June 7, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant