Skip to content

bridge: name a manual compaction's rows from the transcript, ahead of anything later (Arkho #78, 7.158.3) - #202

Merged
SSFSKIM merged 4 commits into
mainfrom
arkho-78-plugin-own-notices
Oct 16, 2026
Merged

SSFSKIM merged 4 commits into
mainfrom
arkho-78-plugin-own-notices

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Arkho board ticket #78: name the rows that reached sminos watch and the desk with no notice, which held every consumer for up to 2 s after them. Version 7.158.3, over main's 7.158.2 (main merged at 4c0f1d64).

Problem

The bridge names every row the session writes from its session.append hook (DX5 "Row order"). DC2 left two kinds of row unnamed: the rows of a compaction the bridge runs itself, and the engine's line for a module reload. It attributed both to "a plugin's own calls pass none of its hooks." Under the consumer rule a row past the cut that nobody names is released only by a later notice of its loop, or 2 s after it reaches disk. So after an idle sminos compact the stream to watch and the desk held for 2 s.

What the engine actually does (claude 2.1.301, probed live)

An isolated probe plugin logged every session.append, every session.compact, and what $.session.compact and $.session.messages() return. A 5 ms disk watcher timed each row's flush. Three runs covered: a plugin's own $.session.compact, $.command.run({command: "compact"}), the person's typed /compact, an auto compaction mid-turn (CLAUDE_CODE_AUTO_COMPACT_WINDOW=70000), $.prompt.submit, and a module reload.

  • DC2's premise was too narrow. No manual compaction's rows pass through any session.append, whoever starts it. That covers a plugin's own call, a command run, and the person's /compact. The rows are the boundary, the summary, /compact's command rows, and the re-announced attachments. An auto compaction's rows are raised (doors compaction and attachment). The person's /compact was therefore unnamed too, and so was the model's compact tool (compact.tsx).
  • session.compact hook: a plugin's hook sees every compaction except its own plugin's $.session.compact. It sees the person's and a command run as manual, and the threshold's as auto.
  • Open question: does $.session.messages() carry uuids? No. It gives {role, text, toolUses} only. A compaction's result does carry handle on each message, and the handle is the row's uuid, the summary's first. The boundary and the attachments are not messages.
  • Timing: the rows reach disk in one flush, about 130 ms after the compaction resolves. $.fs.read caps at 4 MiB, so the mod cannot read a transcript's tail itself.
  • The reload line was never unnamed. It is system/informational, written through session.append (door notice, origin engine) about 12 ms after the new module's session.start, so the new module's own hook names it. Its notice lands before the new child's hello, and the hello's resync carries it as the cut.

What this PR changes

  • The hold. Once a compaction stands, the bridge places a hold in its post queue. The poster posts nothing past it, so the compaction's rows are named before anything later: the next prompt, the compact tool's resume prompt, the verb's compact end.
    • The hold's run reads the loop's rows past its cut through the child's new GET /rows. It waits until the summary row (named by handle) is on disk, plus one poll.
    • It names the rows nobody named, each row-seen with door: "compaction", in disk order, in the hold's place.
    • The read is bounded at the first row named by a same-loop notice queued behind the hold.
    • Named rows are remembered per loop, with a copy kept on each hold.
    • What one hold names counts for every later hold of its loop.
    • The cut moves only if it is still the hold's anchor.
  • Triggers. runCompaction; compact.tsx, through the bridge's compacted; and a new session.compact hook for every other compaction. A precompute is skipped.
  • The child. skills/sminos/scripts/sminos_bridge.py gains GET /rows?loop=&after=<uuid>: whole rows past <uuid>, read backward at most 4 MiB, 404 while the row is not on disk.
  • DX5 (docs/doperpowers/plans/2026-10-15-arkho-desk-c2-bridge.md): row-seen gains door: "compaction", and the routes gain GET /rows. The new subsection "A compaction's rows" states the rule. "Known rows with no notice" now lists only what remains. The Decision Log and Surprises record the engine facts. hooks/mods/README.md is updated to match.

What stays unnamed (DX5 lists it)

  • A compaction whose summary row is not on disk within 30 reads (1.5 s).
  • A compaction before the module's first hello, which has no cut yet.
  • A compaction whose cut row lies more than 4 MiB back.
  • A compaction whose result has no handle (a hook answered it with messages of its own).
  • The person's /compact where an organization manages Claude Code and the plugin is the person's own: the engine runs no session.compact hook there.

Validation Evidence

