Skip to content

fix: exclude operational wake deliveries from captain activity - #115

Merged
Freudator86 merged 2 commits into
mainfrom
fm/fm-context-ceiling-unenforceable
Aug 17, 2026
Merged

fix: exclude operational wake deliveries from captain activity#115
Freudator86 merged 2 commits into
mainfrom
fm/fm-context-ceiling-unenforceable

Conversation

@Freudator86

Copy link
Copy Markdown
Collaborator

Intent

Fix firstmate's context-ceiling enforcement so watcher wake deliveries injected through the session composer do not count as recent captain activity, without weakening the reset guard. The bug is that bin/fm-context-lib.sh treated unattributed string user records with null origin and null promptSource as captain prompts; operational wake deliveries can have that shape. Keep real recent captain messages blocking autonomous reset. Use bin/fm-operational-input.sh as the authority for which syntactic operational inputs to exclude, including current FIRSTMATE_OP kinds, from-firstmate compatibility, and legacy operational forms, rather than matching a hand-written watcher label. Prove the regression red: before the fix, test_unattributed_operational_wake_delivery_is_not_mistaken_for_the_captain failed because scan_published_fields returned the fresh operational wake timestamp and uuid instead of the day-old captain record. Also cover the opposite direction: an unattributed unmarked recent user message still counts as captain activity and makes the reset refuse. PR body should name exactly which records are excluded, cite bin/fm-operational-input.sh as authority for that set, and show the red regression evidence.

What Changed

  • Excludes unattributed string user records from captain-activity scans when bin/fm-operational-input.sh classifies them as operational: current FIRSTMATE_OP inputs, from-firstmate compatibility inputs, legacy session-start markers, legacy watcher messages, legacy turn-end messages, and legacy away-supervisor messages.
  • Keeps unattributed, unmarked recent user messages counting as captain activity, so the autonomous reset guard still refuses when real captain activity is fresh.
  • Documents bin/fm-operational-input.sh as the authority for the excluded operational set and adds red regression coverage showing scan_published_fields previously returned the fresh operational wake timestamp/uuid instead of the day-old captain record.

Risk Assessment

✅ Low: The change is narrowly scoped to the shared transcript scan predicate and adds behavior-level regression coverage for the reported false captain-activity path plus the opposite unmarked-message guard.

Testing

Inspected the targeted diff and ran the focused context-reset shell test file; then produced behavioral evidence showing base selected the fresh unattributed watcher delivery as human, the fixed scanner selected the day-old captain record, every current/from-firstmate/legacy operational form was excluded via fm-operational-input.sh, and an unmarked recent unattributed user message still counted as captain activity.

Evidence: Red/green scanner evidence

Regression fixture: day-old human record followed by fresh unattributed FIRSTMATE_OP watcher delivery. base scanner: tokens=900000 ts=2023-11-15T22:13:20.000Z uuid=unattributed-record-0001 fixed scanner: tokens=900000 ts=2023-11-14T22:13:20.000Z uuid=cap-record-0001 Guard fixture: fresh unattributed unmarked user string with no origin/promptSource. fixed scanner: tokens=900000 ts=2023-11-15T22:13:20.000Z uuid=unattributed-record-0001

Regression fixture: day-old human record followed by fresh unattributed FIRSTMATE_OP watcher delivery.
base scanner:  tokens=900000 ts=2023-11-15T22:13:20.000Z uuid=unattributed-record-0001
fixed scanner: tokens=900000 ts=2023-11-14T22:13:20.000Z uuid=cap-record-0001

Guard fixture: fresh unattributed unmarked user string with no origin/promptSource.
fixed scanner: tokens=900000 ts=2023-11-15T22:13:20.000Z uuid=unattributed-record-0001
Evidence: Operational authority scan evidence

current-session-start classify=session-start scan=2023-11-14T22:13:20.000Z cap-record-0001 current-watcher classify=watcher scan=2023-11-14T22:13:20.000Z cap-record-0001 current-turn-end-guard classify=turn-end-guard scan=2023-11-14T22:13:20.000Z cap-record-0001 current-away-supervisor classify=away-supervisor scan=2023-11-14T22:13:20.000Z cap-record-0001 current-launch-brief classify=launch-brief scan=2023-11-14T22:13:20.000Z cap-record-0001 from-firstmate classify=from-firstmate scan=2023-11-14T22:13:20.000Z cap-record-0001 legacy-session-start classify=session-start scan=2023-11-14T22:13:20.000Z cap-record-0001 legacy-watcher classify=watcher scan=2023-11-14T22:13:20.000Z cap-record-0001 legacy-turn-end classify=turn-end-guard scan=2023-11-14T22:13:20.000Z cap-record-0001 legacy-away classify=away-supervisor scan=2023-11-14T22:13:20.000Z cap-record-0001

current-session-start    classify=session-start        scan=2023-11-14T22:13:20.000Z cap-record-0001
current-watcher          classify=watcher              scan=2023-11-14T22:13:20.000Z cap-record-0001
current-turn-end-guard   classify=turn-end-guard       scan=2023-11-14T22:13:20.000Z cap-record-0001
current-away-supervisor  classify=away-supervisor      scan=2023-11-14T22:13:20.000Z cap-record-0001
current-launch-brief     classify=launch-brief         scan=2023-11-14T22:13:20.000Z cap-record-0001
from-firstmate           classify=from-firstmate       scan=2023-11-14T22:13:20.000Z cap-record-0001
legacy-session-start     classify=session-start        scan=2023-11-14T22:13:20.000Z cap-record-0001
legacy-watcher           classify=watcher              scan=2023-11-14T22:13:20.000Z cap-record-0001
legacy-turn-end          classify=turn-end-guard       scan=2023-11-14T22:13:20.000Z cap-record-0001
legacy-away              classify=away-supervisor      scan=2023-11-14T22:13:20.000Z cap-record-0001

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.

  • git status --short
  • git diff --name-only 1a2cc92ea91499a0a6784c9f9616ff7053006438..78c77b3cecfc4d531044000ea866ba846fc9df32
  • bash tests/fm-context-reset.test.sh
  • Created /tmp/no-mistakes-evidence/01M06G1J1GJWZKN52D62DHAXRT/context-ceiling-regression-evidence.txt by scanning the same fixture with base bin/fm-context-lib.sh and fixed bin/fm-context-lib.sh.
  • Created /tmp/no-mistakes-evidence/01M06G1J1GJWZKN52D62DHAXRT/operational-authority-scan-evidence.txt by classifying operational inputs through bin/fm-operational-input.sh and scanning transcript fixtures through the fixed context scanner.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@Freudator86
Freudator86 merged commit 765e9a8 into main Aug 17, 2026
10 checks passed
@Freudator86
Freudator86 deleted the fm/fm-context-ceiling-unenforceable branch August 17, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant