Skip to content

mods: restore the interim-notification filter (7.165.0) - #218

Merged
SSFSKIM merged 8 commits into
mainfrom
interim-restore
Oct 17, 2026
Merged

SSFSKIM merged 8 commits into
mainfrom
interim-restore

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Restores the interim-notification filter (hooks/mods/interim.ts, retired in 7.145.0), rebuilt so that it cannot drop a subagent's report.

Problem. A subagent that ends its turn while its own background shell, monitor or workflow runs makes the engine send the main session a notification with only the placeholder "This agent has not reported yet…", and does so again each time it parks. Each one wakes main for a turn with nothing to act on. e3ce7feb had 481 such turns (~161M cached tokens re-read) and b4948247 had 116.

What it drops. An interim notification whose whole text is the engine's envelope around the waiting placeholder, and only when all of these hold:

  • the agent's transcript (reached through the notice's <output-file> link) shows the hand-back contract on, so the placeholder is the engine's;
  • main spawned the agent, or the conversation already holds an earlier notice of it;
  • any <worktree> it carries is already in the conversation.

Pointer placeholders always pass. Every lookup fails open.

Verification.

  • Corpus: all 14,221 main-session notifications on this machine. The pre-fix rule would have dropped 1,473, and an independent XML audit found none of them carried report content. Every interim notice with agent text or a warning was kept.
  • Review: three adversarial rounds against the 2.1.302 source. Every finding that could suppress a report, a worktree or an orphan's notice was fixed. The two collision variants that can only drop text byte-identical to the placeholder are documented as residual.
  • Live: three rounds of A/B sessions on 2.1.302 (45+ sessions) covering hand-back, the pointer, hand-back off, a premature report, a kill, mid-turn arrival, a worktree agent, an orphan, a collision, a reload, compaction and a rewind. No report token was lost in any run.
  • Replay over e3ce7feb and b4948247: 551 of 749 interim notices dropped.

Residuals are in docs/doperpowers/TECH-DEBT.md: the engine's undroppable "Prompt dropped by a hook" row, two cases where an extra notice passes, the collision residual, quoted notices, and an engine report loss that happens with or without the filter.

🤖 Generated with Claude Code

SSFSKIM and others added 8 commits October 17, 2026 09:36
A subagent that parks on its own background shell, monitor or workflow
still wakes its parent with a placeholder-only "finished" notification
each time it stops to wait. Read on 2026-10-17: 481 such turns in
e3ce7feb (MAWS) and 116 in b4948247, ~190M tokens of cached context
re-read for nothing. The 3b2d3fa filter, unchanged, drops 745 of the
749 interim notifications in those sessions (engine 2.1.283-2.1.301);
the four it keeps carry the safety classifier's warning.

The README's stated cost is corrected: a parked agent killed after its
interim notice goes unannounced with or without the filter, since the
engine claims `notified` when it queues the notice, before any hook.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g else

The text must be exactly the envelope the engine builds around an interim
notice: its header lines, the interim note with no clause appended, one
placeholder result, and the usage and worktree lines. A second
notification, an unknown element, a warning beside the result, or any text
before or after the envelope now passes. Replay over e3ce7feb and b4948247
is unchanged: 745 of 749 interim notifications dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sion knows

Four findings from the review, traced through the 2.1.300 source:

- Hand-back provenance. The engine writes the waiting placeholder only for
  a task whose hand-back contract is on; outside it the agent's own words
  stand. The hook now reads the agent's transcript (grep, since transcripts
  run past $.fs.read's 4 MiB) as the engine's Qks does: the latest meta
  user record opening with the reminder or its countermand must be the
  reminder, and a compaction after both leaves it unknown.
- Worktree. The first interim notice carrying a given worktree passes; the
  async launch result never names it.
- Rerouted pointer. The pointer placeholder passes: a notification falls back
  to main when its parent agent ends, the report does not. The waiting
  placeholder drops only for an agent the session knows: spawned by its own
  loop ($.agent.list() parentId absent) or one whose earlier notice entered,
  so an orphan's first notice passes and its repeats drop.
- The drop's row is the engine's system warning notice, drawn through no
  render hook; documented as what the filter gives up.

Every lookup that errs or cannot tell passes the notification. Replay over
the two sessions: 553 of 749 interim notifications dropped (was 745).
…file link

The hook took the session's transcript directory from classic.SessionStart,
so a module reloaded into a running session (a plugin update and
/reload-plugins) filtered nothing until its next compaction. Each
notification's <output-file> is a symlink to the agent's JSONL transcript:
the hook now resolves it with $.fs.stat, requires it to land on
agent-<task-id>.jsonl, and greps that file. No output file, a dangling
link, or one landing elsewhere passes the notification. The SessionStart
registration and the directory state are gone.

Over the two sessions every one of the 725 waiting notifications carried
the line, each a live link to its agent's transcript; the replay still
drops 553 of 749.
The worktree and orphan rules kept what earlier notifications told the
session in module memory, recorded when next() resolved without a drop.
That memory is not the conversation: a hook beneath can answer without
core or rewrite the text without the worktree, and a rewind or a
compaction takes the first notice out while the agent lives on, so a
repeat was dropped though the conversation never kept the path.

The hook now asks the conversation as it stands, $.session.messages({ as:
"api" }): the engine's live messages from the last compaction on, rewinds
applied, with mid-turn notifications rendered into user text (the rows
form drops attachments). An orphan's repeat needs an earlier notification
of the task there, a worktree's one carrying that worktree; tool results
and assistant text do not count, and an unreadable conversation passes.
The hook keeps no state at all.

Replay over the two main transcripts in order, conversation rebuilt from
what the hook let in and emptied at each of the 65 compactions: 551 of
749 interim notifications dropped. The README names the collision cases
left by design (a fork inheriting its parent's reminder; a queued
notification read against a later run's reminder).
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