fix(afk): hard-cap away-mode escalation re-injection - #2390
Open
baksoy wants to merge 1 commit into
Open
Conversation
A submit-confirmation false-negative (the digest lands and starts a real turn while the idle composer is briefly misread as still holding text) made housekeeping's per-tick batch flush re-inject the same digest every tick indefinitely - an overnight ~10h re-injection loop. Bound re-injection per buffered content: the initial flush attempt plus at most one max-defer escape flush, which raises the wedge alarm exactly once and then CAPS that content so no later tick re-injects or re-alarms it. The cap bounds retry count only - the buffer stays durable for return catch-up, so nothing is lost after queue publication. The cap is per buffered content (content-addressed markers), never a permanent mute: a distinct escalation re-arms it, and any positively confirmed delivery clears it and resumes normal injection. Backend-independent (state files, not any pane surface). Cap markers join the delivery-artifact family cleared/snapshotted by the afk enter, return, and launch paths so a stale cap cannot leak across away-mode sessions. Adds a portable regression test driving persistent non-confirmation, asserting bounded injection (<= 2), a single alarm, a durable buffer, cap re-arm on new content, and marker clearing on a confirmed flush.
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.
What
Hard-cap the away-mode sub-supervisor's escalation re-injection so a submit-confirmation false-negative degrades to a single wedge alarm instead of an all-night re-injection loop.
Why
On claude+herdr, an escalation digest can land and start a real turn while the idle composer is briefly misread as still holding text (
pending). Housekeeping's per-tick batch flush then re-injected the same digest every tick indefinitely — an overnight (~10h) re-injection loop.How
state/.subsuper-escalationsfor return catch-up, so nothing is lost after queue publication..subsuper-inject-failed,.subsuper-inject-capped), not any pane surface. The only backend-specific bit (the tmux status-line flash) is unchanged.fm-afk-start.sh,fm-afk-return.sh, andfm-afk-launch.shso a stale cap cannot leak across away-mode sessions.Tests
Two portable regression tests added to
tests/fm-daemon.test.sh, asserting through the executable interface:Docs
docs/wedge-alarm.md(the one authoritative owner), with thedocs/configuration.mdcross-reference updated to match.Validated through the no-mistakes pipeline (rebase, review, test, document, lint all green).