Repository navigation
docs: align session-start digest ordering - #1826
Merged
Merged
Conversation
kunchenguid
added a commit
that referenced
this pull request
Aug 7, 2026
* perf(session-start): run every network check off the blocking path The session-start digest runs on a session-open hook that blocks session initialization, and every external-network call it made was individually unbounded: `gh auth status`, secondmate liveness, secondmate convergence, pending remote handoff delivery, and the fleet-sync fetch. One unreachable remote secondmate could consume the whole FM_SESSION_START_TIMEOUT and truncate the digest, so a slow network could cost the work queue itself. Measured against a host hanging 25s per SSH connection, that startup took 1m18s. The digest is now composed from local reads alone. bin/fm-startup-network.sh runs the same checks concurrently in a bounded detached worker and the digest harvests whatever finished, without ever waiting. Same fixture: 0.84s. Nothing is dropped. fm-bootstrap.sh stays the single owner of every sweep and still runs all of them, through a new FM_BOOTSTRAP_NETWORK phase split whose `skip` and `only` halves are a partition of the unsplit run. Deferral is safe because the sweeps are idempotent detectors, the result is durable and always surfaces (inline, or as a `check: startup-network` wake), and the worker re-verifies that the fleet lock still names the session that asked before it mutates anything. While the worker is still running the digest names exactly what is unconfirmed rather than implying it passed. A relaunch performed by the deferred pass is now always reported, because the digest that printed the superseded endpoint record is already out. Also collapses the duplicate tasks-axi compatibility probe: the verdict is computed once and handed to the bootstrap child for one process hop, then consumed so it never reaches a spawned agent's environment. 10 tasks-axi invocations per startup become 7. Verified on Claude Code 2.1.222 that a worker detached by the session-open hook survives the hook returning, the one vendor behavior this design needs and no portable test can see. Re-landed on current main, superseding PR #1845, which was cut from a pre-#1842 base. The digest's section numbering in AGENTS.md section 3 now states the emission order directly - supervision block and its read-once contract, fleet state, network checks, then context - which keeps #1826's fleet-state-before-context ordering. The old-bin test shim keeps main's git-archive baseline from #1851, which already subsumes this branch's reason for widening that shim. * docs(verification): re-measure the deferred startup stage on the current base Re-runs the unreachable-remote latency fixture against default-branch tip 8398d31 rather than the now-historical 345de4e, and records the sweep-result comparison the deferral's safety argument rests on: the deferred worker's published report is byte-identical to the three sweep lines the blocking baseline printed, with the unreachable route preserved in both. * no-mistakes(review): Fail deferred startup when report publication fails * no-mistakes(document): Document deferred startup network behavior accurately
kaku-san
added a commit
to kaku-san/firstmate
that referenced
this pull request
Aug 7, 2026
Intent
Tiny doc-accuracy fix in firstmate's shared, tracked AGENTS.md. PR #1798 (already merged) reordered the session-start digest emitted by bin/fm-session-start.sh so that FLEET STATE now precedes CONTEXT, but AGENTS.md section 3 still described the old order (context digest before fleet-state digest). Update section 3's ordering description to match the shipped output.
What to do: read bin/fm-session-start.sh's actual output ordering (the authoritative source: the LOCK/BOOTSTRAP/WAKE-QUEUE preamble and the emitted supervision block are unchanged; the supervision block and read-once contract come next, then FLEET STATE, then CONTEXT, then NEXT STEP) and reconcile AGENTS.md section 3's numbered digest-composition list to match it. Keep the NEXT STEP read-once contract description consistent with where it now appears.
Explicit constraints and exclusions accepted for this task:
Acceptance criteria: AGENTS.md section 3 accurately describes the current digest order (fleet state before context) with no stale 'context before fleet-state' wording remaining; the edit is minimal; bin/fm-doc-audience-check.sh passes; Markdown style obeyed.
Decisions made while doing the work: I swapped list items 4 and 5 so fleet-state digest is item 4 and context digest is item 5, added the short qualifier 'last of the bulk sections' to the context item (mirroring the script's own comment about curated memory absorbing tail truncation), and changed item 6's stale phrase 'after the wake queue and before context' to 'after the wake queue and before both digests', noting that the read-once contract that governs them follows the supervision block. I deliberately did not restate the truncation rationale, which the script header owns. I checked the repo for other stale ordering references: the two 'context digest' mentions in docs/configuration.md describe ordering WITHIN the context digest (captain.md after projects.md, learnings.md after the captain files) and remain accurate, so they were intentionally left unchanged. bin/fm-doc-audience-check.sh passes (65 surfaces, 205 local links). This change is description-only and has no operational effect; if a reviewer believes it would alter how a session operates beyond describing already-shipped behavior, that is an escalation, not a fix to apply.
What Changed
Risk Assessment
✅ Low: The minimal documentation-only change accurately reflects the shipped fleet-state-before-context order, preserves the read-once contract placement, and introduces no material source risk.
Testing
The author-reported documentation check was independently rerun and passed, the focused session-start behavior suite passed, and manual execution confirmed supervision plus the read-once contract precede FLEET STATE, FLEET STATE precedes CONTEXT, and NEXT STEP closes the digest.
Evidence: Actual session-start digest ordering
6:LOCK 10:BOOTSTRAP 15:WAKE QUEUE 25:SUPERVISION OPERATING INSTRUCTIONS - primary harness: claude 62:READ-ONCE CONTRACT 84:FLEET STATE 94:--- task-a --- 109:CONTEXT 122:Captain context fixture. 133:NEXT STEPPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Inspectedgit diff 345de4e7aad1484f46bc5115c9e57640a0b060d9..34f047b62374897fc7277a4e0661df65e2284b06 -- AGENTS.mdCompared AGENTS.md section 3 againstbin/fm-session-start.sh's executable stage ordertests/fm-session-start.test.shbin/fm-doc-audience-check.shExecuted the realbin/fm-session-start.shin an isolated fixture and captured its ordered public headings and representative fleet/context payloadgit status --short✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.