Claim Command Output
Engine facts probe plugin + driver (/tmp/arkho78/probe/), three isolated live runs, claude 2.1.301 as listed above; reports kept in /tmp/p78.*
Unit: the hold, its read, its bounds, the hook tests/mods/run-mods-tests.sh (slot-wrapped) 305 pass at the first commit; 309 pass, 0 fail with the fix waves (each new test failed before its fix) and again on the merged head b0d9993a
Child route and the consumer tests/sminos/test-bridge-order.sh 38 assertions passed (31 before), also on the merged head: GET /rows incl. a half-flushed row, the 4 MiB bound and a subagent loop; the reference Consumer releases a named compaction's rows, none unnamed, under 1 s
The child's other suites tests/sminos/test-bridge{,-control,-requests,-export}.sh 99, 80, 75, 18 assertions passed
Success criteria, live tests/mods/live-walk-check.py --only terminal,bg (it spends model calls) at e14d8155 45 of 45 passed. Bridge's compaction (terminal and bg): 6 rows named, door compaction, max 0.06 s after flush, none behind a later notice, compact end after them. Person's /compact: 9 rows named. Reload line: covered by the new child's cut. Notice audit on both sessions: no row without a notice, no write-order quirk, no block-row break, max flush-to-notice 0.11 s
Live, at the fix-wave head same, --only terminal, at 8860b27b 24 of 24 passed, same results
Types tsc -p hooks/mods/tsconfig.json against the 2.1.301 types only the three existing ask.tsx errors
Validator claude plugin validate --json . adds session.compact{trigger=/^/} (with .catch, which replays next and does not run it again) and the managed-settings note for session.compact
Independent review doperpowers:reviewer-high, three rounds Round 1: two P2s, a hold naming a later compaction's rows ahead of a queued notice, and a global named set evicted by other loops. Round 2: one P2, a same-anchor hold renaming rows. Each was fixed with a test that failed first (8860b27b, 1c0f8c27). Round 3: "No material findings." Verdict: correct

Residue

  • The compact tool's compaction (compact.tsx → compacted) has unit tests only. The live walk does not drive the model to call mcp__doperpowers__compact.
  • docs/doperpowers/plans/2026-10-15-arkho-desk-c2-report.md's Residue line ("The plugin's own appends … get no notice") is DC2's record as it stood. It is left as history, and DX5 now states what holds.

… anything later (Arkho #78, 7.157.5)

The engine writes the rows of a manual compaction (the person's /compact, a
command run, any plugin's $.session.compact: the bridge's compact verb, the
compact tool's) through no session.append, so no hook named them and every
consumer waited up to 2 s on them. Probed live on 2.1.301: an auto
compaction's rows are raised; a plugin's session.compact hook sees every
compaction but its own plugin's; $.session.messages() carries no uuid, but a
compaction's result names its summary row by handle; the reload line passes
the new module's own session.append, so it was never unnamed.

Once a compaction stands (runCompaction, the compact tool through
compacted(), the new session.compact hook for the rest), a hold in the post
queue keeps everything later back while the child's new GET /rows reads the
loop's rows past its cut, until the summary row is on disk and one poll
later; their row-seens (door compaction) take the hold's place, so they go
out before the next prompt's notices. DX5 gains "A compaction's rows"; its
known-rows-with-no-notice paragraph shrinks to what remains.
… queued behind it (Arkho #78 review)

The hold named every unnamed row past its anchor. With the poster behind,
two compactions and a response between them all on disk before the first
hold ran came out bound1, sum1, bound2, sum2, block-row:response: the first
hold took the second's rows ahead of the response's queued notice, and the
second found its summary named and added nothing. Each read is now bounded
at the first row a notice of the loop queued behind the hold names (every
notice since the hold is there: the poster posts nothing past a hold, and a
resync that took any took the hold too); a hold no longer in the queue
names nothing.

What counts as named was one 1,000-row set across loops, so a subagent's
traffic or a long backlog could evict a row the hold must skip, and it was
named twice. Notices are remembered per loop (200 each, a subagent's
forgotten at its stop), and the hold keeps a copy of its loop's as it is
placed: a row named before it that the engine wrote past the cut stays
known however much traffic follows.

Two holds placed at the same cut (nothing of the loop between them) left
the cut at the first's last row once the second named its own, since the
second's anchor was no longer the cut. The hold that moves the cut now
moves such a later hold's anchor with it, so the cut stays the loop's last
notice and a resync keeps that hold.

DX5's "A compaction's rows" states the bounded read and the anchor carried
forward.
…hold of its loop (Arkho #78 review)

The anchor of a later hold placed at the same cut was carried forward only
when the naming hold moved the cut. With a notice of the loop queued behind
both holds the cut is that notice's, so neither moved, and the later hold's
copy of what was named predated the first hold's rows: once the loop's live
memory lost them (200 notices of the loop in between, or a subagent that
stopped meanwhile), the later hold read from the old cut and named them
again, after they had gone out.

What was named now travels on the hold (`named`), and a hold that names
rows adds them to every later hold of its loop in the queue and carries the
anchor of one placed at its own cut, whether or not the cut moved; the cut
still moves only if it is still the hold's anchor. A later hold whose
summary the first already named returns at once instead of polling out. A
resync drops a carried hold whose loop's cut is a later notice, as its rows
lie before that cut. DX5's read and cut bullets say so.
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