Repository navigation
fix(base): anchor stuck-pane literals to the start of a rendered line - #20
Merged
Merged
Conversation
match_pattern escalated whenever a configured literal appeared ANYWHERE as a bare substring in the tail window, so an agent merely WRITING ABOUT a trigger phrase -- quoting it while explaining a false positive, or describing the dialog to a teammate -- escalated exactly as if a real dialog were on screen. Observed on a live deployment: a pane was flagged for a tail window that only DISCUSSED a trigger phrase in prose, with no dialog rendered and an idle composer. The reply explaining that false positive then sat inside a second pane's own tail window, and its quote of the same phrase re-triggered the rule there too -- a second wake, on a second pane, caused entirely by the reply to the first. That self-sustaining shape is what makes a bare substring test worse than merely noisy. THE FIX. The literal must now BEGIN a line of the tail, after stripping only that line's left-hand border chrome (leading whitespace and vertical box-drawing glyphs). A rendered dialog puts its text at the start of its own line, inside its own frame; prose puts the phrase inside a sentence, after other words. STRICTLY NARROWER BY CONSTRUCTION: chrome is only ever stripped from the LEFT EDGE, so a stripped line is always a suffix of the real line. "The stripped line starts with the literal" therefore implies "the literal is a substring of the real line" -- every pane the new rule matches, the old bare-substring rule matched too. The change can only remove a match, never invent one. The strip set is deliberately minimal: whitespace and vertical box-drawing borders only, not dashes, asterisks or quote marks, which are prose furniture that a real dialog frame has no reason to need and that would widen the match rather than narrow it correctly. GENERIC ON PURPOSE: match_pattern also serves PATTERN_CONFIG's arbitrary, admin-supplied literals, so the rule is about the shape of a rendered line, not about the one literal hardcoded in this file. A literal added purely via config gets the same anchoring with no code change. Tests: 130 -> 146 PASS, 0 FAIL. New cases cover the prose false positive (with the pre-anchor bare-substring rule reproduced verbatim as a revert-to-red and containment control -- everything the new rule matches, that control proves the old rule matched too), no regression on two real-dialog renderings (plain and box-drawn), and the same prose/dialog contrast for a PATTERN_CONFIG literal. Revert-to-red confirmed by hand: reverting just the anchoring turns exactly the four assertions tied to the two prose cases red, nothing else moves. Ported from the internal deployment this package was extracted from, and genericised on the way: that change's fleet-specific incident narrative, agent names and ticket references are not reproduced here. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…p-line-anchor # Conflicts: # packages/base/test/stuck-pane-sweep.test.sh
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.
Ports a fix from the internal deployment this package was extracted from into
packages/base/bin/stuck-pane-sweep.sh's deterministic tier 1 (match_pattern()).The bug
match_pattern()escalated whenever a configured literal appeared ANYWHERE as a bare substring in the tail window, so an agent merely WRITING ABOUT a trigger phrase (quoting it while explaining a false positive, or describing the dialog to a teammate) escalated exactly as if a real dialog were on screen. Observed on a live deployment: a pane discussing a trigger phrase in prose was flagged with no dialog on screen and an idle composer, then a second pane got flagged fourteen minutes later because it was still showing the reply about the first false positive, inside its own tail window. A wake caused entirely by the reply to a false wake.The fix
The literal must now BEGIN a line of the tail, after stripping only that line's left-hand border chrome (leading whitespace and vertical box-drawing glyphs, nothing else — dashes/asterisks/quote marks are prose furniture, not chrome). Strictly narrower by construction: chrome is only ever stripped from the left edge, so a stripped line is always a suffix of the real line, meaning every pane the new rule matches, the old bare-substring rule matched too. The change can only remove a match, never invent one. Generic by construction, so a literal added via
PATTERN_CONFIGgets the same anchoring with no code change.Known small gap, not addressed here: this repo's
default_patternsonly has one hardcoded literal, so "no regression on two real-dialog shapes" is tested as two renderings of that one literal (plain and box-drawn) rather than two distinct literals.Verification
leak-gate.mjs,licence-gate.mjsclean.Built by a sub-agent, independently reviewed by me: read the full diff, re-ran the suite and gates myself, did my own revert-to-red check. I also amended the commit to drop a redundant
Co-authored-by: Simontrailer the sub-agent added under a mistaken belief it matched repo convention — it doesn't (checked prior commits on this file), and Simon's already the commit Author.Note: this touches
packages/base/test/stuck-pane-sweep.test.shat the same tail location as #19 (both append a new section there), so whichever of these two merges second will show a trivial append-only conflict. Ping me and I'll rebase.🤖 Generated with Claude Code