fix: exclude operational wake deliveries from captain activity - #115
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
bin/fm-operational-input.shclassifies them as operational: currentFIRSTMATE_OPinputs,from-firstmatecompatibility inputs, legacy session-start markers, legacy watcher messages, legacy turn-end messages, and legacy away-supervisor messages.bin/fm-operational-input.shas the authority for the excluded operational set and adds red regression coverage showingscan_published_fieldspreviously 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-0001Evidence: 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-0001Pipeline
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 --shortgit diff --name-only 1a2cc92ea91499a0a6784c9f9616ff7053006438..78c77b3cecfc4d531044000ea866ba846fc9df32bash tests/fm-context-reset.test.shCreated/tmp/no-mistakes-evidence/01M06G1J1GJWZKN52D62DHAXRT/context-ceiling-regression-evidence.txtby scanning the same fixture with basebin/fm-context-lib.shand fixedbin/fm-context-lib.sh.Created/tmp/no-mistakes-evidence/01M06G1J1GJWZKN52D62DHAXRT/operational-authority-scan-evidence.txtby classifying operational inputs throughbin/fm-operational-input.shand scanning transcript fixtures through the fixed context scanner.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.