Repository navigation
test: fix Claude session-start drain live E2E - #5165
Merged
Merged
Conversation
JuanJoseGonGi
pushed a commit
to JuanJoseGonGi/firstmate
that referenced
this pull request
Sep 22, 2026
* test: repair Claude live auto-arm regression * no-mistakes(review): Assert SessionStart digest completeness within its hook_response event * no-mistakes(document): Consolidate Claude live verification references
BohnBawerick
added a commit
to BohnBawerick/firstmate
that referenced
this pull request
Sep 23, 2026
Intent
The captain authorized fixing the session-start drain-count live E2E test that a Discord contributor reported failing. The prior investigation found two independent test failures on current Firstmate: the tracked Claude SessionStart hook now runs the full session-start digest before the model's first turn, so the live test's manual bin/fm-session-start.sh prompt instruction causes a double startup drain; and the post-#4119 Stop auto-arm rewake contract requires state/.watcher-down, which the live test's fake fm-watch-arm.sh does not write, so no rewake is delivered. Keep the change strictly test-only with no product or behavior change. Update tests/fm-claude-stop-autoarm-live-e2e.test.sh so the fake arm writes pending:downtime:fixture-generation- to state/.watcher-down and touches state/.last-watcher-beat before actionable output, remove the manual session-start instruction, and verify observable run-tier evidence: no model fm-session-start.sh call, the transcript's SessionStart hook_response contains the SESSION START digest with stale-lock reclaim, and the stale lock is gone. Keep the drain expectation at 3 for one hook startup drain plus two wake drains, and count only real rewakes as user turns whose text starts with Stop hook feedback:. Preserve the live-harness opt-in guard and make the reproduced failure durable regression coverage. Update the test header and the maintainer records in docs/watcher-continuity.md and docs/verification/supervision.md with a dated live pass, including the Claude version, exact command, and exact ok output. Do not change bin/fm-claude-stop-autoarm.sh, .claude/settings.json, bin/fm-session-start.sh, or implement the optional shared-fixture follow-up.
What Changed
SessionStarthook, and count only structured Stop-feedback rewakes.Risk Assessment
✅ Low: The test-only change directly addresses both reproduced fixture failures, validates the SessionStart digest within the correct transcript event, and introduces no unnecessary behavior or product changes.
Testing
Confirmed the opt-in guard, then ran the credentialed Claude 2.1.278 E2E: the tracked SessionStart hook delivered a complete digest, reclaimed the stale lock without a model-issued session-start call, and produced three drains across two real Stop-feedback rewakes. The fixture-based competing-owner control also passed, though a second concurrent credentialed Claude owner was not run.
FM_CLAUDE_LIVE_E2E=1 tests/fm-claude-stop-autoarm-live-e2e.test.sh; artifact “Claude Stop auto-arm live E2E transcript”tests/fm-claude-stop-autoarm-live-e2e.test.shreturnedskip: live: opt-in; set FM_CLAUDE_LIVE_E2E=1 to run; artifact “Claude live-test opt-in guard output”Evidence: Claude Stop auto-arm live E2E transcript
Source: Claude Stop auto-arm live E2E transcript
Evidence: Claude live-test opt-in guard output
Source: Claude live-test opt-in guard output
Pipeline
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.
FM_CLAUDE_LIVE_E2E=1 tests/fm-claude-stop-autoarm-live-e2e.test.sh; artifact “Claude Stop auto-arm live E2E transcript”tests/fm-claude-stop-autoarm-live-e2e.test.shreturnedskip: live: opt-in; set FM_CLAUDE_LIVE_E2E=1 to run; artifact “Claude live-test opt-in guard output”tests/fm-claude-stop-autoarm-live-e2e.test.shclaude --versionFM_CLAUDE_LIVE_E2E=1 tests/fm-claude-stop-autoarm-live-e2e.test.shVerified transient.claude-autoarm-live-e2e.*lab cleanup and a clean worktree✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
The accepted-intent scenarios were driven live 5/5 across Claude Code 2.1.278 (three runs), 2.1.236, and 2.1.219, covering the complete SessionStart digest, stale-lock reclaim, the three-drain/two-rewake contract, genuine Stop-feedback turns, and no model arm or session-start commands.
The no-start behavior is structurally guaranteed by the
fm_live_gateopt-in guard, which requiresFM_CLAUDE_LIVE_E2E=1orFM_LIVE=1and capability-skips without launching Claude when neither is set.The competing-live-owner scenario is deliberately out of scope for this test-only fix because this guard targets the run-tier auto-arm rewake cycle.
Any additional lock-contention live coverage should be a separate follow-up task.