Repository navigation
feat(cli): inject bounded pod focus at turn start - #1608
Conversation
|
Independent review (Vera), at head Verified first, because two of Sam's constraints are only checkable below the CLI:
Three findings. 1 (blocking on ordering). There is no pod-focus backend on prepended to its prompt, plus one extra HTTP round trip per turn, for no benefit. It also reads oddly against Sam's "preserve no-focus pods". Suggested fix, one line at the seam: when the normalized focus is null, inject nothing and leave 2. A permanent failure is thrown into the transient-retry path. 3. Focus availability is now a hard dependency for all agent work. Before this change, a pod turn ran regardless of the context route's health. After it, a failed focus read means no turn happens at all, for any event type. The retry behaviour is what Sam asked for, so this is by design — but the coupling is new and worth stating explicitly: an outage in one read now stops every seat's every turn, rather than degrading them to no-focus. Minor, non-blocking: in |
lilyshen0722
left a comment
There was a problem hiding this comment.
Operator review of c194157: changes required before release.
cli/src/lib/pod-focus.jsnormalizes missing/malformed context into a successful empty focus. ReproducedreadPodFocus({get: async () => ({})}, 'pod-a')returning{podId:'pod-a',revision:0,focus:null}. Require the publishedcontext.focusDTO, matching pod ID, valid revision and explicit null/populated focus. Remove speculative flattened compatibility; the tests currently use that invented shape too.agent.jsrecognizes only error codes beginningpod_focus, while protected overflow throwsFOCUS_FRAME_PROTECTED_OVERFLOW. The actual failure therefore loses its required structured diagnostic. Cover overflow at both single and batch runTurn/error seams, not only the standalone formatter.- An explicit cleared focus at revision 9 renders only “No focus set.” Preserve pod/revision for legacy and cleared frames too, and assert the changed revision on resume.
Retain the plan's measured ten-task worst-case bound and finite failure/repair acceptance. The backend focus contract must be deployed before this strict CLI consumer is published and activated. No registry-only or global-install-only runtime completion claim.
4e1a85f to
951379f
Compare
lilyshen0722
left a comment
There was a problem hiding this comment.
Reviewed corrected head 4e1a85f. The three code findings are fixed: the reader requires the nested DTO, overflow reaches the diagnostic branch, and empty frames retain pod/revision. Independently ran the two focus suites: 18 tests passed.
Remaining acceptance evidence: actual batch overflow/no-ack/diagnostic coverage, revision assertions on resumed prompts, and the planned exhausted-event/no-automatic-replay/new-event proof. Existing backend agentEventService.lifecycle tests may supply collector semantics in a composed evidence mapping; no new retry subsystem is requested.
Publication remains held until the backend focus contract is live. Installed package and loaded agent process are separate verification steps.
951379f to
05ea2c2
Compare
05ea2c2 to
b32264b
Compare
lilyshen0722
left a comment
There was a problem hiding this comment.
Reviewed b32264b against 05ea2c2: the added test uses MongoMemoryServer and actual AgentEventService.list, garbageCollect and enqueue. Event A reaches three delivery attempts through real claims; GC retires it; subsequent list excludes it; a newly enqueued event B is the sole delivered event with attempts=1. Existing predicate tests remain intact. Together with the CLI overflow/no-ack and fresh repaired-focus tests, this closes the remaining bounded lifecycle evidence gap. Vera independently cleared this head in pod message 65904; Kai reports 42 backend and 86 CLI tests passing.
Operator review findings are resolved. This is not permission to publish ahead of the server: merge/publish remains held until the backend focus DTO is deployed and verified live. Current-head CI and the normal merge gates must pass. Loaded-runtime and both-pod live next-turn proof remain release acceptance work.
Summary
Contract
Built against
ux/pod-focus-plan-65821@97033bb81717a8897694d614e1faf5e2c5046c47. UsesskillMode=none; only the returned focus DTO is formatted, never the full context response.Verification
npm run lintnpm test -- --runInBand __tests__/pod-focus.test.mjs __tests__/pod-focus-run-loop.test.mjs __tests__/run-loop.test.mjsnpm pack --dry-run