feat(lanes): prime and nudge codex lanes into declaring their own stage

A codex lane's declared stage has always depended entirely on the session
reading AGENTS.md and calling `ccam stage` on its own — no hook, no wrapper,
no enforcement. Two additions make that more reliable without touching the
declared-wins / inferred-never-done invariants:

- LaneConsolePane pre-fills a codex pane's opening prompt with a plain-text
  stage-declaration checklist built from the lane's own pipeline_nodes —
  the same up-front priming a Claude lane gets from its pre-filled
  /ccam:ship-feature-lane skill command, just as prose since Codex has no
  slash commands.
- server/lib/codex-nudge.js sweeps every 60s and types a one-line reminder
  into a lane's live tmux pane (tmux.sendText, a new literal-text primitive
  alongside sendCommand) when its fresh detected_stage has sat undeclared
  for over two minutes. It never writes stage/detected_stage itself — any
  resulting declaration is still the codex session's own real ccam stage
  call, just server-prompted instead of relying on memory alone.

server 1354/1354, client 449/449, tsc clean.
This commit is contained in:
2026-08-28 15:59:22 +07:00
parent 5c297c6483
commit 8bd74a57e6
14 changed files with 388 additions and 10 deletions
+24
View File
@@ -1569,6 +1569,30 @@ at a live rollout file, so reading the JSONL avoids coupling to a schema the
next Codex release renames. `rolloutFiles()` is the single function to re-point
if that changes.
### Codex declared-stage reliability (`server/lib/codex-nudge.js`)
Detection alone only paints the amber badge; a codex lane's *declared* stage
depends on the session calling `ccam stage` itself, so two mechanisms make
that more likely without weakening declared-wins/inferred-never-`done`:
- **Opening-prompt priming** (`LaneConsolePane.tsx`'s `promptPrefill`): a codex
pane's first prompt is pre-filled with a plain-text checklist of
`ccam stage <stage> --tool codex` calls, one per node of `Lane.pipeline_nodes`
— the same up-front nudge a Claude lane gets from its pre-filled
`/ccam:ship-feature-lane` skill command, in plain text since Codex has no
slash commands.
- **Stale-detection nudge** (`sweepCodexNudges`, an unref'd 60 s interval from
`server/index.js`, tunable via `DASHBOARD_CODEX_NUDGE_MS`, `0` disables):
when a codex lane's fresh (non-stale) `detected_stage` has sat ahead of its
declared `stage` for at least two minutes and hasn't already been nudged for
that exact detected stage, it types a one-line `[ccam] ... run: ccam stage
...` reminder into the lane's live tmux pane via `tmux.sendText` (skipped if
the pane isn't running an interactive program — `pty-run.js`'s
`SHELL_COMMANDS` — since Enter there would execute the reminder as a shell
command instead of submitting it as a chat turn). It never writes `stage` or
`detected_stage` — any resulting declaration is still one the codex session
made itself, through the real `ccam stage` call.
---
## Agent Extension Layer