Skip to content

Spec 146 phase 5: codev-agent failure matrix and tests #156

Closed

Description

@pseudoseed

Completes phase 5 of spec 146. The protocol-state surface is built and pushed on builder/task-uxln at 5ba9ca661; the failure matrix and the tests are outstanding. The codex builder that wrote the first half hit its hourly quota mid-phase, so this issue hands the remainder to a fresh builder on the same branch.

Already on the branch, do not rewrite

  • agent-routes.ts (288 lines) — /api/agent/v1, the x-codev-human-session header, and HumanPairedSessionRegistry. The human-paired session is already defined: the host keeps only a verifier, sessions die on codev-agent restart and expire, and recognition returns MISSING and MALFORMED as separate reasons.
  • status-reader.ts (212) — scoped status.yaml reads returning {ok:true,status} | {ok:false,signal}. StatusReadSignalCode is STATUS_NOT_FOUND | STATUS_UNREADABLE | STATUS_MALFORMED | STATUS_OUT_OF_SCOPE.
  • thread-registry.ts (255) — architect-name and builder-id to threadId joins.
  • agent-state-stream.ts (164) — watchAgentState and openAgentStateSse, push not poll.
  • db/index.ts, db/schema.ts — the two nullable thread_id columns and their migration.

What this issue delivers

  1. codev/resources/146-codev-agent-failure-matrix.md. One row per failure mode, covering at minimum: codev-agent down; codev-agent up but t3code down; t3code up but codev-agent down; status.yaml unreadable; status.yaml malformed; a thread with no porch record; a porch record whose thread is gone; global.db locked; a capability presented after revocation; and disagreement between status.yaml and thread state. Each row names the signal code emitted, what the client renders, and whether it is auto-resolved. Disagreement is reported, never auto-resolved.
  2. Tests under packages/codev/src/agent-farm/servers/__tests__/, one per matrix row, each asserting that row own distinct signal.

The constraint that matters most

An unreachable server, an empty result and a malformed file must never be spelled the same way. A partial answer reads as a complete negative one. If two failure modes would emit the same signal, add a code rather than collapsing them. A thread with no matching porch record renders as unmanaged, never hidden.

Acceptance

  • A connected client receives porch state changes without polling.
  • A blocked gate structured question and choices are served, not just the gate name.
  • Every matrix row has a test asserting a distinct signal.
  • Startup reconciliation reports a status.yaml-versus-thread disagreement and does not resolve it.
  • The existing terminal surface still works. This phase deletes nothing.
  • Build and tests pass.

Before trusting a new test, verify it fails against a deliberately mutated source.

Activity

  1. added
    area/tower
    on Aug 29, 2026
  2. added 11 commits that reference this issue on Aug 29, 2026
  3. added a commit that references this issue on Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions