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
+17
View File
@@ -580,6 +580,23 @@ pass mirrors that lane's `status` between `idle` and `running` from the
journal's mtime, under the guard hook ingestion uses (no `run_id`, only from
`idle`/`running`); it writes nothing else.
Getting a codex lane's *declared* stage to actually happen is a separate
problem — only the session itself can call `ccam stage`, and unlike a Claude
lane it has no slash command to pre-fill. `LaneConsolePane.tsx` pre-fills a
codex pane's opening prompt with a plain-text checklist instead, one
`ccam stage <stage> --tool codex` line per node of the lane's own
`pipeline_nodes`. As a safety net beyond that opening nudge,
`server/lib/codex-nudge.js`'s `sweepCodexNudges()` runs on an unref'd 60s
interval (`DASHBOARD_CODEX_NUDGE_MS`, `0` disables): when a codex lane's fresh
`detected_stage` has sat ahead of its declared `stage` for at least two
minutes, it types a one-line `[ccam] ... run: ccam stage ...` reminder into
the lane's live tmux pane via `tmux.sendText` — skipped if the pane sits at a
bare shell prompt (`pty-run.js`'s `SHELL_COMMANDS`), since pressing Enter there
would run the reminder as a shell command instead of submitting it to Codex.
It never writes `stage` or `detected_stage`, so declared-wins and
inferred-never-`done` are untouched; any resulting declaration is still the
codex session's own real `ccam stage` call.
### Remote Data Sources
Live remote/multi-machine data collection over SSH. The dashboard pulls Claude Code history from other machines: `server/lib/remote-sync.js` uses recursive **`scp` over SSH** (built into OpenSSH — no `rsync` or extra packages on the remote) to mirror each remote's `~/.claude/projects` into a sandboxed per-source staging dir under the data dir, feeds it through the **same** importer used for local history (`scripts/import-history.js` `importFromDirectory`), and tags every imported session with the source id (`sessions.source`). Authentication defers entirely to the host SSH stack (ssh-agent / `~/.ssh/config` / identity file) — **no secrets are stored**; every command runs via `execFile`/`spawn` argument arrays (never a shell string) and `StrictHostKeyChecking` is left at its SSH default.