Repository navigation
[Spec 1595] agent-attention-states-working - #1854
amrmelsayed wants to merge 109 commits into
Conversation
… idle_prompt; document agent state; real-session run log
…agent identity; qualify persistence pattern; iteration evidence
…vances the ordering watermark
… porch test-check flake
…in, hooks-deletion troubleshooting
Integration review (vscode architect), 3-way CMAP + own readReviewed at ArchitectureFits. One wire contract in Security
Codex items, verified
Claude notes, dispositions
VerificationReal sessions on an isolated Tower, scenarios 9 to 20, in the review doc with timings. The 3 local Required before the pr gate
Then a stationary head with the full required check set green. Verdict: approve once the four items land. |
|
Correction to the integration review above (vscode architect). Required item 1 (approval frontmatter on the spec and plan) is withdrawn. I checked the convention rather than one precedent: 17 of the last 30 merged specs carry no frontmatter. The frontmatter is the mechanism for artifacts approved before a spawn; for a porch-run lane the gate record is porch's own state (spec gate 2026-10-21T04:52Z, plan gate 05:22Z). The builder's rebuttal in porch's advisory round was right. Items 2 to 4 stand: the review-doc residuals (#1856, equal- |
… reading stdin (EPIPE)
…eporter.*) so a second reporter cannot collide
Summary
Builders and architects are now served one attention state (
working,needs-input,idle,blocked,dead) on the overview instead of having it inferred from PTY silence. A Claude permission prompt or question counts as waiting in the same second it is drawn (previously after 5 minutes, or never). A dead agent is shown as dead. A long silent tool call staysworking. Sessions that report nothing (Codex, OpenCode, pre-existing sessions, a freshly restarted Tower) keep today's rule exactly.Closes #1595
Changes
codev-types):AgentState,ServedAgentState,NeedsInputDetail,AgentLaunchIdentity,AgentLifecycleEvent.agentStateis optional and nullable onOverviewBuilderandArchitectState. Approved by main's contract seat, with conditions.projectAgentState): blocked (porch), then dead (liveness, never for complete/verified), then reported activity, thennull.utils/lifecycle-reporter.ts): a generated async hook script plus a--settingsfile under~/.agent-farm/hooks/, injected through the optionalHarnessProvider.buildLifecycleReporterInjectionon every launch path (spawn, resume, workspace recover, architects). It fails open and silently, and concatenates with the write-guard hooks.POST /api/agent-lifecyclewith local-key auth and strict validation. The state store is memory only (owner ruling) and applies SC17 ordering. A liveness sweep runs onepscensus every 5 s, and two misses mean dead.overview-changedevents are coalesced per workspace.agentAttentionState/isIdleWaiting/deriveAttention/describeNeedsInput) for every surface.arch.md, one clause on the arch-critical global.db fact (cap unchanged), and a troubleshooting entry inworkflow-reference.md(both trees).Testing
check-typespasses in every package./clear,/exit, Codex fallback, write-guard, hung, stopped and restarted Tower. The full log with timings is in the review doc.tower-api.e2e.test.tsfail with "nodePty.spawn is not a function". A freshorigin/mainworktree fails identically on this machine, and Linux CI is green on main. This PR's CI settles it.Known limitations
needs-inputuntil it completes, because Claude fires no hook on approval.null.~/.agent-farm/hooksis deleted by hand, Claude exits with "Settings file not found" and baked builder loops relaunch every 2 s untilafx spawn --resumeorafx workspace recover.Proposed (not in this PR)
An optional one-line guard in the baked builder loop: stop auto-relaunching after N immediate exits within a few seconds and wait at the existing prompt. It would bound the hooks-deletion crash loop without touching the hook command or its quoting.
Spec
codev/specs/1595-agent-attention-states-working.md
Review
codev/reviews/1595-agent-attention-states-working.md