8000 fix(base): anchor stuck-pane literals to the start of a rendered line by simon-inkie · Pull Request #20 · simon-inkie/inkie-deck · GitHub
[go: up one dir, main page]

Skip to content

fix(base): anchor stuck-pane literals to the start of a rendered line - #20

Merged
simon-inkie merged 2 commits into
mainfrom
chore/port-stuck-sweep-line-anchor
Sep 13, 2026
Merged

simon-inkie merged 2 commits into
mainfrom
chore/port-stuck-sweep-line-anchor

Conversation

@simon-inkie
Copy link
Copy Markdown
Owner

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_CONFIG gets the same anchoring with no code change.

Known small gap, not addressed here: this repo's default_patterns only 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

  • 130 → 146 assertions, all green.
  • New containment control reproduces the pre-anchor rule verbatim and proves it really did match the prose false positive (the bug was real).
  • Revert-to-red: reverting just the anchoring turns exactly 4 assertions red (the two prose-false-positive cases), nothing else moves. Independently re-verified myself with my own revert, same 4/146 result.
  • leak-gate.mjs, licence-gate.mjs clean.

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: Simon trailer 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.sh at 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

Simon and others added 2 commits September 13, 2026 17:58
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
@simon-inkie
simon-inkie merged commit d1767a2 into main Sep 13, 2026
4 checks passed
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

0