Repository navigation
fix(base): tier 1b of the stuck-pane sweep starved on two independent paths - #16
Merged
Merged
Conversation
… paths
The composer-pending tier rode the whole-pane `ticks`/`escalated` bookkeeping
that every other tier uses, and that starved it two separate ways. Both end in
the same place: a pane holding genuinely unsubmitted composer text never
escalated at all, for as long as it sat there.
PATH A. `ticks` resets whenever ANY byte of the pane changes, including
background noise nowhere near the composer (a tool-call summary scrolling by,
a spinner elsewhere in the transcript). A pane with any such churn never
produced two consecutive identical whole-pane hashes, so the tick floor was
never met however long the composer itself sat unsubmitted.
PATH B. The busy gate skipped the whole tier chain on any busy-classified
read, so a pane that reads busy on EVERY tick (a live elapsed counter, or a
wholly static string that merely looks like one) was never asked either.
THE FIX. A second, composer-scoped tick counter: `chash` hashes the composer
line alone, `cticks` counts its own unchanged run, and tier 1b is gated on that
rather than on the whole-pane count. It is also consulted from INSIDE the busy
branch, before the `continue`, which is Path B. `ticks` and `escalated` are
untouched, so the model tier reads the whole-pane hash exactly as before: this
is a parallel counter, not a retiming of every tier at once.
`cescalated` RATHER THAN THE SHARED `escalated`, and that is the trap this
change would otherwise walk straight into. `escalated` resets on every
whole-pane hash change, so on a churning pane it reads "not yet escalated" on
every single tick; a composer-scoped tier deduping on it would wake somebody
every tick for ever, trading the starvation bug for a worse one. `cescalated` is
keyed on composer-hash stability instead. Named side effect: a pane that has
already taken a tier-1 wake this episode can take one further tier-1b wake for
the same wedge. Bounded at one, and independently informative.
The reduced state row written on a busy-with-no-finding tick now carries
chash/cticks/cescalated too. Without that, one such tick silently zeroes the new
counter on the next tick's comparison and re-starves the exact case Path B
exists to fix, by a third door.
WHAT A DEPLOYMENT SHOULD EXPECT TO SEE CHANGE:
- A busy pane can now produce a finding. A genuinely busy long turn with a
legitimately queued message staged across two or more ticks escalates once
per episode. The reason string carries "busy=1" so whoever reads it can
weigh "queued behind a long turn" before pressing anything. Report-only is
still the default, and the model tier is still unreachable for a busy pane.
- The main state row records the real busy classification instead of a
hardcoded 0, because a pane reaching that row is no longer idle by
construction.
- chash/cticks/cescalated are ADDITIVE JSON fields; nothing in this repository
reads the sweep's state file positionally or by field.
- The first tick after upgrading is slightly MORE conservative, not less: a
pre-change state file has no chash, so the composer counter restarts at 1
and a pane already mid-episode waits one further tick. No migration needed,
no crash.
- One extra `capture-pane -e` per tick for a BUSY pane that has a non-empty
composer candidate and has reached the tick floor. A busy pane with an empty
composer still costs nothing extra.
TESTS: 82 -> 130 assertions. Every pre-existing case is unmodified except one,
whose subject genuinely moved: a composer episode now marks `cescalated`, so the
once-per-episode assertion follows the flag the tier actually rides, and the
send-keys count in that same case (the real proof of the property) is unchanged.
The new section covers Path A, the dedupe, Path B, both paths at once, the
busy-row persistence trap, a pre-change state file, and two controls proving the
new door into the busy branch did not widen what the tier fires on: an empty
composer is still nothing, and staged text with no raw capture is still no
evidence.
Revert-to-red against the pre-change script: 27 of the new assertions fail, each
one in the starving direction (tier "none" or absent where the fix reports
composer-pending).
Ported from the internal deployment this package was extracted from, and
genericised on the way: that change's fleet-specific incident references, agent
names and private document citations are not reproduced here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
Author
Model-Diverse Peer Review: PR #16 (inkie-deck, commit e5b34fe)Verdict: FULL APPROVAL 1. Audit of Ported Starvation Fix (
|
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.
Summary
Ports an internal fleet fix: the composer-pending tier (tier 1b) of
stuck-pane-sweep.shrode the whole-pane tick counter and escalation flag that every other tier uses, which starved it two independent ways:Fix: a second, composer-scoped tick counter (
chash/cticks) that tier 1b gates on instead, consulted from inside the busy branch as well as after it, with its own dedupe flag (cescalated) so it can't be merged with the whole-paneescalatedwithout reintroducing a wake-every-tick regression.Notes
Ported from the internal deployment this package was extracted from; fleet-specific incident references, agent names and private document citations are not reproduced. One pre-existing test assertion was retargeted (
escalated→cescalatedfor the composer-pending case, plus a new companion assertingescalatedstays false), because that flag genuinely moved; the actual once-per-episode proof (send-keys count) is unchanged.Test plan
node scripts/leak-gate.mjscleannode scripts/licence-gate.mjscleanstuck-pane-sweep.test.sh: 82 → 130 assertions, all pass