Skip to content

fix(rewind): plan closed tool exchanges and preserve notices - #1026

Open
theaspirational wants to merge 12 commits into
anima-research:mainfrom
theaspirational:soma/af737-notice-gap-rewind-20261117
Open

theaspirational wants to merge 12 commits into
anima-research:mainfrom
theaspirational:soma/af737-notice-gap-rewind-20261117

Conversation

@theaspirational

@theaspirational theaspirational commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem and scope

Fixes #737 using Safe B: remove only complete, unambiguous eligible whole
bodies/exchanges, not single tool endpoints or intervening notices.

This explicitly widens the supported path relative to the published
“active-stream terminal failure stops unchanged” behavior. A registered stream
may recover its own qualifying exhausted provider failure only after clean
iterator completion, successful queued delivery and terminal teardown. An error
event, elapsed silence, or caught delivery rejection is not that boundary.

Round-eight corrections

  • Recovery witnesses the exact failed request, not only its first compile:
    the initial served raw-body set is extended by each verified submitted tool
    round and its supported injected messages, then snapshotted at terminal
    failure before waiting. Later unsent arrivals are not witnesses. Unverifiable
    hand-offs and missing compile provenance cannot authorize quarantine.
  • Speech-chain rejection logging still allows later posts to execute in order,
    but uncertainty disables automatic exhaustion quarantine for that Agent
    instance. Stop/recreate only after inspecting uncertain external/store effects.
    Qualifying pre-stream failures also await earlier streams' queued deliveries.
  • Provider admission closed by shutdown also forbids quarantine and its retry.
  • Same-mode consolidated notices retain the raw-retention statement; mixed-mode
    consolidation states both outcomes without requiring agent access to host logs.
  • Correct legacy-observation ID-reuse guidance, /unstick fractional rounding,
    refusal decline guidance and remaining misleading marker/cap/cause comments.
  • Strengthen provenance, reason, waiter, timeout and stale-no-progress controls.

Soma's four bounds remain

  1. Only an actually finished iterator counts; genuinely live or unsettled
    streams still block recovery.
  2. Recovery belongs to the same failed attempt: unchanged owner/generation,
    forced session and branch; logical quiescence; settled guard work; all Safe B
    ownership, audience, body-closure, visibility and atomic-removal conditions.
    Every selected body head must be carried by that failed request. A late
    uncarried tool endpoint declines the whole plan without sacrificing older
    history or consuming a step.
  3. Positive witnesses use policy-admitted invalid_request HTTP 400, not arbitrary
    HTTP 400. Existing live-stream negative controls remain, with new independent
    held-iterator/held-delivery controls through the public start path.
  4. The supported-path widening and exact request/settlement requirements are
    stated here and in docs/recovery-b.md.

Verification and remaining boundaries

Both required public-start regressions fail against the previous head: the two window-mode
request-body witnesses and rejected-speech control fail; successful-delivery
control passes. In the implementation run, typecheck and build passed and the 13-file relevant
suite passed 887 tests with 0 failures (28 suites).

No durable writer fence, cancellation/deadline protocol, full reentrant recovery
transaction or settlement split is introduced. Hung waits, forced-session-only
settlement loss, teardown/removal accounting and notification-driven session
changes remain explicitly retained limitations, not claimed fixed. Existing
supplemental timing-based guard/bounce controls are not deterministic scheduler
proofs. The reply on this pull request gives one disposition per finding. An independent review ran the
full suite at this head (11,036 pass, 0 fail, 63 skipped). External CI and the
complete dependency-line matrix remain outstanding.

Recovery is step-bounded, not history-size/memory bounded; exclusive offline
repair guidance and transaction/no-replay limitations in docs/recovery-b.md
remain. This is Safe B compatibility widening, not permission to repair malformed
history, replay side-effecting tools, bypass caps, or mutate successor history.

theaspirational and others added 2 commits November 17, 2026 12:59
Co-Authored-By: OpenAI Codex <noreply@openai.com>
…d marker

Review follow-up to the anima-research#737 notice-gap fix.

- A tool result right after its call body is paired with it whatever the
  IDs, as before anima-research#737; IDs decide only when the walk crosses notices or
  other result bodies.
- A rewind marker ends the walk, so it is never part of a rewound
  interval (the raw fallback removed it and the marker update then threw).
- A result body in shards is paired as a whole body, at selection and at
  removal, not by the IDs of its first shards.
- Tests: next-request regressions for mismatched, missing and mixed IDs
  (adjacent and across a notice, and adjacent on the raw record), an
  earlier result body's unknown ID, a marker between call and result, a
  passed-over sharded result body, and the adjacent sharded-body retract
  restored beside the notice form.
- Comments and the changelog fragment state what is and is not paired.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic context view of 583b9a34c263 merged onto 3cc67b953d2d.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 5 changed source lines that map to code ran in no profiled drive: src/framework.ts lines 15117, 15142, 15152, 15158 and 15160. 53 changed source lines map to nothing the host runs: 53 of src/framework.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 210,343 tokens sent a request, 72.1% of them read from the cache, 139,465,910 written to it, 3,976,880 output, 24 thinking blocks dropped, USD 0.5622 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/framework.ts: lines 15117, 15142, 15152, 15158 and 15160 ran in no profiled drive; lines 15040–15055, 15103–15109, 15111–15115, 15118–15131, 15134, 15145, 15166–15167, 15206, 15210–15213 and 35660–35661 map to nothing the host runs.

Held the same in base and head: connectome-host a687b1359102, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic review of 583b9a34c263.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

Address Anima R1 selection, barrier, accounting and repeated shard-scan findings without changing retry or history-repair policy.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

Addressed in commit 624447caa5afcd146b81fe11aa7767ed783a9be2. Build succeeded; focused checks: 423 pass / 0 fail. No full suite or live provider run. Separate Astra-medium review accepted this exact candidate with fresh focused checks and no actionable regression found.

1 Accept, fixed. The raw-path selection flaw already existed before #737. Raw and presented selection now both use the existing agentSees eligibility rule and exclude host changes. A synthetic initial write-down failure leaves Mira genuinely legacy/unpresented while Oren presents normally; the control retains host changes, held traffic and foreign injections.

2 Accept, fixed. The descriptor now estimates UTF-8 serialized resolved stored content for the interval actually removed, including earlier results, call and notices (and counts top-level image blocks across that interval). The 100KB + 1KB multi-result control reports approximately 101KB, not 1KB. This is an approximate stored-content size, not provider tokens or wire bytes.

3 Accept the limitation; decline history-repair behavior. An unpaired result across a barrier still sheds alone, leaving its call for a later shed. Crossing barriers or guessing a pairing would be unsafe and outside this fix. Function docs already described this exception; corrected the two test headers that still claimed unconditional no-orphans. Existing unknown-ID, ordinary-turn and rewind-marker controls preserve the limitation explicitly.

4 Partial accept, blanket visibility tightening declined. Selection eligibility is not a requirement that every member of the removed exchange was itself carried: a carried call's stored matching result intentionally leaves with it even when held from that request. Filtering out every unseen sibling would recreate a partial exchange. Hidden call bodies and hidden notices now stop pairing; held matching sibling results still go with the visible carried call. Three controls exercise these distinctions and retain other agents' compiles. Where callers omit carried, existing permissive membership semantics remain; this is not a new per-request membership ledger.

5 Accept, fixed narrowly. The heterogeneous-shard accounting/raw-bisection residual is real and preexisting; no normal writer for heterogeneous metadata is established (CM chunking repeats body metadata). Selection now visits whole bodies and records the body's end, so retraction, trace IDs, removed IDs and raw endpoints agree. Four matching/unknown × presented/raw synthetic controls assert every shard and the other-window cleanup.

6 Accept the coverage limitation, supplemented. Prior forced-raw controls remain labelled as such; they are not failed-write-down coverage. New tests inject a failure before the initial index write, assert actual legacy/presented modes, exercise real raw removal, and inspect the subsequent synthetic wire request. This is fault injection, not an observed production disk failure.

7 Accept, covered. The genuine legacy gap control first proves Oren holds every interval row, then asserts removal/retraction of call, earlier result, notice and newest result, while the unrelated prefix remains. The raw multi-shard controls also check other-window ordinals.

8 Accept, fixed proportionately. The same held result body's gap was rescanned for each shard, an actual multiplicative cost. The selection loop now visits each body once. A 40-shard/30-notice control counts content accesses and bounds gap scanning independently of shard count. This is not a claim of globally linear scanning over arbitrarily many distinct unpairable result bodies; no memoization machinery added.

9 Accept, fixed. Barrier checks precede call/result classification and apply to the initial result body too; selection never removes a barrier body. Controls cover mixed call/result bodies with system changes or rewind-marker metadata. CM rejects mixed system-change writes, so those contents are simulated at the snapshot boundary rather than claimed as normal ingress.

No retry/provider/history-repair policy change; adjacency still pairs corrupt/missing IDs, matching gaps still shed the complete signed call and results, notices within eligible intervals still leave, and presented rewinds still affect only the shedding window. No full suite or live provider verification; the exact commit and focused scope are stated above. Independent review is bounded source/synthetic acceptance, not provider or release qualification.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic context view of 624447caa5af merged onto 3cc67b953d2d.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 4 changed source lines that map to code ran in no profiled drive: src/framework.ts lines 15146, 15159, 15165 and 15167. 63 changed source lines map to nothing the host runs: 63 of src/framework.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 210,343 tokens sent a request, 72.1% of them read from the cache, 139,465,910 written to it, 3,976,880 output, 24 thinking blocks dropped, USD 0.5622 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/framework.ts: lines 15146, 15159, 15165 and 15167 ran in no profiled drive; lines 15040–15057, 15073, 15089, 15104–15110, 15112–15116, 15120–15134, 15138, 15149, 15154, 15173–15174, 15179–15180, 15214, 15218–15221, 15230–15231 and 35672–35673 map to nothing the host runs.

Held the same in base and head: connectome-host a687b1359102, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic review of 624447caa5af.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. should fix at src/framework.ts:15223, src/framework.ts:15247, src/framework.ts:15252, src/framework.ts:13130, src/framework.ts:25900, src/framework.ts:25710: Taking every intervening system notice with the exchange permanently removes unrelated notices, including clock rows and other agents' records.
    • Failing case: If an orphan-result-held lifecycle notice arrives between a matching call and result, rewinding retracts it as undone on a presented window, so later presentation does not restore the one-shot notice; on a legacy raw window it is deleted from the record and every other window that held it. Likewise, removing the latest clock row makes lastClockOf find an older stamp or none, so the next clock check can insert a fresh clock rather than retain the original notice.
  • 2. minor at changelog.d/737-notice-gap-rewind.fixed.md:1, changelog.d/737-notice-gap-rewind.fixed.md:4, src/framework.ts:15157, src/framework.ts:15164, test/shed-window.test.ts:586: Changelog promises pairing across system notices but omits that hidden or view-excluded notices and hidden call bodies stop the walk.
    • Failing case: When a matching call and result are separated by a notice held from the agent, the notice is a system notice but pairing fails and the result is shed alone, leaving the call in the next request.
  • 3. minor at src/framework.ts:15156, src/framework.ts:15157, src/framework.ts:15159, src/framework.ts:15215: Call-body visibility passes if any shard is visible, while tool_use IDs come from hidden shards too, so hidden calls get paired and removed.
    • Failing case: A sharded assistant body has visible narration in one shard and a tune-out-held or foreign-injection tool_use in another, followed by a notice and a matching visible result: the call was not visible to this agent and should stop the pairing walk, but the body passes the visibility check and the shed retracts or deletes the hidden call and notice along with the result.
  • 4. minor at src/framework.ts:15151, src/framework.ts:15170, src/framework.ts:15177: The selection loop repeats the backward gap walk for each passed-over result body, so the work is quadratic over long runs of result bodies.
    • Failing case: With many consecutive held result bodies and no eligible matching call, each body scans all earlier result bodies before being skipped; a sufficiently long history stalls the synchronous refusal or quarantine recovery even though each body is visited only once by the outer loop.
    • Raised before as finding 8 of the review of 583b9a34c263, fixed then; this is a case the fix leaves.
  • 5. minor at src/framework.ts:15150, src/framework.ts:15156, src/framework.ts:15161, src/framework.ts:15223: Pairing walk stops at a tool_use without checking tool_results in the same mixed body, so unrelated results are removed with the exchange.
    • Failing case: If the candidate call body contains tool_use A and tool_result X, followed by a notice and tool_result A, the walk checks only A against the call, pairs successfully, and removes the whole interval including the unrelated X result; X should prevent pairing because the call does not contain its ID.
  • 6. minor at test/shed-window.test.ts:659, test/shed-window.test.ts:667: The bounded-gap-read test checks only an upper bound, never that the notices were present or that the gap walk ran.
    • Failing case: If the snapshot omits the notices, or a regression skips pairing the held result entirely, noticeReads can remain zero and the test passes despite never exercising the repeated gap walk it claims to bound.
  • 7. minor at src/framework.ts:15164, src/framework.ts:25928: The gap walk treats legacy reasoning-loss notices as barriers because agentSees excludes them, even though the compiled request omits them too.
    • Failing case: In an old raw store containing a call with signed thinking, a system notice of kind reasoning-loss, and its matching result, the compiled request has call and result adjacent, but shedding the result stops at the notice and removes the result alone; the next request still carries the call and signed thinking.
  • 8. minor at src/framework.ts:15181, src/framework.ts:15182: Body eligibility mixes one shard's visibility with a different hidden shard's content, so a body that adds nothing to the request is selected.
    • Failing case: A heterogeneous body has a visible whitespace-only text shard and a held nonempty text shard, with no carried set; the first satisfies the visibility check and the second satisfies asNextRequestCarries, so quarantine sheds this body instead of passing it over for the next eligible turn.

Leave interval notice retention pending a maintainer decision; preserve legacy adjacent-ID compatibility.

Co-Authored-By: GPT-6.1-sol <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

@nissa-seru — maintainer direction requested on 1 in the second review, rather than silently choosing a new retention/recovery policy.

The concern is valid: the current, documented call-to-result interval takes intervening notices with it. tellResultHeld/lifecycleNotice write one-shot agent-lifecycle rows; selective presentation will not rediscover a notice marked undone. Raw range removal also removes the clock/notice from the record and other windows that held it. lastClockOf then sees the remaining clock, not the removed one. This is more than an imprecise changelog claim.

On CM 0.27.0, source review found selective presented retractRows, but only removeMessage(id) / contiguous removeMessages(from,to) for the public raw-removal path. We have not identified a supported disjoint raw mutation preserving CM body/strategy/event accounting. Sequential removals or delete/reinsert with new IDs would not preserve the existing one-operation contract, so we have not implemented those workarounds.

Which contract should this PR target?

  1. Preserve unrelated notices on both paths, with a companion CM selective/batch raw-removal API before this AF fix can finish.
  2. Preserve them on presented windows but explicitly decline the affected legacy-raw operation until such an API exists (a recovery limitation that needs to be stated, not disguised as a successful shed).
  3. Retain the inclusive-interval policy and explicitly accept its notice-retention consequences.

No choice has been implemented or presented as safe by default. The independent minor fixes are under separate review; I am not asking for merge while this should-fix remains unresolved. The question is about public source semantics, not a live-agent rollout.

@theaspirational

Copy link
Copy Markdown
Contributor Author

Implementation follow-up: cbb906f4ae4c4c54e6dafccf5a3b32ad9ca1e866.

1 Accept the concern; unresolved pending a maintainer decision. The current interval shed really can remove unrelated lifecycle/clock notices. A one-shot result-held notice becomes undone and is not rediscovered by later presentation; raw removal deletes it, and removing the newest clock changes lastClockOf's planning input. This is not dismissed because the old changelog disclosed notice removal. CM 0.27.0 provides selective retractRows for presented windows, but its public raw removal API only removes one message or one inclusive range. There is no identified atomic disjoint raw-removal route preserving CM notifications/body integrity. We have not changed notice policy or used sequential deletion/reinsertion. Maintainer choice needed: a companion CM multi-body-removal API, an explicit different legacy fallback, or explicit acceptance of interval notice removal. Presented-only preservation is technically possible but would deliberately diverge the two paths.
2 Accept, fixed. Changelog now names hidden/view-excluded notice and tool-call barriers and the obsolete reasoning-loss exception. Unpaired results can still leave their calls until a later shed.
3 Accept defensively, fixed. Each tool-call shard must itself be visible; visible narration cannot lend visibility to a hidden call. Real-store held/foreign-shard controls cover presented and genuine legacy paths, adjacent and gapped. No normal heterogeneous-metadata chunk writer is claimed.
4 Defer, as previously scoped. Body-unit iteration fixes repeated traversal per shard, not quadratic work across many distinct result bodies. That remaining cost is real; this round does not introduce a new memoization/selection algorithm or claim global linear complexity.
5 Accept defensively, fixed. Across a gap, results in the candidate mixed call/result body join the ID check. CM accepts/preserves this mixed shape, though no normal AF writer was established. Adjacent malformed/mismatched-ID compatibility remains unchanged, with positive controls.
6 Accept, strengthened. The bounded-read test asserts all notice and result shards exist and requires positive traversal above selection-only reads, not only an upper bound. A skipped-walk mutant fails this witness.
7 Accept, fixed narrowly. Exact obsolete system: true, kind: reasoning-loss notices are deterministically omitted by AF's existing views/presentation rules; they no longer block legacy pairing. A genuine legacy-store compile control proves signed call/result removal without signature decoding or history migration. Hidden foreign/held notices, system changes and rewind markers remain barriers.
8 Accept defensively, fixed. A request-content witness must be on a selectable shard (or belong to a matching carried exchange). Visible whitespace plus hidden nonempty text no longer wins selection; whole-body removal and matching held-result contracts remain intact.

Checks: clean-commit build passed; focused caller/real-store regressions 442 pass / 0 fail / 0 skipped. Notice-consequence diagnostics 2 pass / 0 fail demonstrate the unresolved behavior, not a fix. No local full-suite, dependency-floor matrix or live-provider run on this candidate. Independent Astra-medium review accepted the delta after fresh build, 188 focused passes / 1 TODO and six extra contract controls; the PR remains held on finding 1, not approved to merge.

No new notice-retention policy has been selected. The maintainer question remains open. Incidental effects: obsolete reasoning-loss rows now leave with matching legacy exchanges; hidden tool-call shards/unrelated mixed-body results now stop pairing and retain those intervals' notices. Neither resolves unrelated-notice retention.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic context view of cbb906f4ae4c merged onto 3cc67b953d2d.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 7 changed source lines that map to code ran in no profiled drive: src/framework.ts lines 15147, 15164–15165, 15170–15172 and 15174. 70 changed source lines map to nothing the host runs: 70 of src/framework.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 210,343 tokens sent a request, 72.1% of them read from the cache, 139,465,910 written to it, 3,976,880 output, 24 thinking blocks dropped, USD 0.5622 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/framework.ts: lines 15147, 15164–15165, 15170–15172 and 15174 ran in no profiled drive; lines 15040–15058, 15074, 15090, 15105–15111, 15113–15117, 15121–15135, 15139, 15150, 15155, 15158–15159, 15162–15163, 15180–15181, 15186–15187, 15189–15190, 15224, 15228–15231, 15240–15241 and 35682–35683 map to nothing the host runs.

Held the same in base and head: connectome-host a687b1359102, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic review of cbb906f4ae4c.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. blocker at src/framework.ts:15169, src/framework.ts:15170, src/framework.ts:15233, src/framework.ts:15257, src/framework.ts:13130, src/framework.ts:13054, src/framework.ts:15232, src/framework.ts:25909, src/clock-rows.ts:20, src/framework.ts:15262, src/framework.ts:25903, src/clock-rows.ts:269, src/framework.ts:15263, src/framework.ts:22574, changelog.d/737-notice-gap-rewind.fixed.md:3: Shedding the whole call-to-result interval retracts or deletes unrelated lifecycle and clock notices, including from other agents' windows on the raw path.
    • Failing case: An orphan's result-held lifecycle notice lands between a carried call and its result, then refusal rewind retracts the interval as undone; the adoption candidate's retry and later presentation points no longer contain the only notice telling it the result exists and can be delivered by reparenting. The mail remains marked recipient-gone, so the newlyHeld transition does not automatically announce it again; on the raw fallback the notice is deleted from the record as well.
    • Raised before as finding 1 of the review of 624447caa5af and answered: «1 **Accept the concern; unresolved pending a maintainer decision.** The current interval shed really can remove unrelated lifecycle/clock notices.» A blocker is posted whatever its answer.
  • 2. minor at src/framework.ts:15156, src/framework.ts:15160, src/framework.ts:15161, src/framework.ts:15225, changelog.d/737-notice-gap-rewind.fixed.md:2: Barrier and hidden-call checks run before the adjacency return, so adjacent call/result bodies are no longer always paired as the comment and changelog claim.
    • Failing case: With a request-carried, visible tool result immediately after a call body whose tool_use shard is tune-out-held, another agent's injection, or marked system, the base removes both bodies, but the head removes only the result and leaves the call and any signed thinking; a barrier in the call body also prevents the former adjacent pairing.
  • 3. minor at src/framework.ts:15185, src/framework.ts:15191, src/framework.ts:15225: Carried-call exception admits a whole uncarried mixed result/call body, so removal discards new calls that were never in the refused request.
    • Failing case: A refused request carried call A; afterward the store contains an uncarried body with result A and call B, followed by an uncarried result B. The newest result is passed over because its call B was not carried, but the mixed body qualifies through call A and is removed whole with A; the later result B remains without its call and the new call is lost from the next request.
  • 4. minor at changelog.d/737-notice-gap-rewind.fixed.md:7, src/framework.ts:15184, src/framework.ts:15152: Selection repeats the backward pairing walk for each passed-over result body, so work is quadratic, while the changelog claims bodies are walked once.
    • Failing case: With many separate hidden result bodies whose IDs do not pair with an eligible call, selection passes each body over but searches backward from each one, repeatedly traversing the earlier bodies and doing quadratic work; an operator or maintainer reading the release note could incorrectly expect rewind traversal to be linear in the number of bodies.
    • Raised before as finding 4 of the review of 624447caa5af and answered by its author as a choice: «4 **Defer, as previously scoped.** Body-unit iteration fixes repeated traversal per shard, not quadratic work across many distinct result bodies. That remaining cost is real; this round does not introduce a new memoization/selection algorithm or claim global linear complexity.» Only a maintainer's choice folds a finding.
  • 5. minor at src/framework.ts:15120, src/framework.ts:15156, src/framework.ts:15225, src/framework.ts:36279, src/framework.ts:36298: A barrier makes the rewind shed a result without its signed call, yet quarantine counts that incomplete repair against its limited rewind budget.
    • Failing case: With a matching call and result separated by a system_change or view-excluded notice, and maxRewinds set to 1, quarantine removes the result alone and retries with the signed call still in history; the provider can reject the orphaned latest assistant call with HTTP 400, after which the cap prevents the next shed that would remove the call.
    • Raised before as finding 3 of the review of 583b9a34c263 and answered by its author as a choice: «3 **Accept the limitation; decline history-repair behavior.** An unpaired result across a barrier still sheds alone, leaving its call for a later shed.» Only a maintainer's choice folds a finding.
  • 6. minor at changelog.d/737-notice-gap-rewind.fixed.md:14, src/framework.ts:15243, src/framework.ts:15244, src/framework.ts:15330: The changelog omits that the shed size unit changed to UTF-8 serialized bytes and that the image count now covers the whole interval.
    • Failing case: After upgrading, an operator reading a /unstick channel report can see a much larger ~NKB for a Unicode result, call input, thinking signature, or base64 image, and a different image count even when the newest result is unchanged; the changelog does not explain those changes.
  • 7. minor at test/shed-window.test.ts:217, test/shed-window.test.ts:223: The next-wire-request regression asserts the exchange is absent after shedding without first witnessing that Mira's request carried it.
    • Failing case: If request compilation or presentation regresses to omit the call and result from Mira's requests altogether, the test can still observe keep-before and next-question and pass every negative exchange assertion, even though it never exercised removal of a carried exchange.
  • 8. minor at test/shed-window.test.ts:540, test/shed-window.test.ts:547, src/framework.ts:15243, src/framework.ts:15244: The descriptor test's ASCII result payloads dominate its rounded size, so it can't distinguish UTF-8 whole-interval sizing or image counting from other implementations.
    • Failing case: A mutation that sums only the two result strings' character lengths still reports ~101KB for this fixture, and an implementation that ignores images also passes; no fixture makes multibyte text, call input, thinking signature, JSON escaping, or an interval image affect the expected descriptor.
  • 9. minor at src/framework.ts:15169, src/framework.ts:25936, changelog.d/737-notice-gap-rewind.fixed.md:4, test/shed-window.test.ts:676: A gap body containing a tool result bypasses the per-row hidden-notice barrier, so a hidden notice shard is removed with a sibling result.
    • Failing case: In a heterogeneous body containing a matching tool-result shard and a separate system notice shard excluded by the agent's view, between the call and a later matching result, the walk collects the result ID and pairs across the body instead of stopping at the hidden notice; the entire body is then retracted or deleted.
    • Raised before as finding 9 of the review of 583b9a34c263, fixed then; this is a case the fix leaves.

Keep notice retention and rewind budget/performance choices explicitly unresolved.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

Bounded follow-up: 941605b386eebc50328b1eb4a24efd395ccd9a62 (parent cbb906f4ae4c). Not merge-ready; finding 1 remains unresolved. AI-assisted implementation with OpenAI Codex.

1 Accept concern; unresolved / held. Inclusive interval shedding still retracts unrelated notices, or deletes them on legacy raw windows, including effects on other windows. Pending maintainer question; this commit selects no A/B/C retention policy, CM API change, path divergence, or sequential delete/reinsert.

2 Accept / documentation corrected. Legacy adjacent ID/proximity pairing is preserved only for eligible, barrier-free calls. Hidden/system call shards and barriers can prevent adjacent pairing.

3 Accept / narrow defensive fix. A body containing a new call cannot enter selection through the carried-call stored-result exception when that body was not carried. Real CM-validated mixed result A/call B controls preserve that body and result B; carried-body positive controls still shed B's complete exchange. Both presented and genuinely legacy modes are covered. No normal AF writer is established, but that does not make the shape unreachable or invalidate the concern.

4 Defer performance choice; documentation corrected, not fixed. Candidate iteration is per body, not per shard. Repeated backward pairing walks across distinct result bodies remain worst-case quadratic. No cache/selection algorithm is introduced.

5 Defer budget/partial-pair policy; limitation explicitly documented, not fixed. A result can shed alone across a barrier, leaving its signed call; this still consumes a rewind. No budget bypass or general malformed-history repair is added.

6 Accept / documentation corrected. Descriptors use UTF-8 bytes of JSON-serialized, blob-resolved stored content, not wire-request or database-on-disk bytes. Top-level images are counted throughout the removed interval.

7 Accept / strengthened committed witness. Both adjacency and gap tests now positively witness the actual before-shed wire request carrying the call ID, result, signature and narration; after shedding they require those to be absent from the next wire request, with unrelated prefix and new question present.

8 Accept / committed controls. Separate UTF-8, call-input, signature, escaping and interval-image cases make each component dominate the descriptor, in presented and legacy modes. Mutation checks distinguish UTF-16 sizing, result-only sizing and ignored images; these are not token counts or wire-size tests.

9 Accept / narrow defensive fix. A hidden system notice-only shard cannot borrow a sibling result shard's traversal exception. Real CM append/readback fixtures require the walk to stop at that body; visible-notice controls still pair, in both modes. Stored result shards retain their exception and bodies still remove whole. This is a pairing barrier, not selective retention inside a selected body, and does not resolve finding 1.

Validation and exclusions: 206 pass / 0 fail / 1 TODO (207 tests, seven focused files), with a clean-HEAD build gate; The retained author evidence includes the initial traversal-bound failure and correction without loosening its threshold. No full suite, floor/platform matrix, live provider/private history/config/credential probes, CM API work, or general retention redesign. Independent Astra-medium review of this exact SHA accepted the bounded delta, separately reporting a fresh build, 206 focused passes / 1 TODO and eight complementary controls. It explicitly keeps the PR HELD on 1, with 4/5 deferred, not merge-approved. The old CI checks belong to cbb; new checks must run on this update.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic context view of 941605b386ee merged onto 3cc67b953d2d.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 7 changed source lines that map to code ran in no profiled drive: src/framework.ts lines 15153, 15170–15171, 15176–15178 and 15180. 76 changed source lines map to nothing the host runs: 76 of src/framework.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 210,343 tokens sent a request, 72.1% of them read from the cache, 139,465,910 written to it, 3,976,880 output, 24 thinking blocks dropped, USD 0.5622 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 159,911 58.3% 857,419 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 155,632 63.2% 715,480 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 155,647 63.2% 715,495 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/framework.ts: lines 15153, 15170–15171, 15176–15178 and 15180 ran in no profiled drive; lines 15040–15058, 15074, 15090, 15105–15111, 15113–15117, 15121–15138, 15145, 15156, 15161, 15164–15165, 15168–15169, 15186–15188, 15191–15192, 15196–15197, 15199–15200, 15234, 15238–15241, 15250–15251 and 35692–35693 map to nothing the host runs.

Held the same in base and head: connectome-host a687b1359102, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic review of 941605b386ee.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. blocker at src/framework.ts:15237, src/framework.ts:15267, src/framework.ts:15272, src/framework.ts:25913, src/framework.ts:25730, src/framework.ts:15243, src/framework.ts:13054, src/framework.ts:13130, src/framework.ts:15194, src/framework.ts:15235, src/clock-rows.ts:269: Shedding the inclusive call-to-result interval removes unrelated intervening clock and lifecycle notices, including notices appended after the refused compile.
    • Failing case: If a clock notice is stored between a tool call and its matching result, rewinding that exchange retracts the notice from the presented window, or deletes it from the raw record and other windows in legacy mode; the next clock plan reads an older clock or none rather than the most recent notice.
    • Raised before as finding 1 of the review of 624447caa5af and answered: «1 **Accept concern; unresolved / held.** Inclusive interval shedding still retracts unrelated notices, or deletes them on legacy raw windows, including effects on other windows. Pending [maintainer question](https://github.com/anima-research/agent-framework/pull/1026#issuecomment-6954949024); this commit selects no A/B/C retention policy, CM API change, path divergence, or sequential delete/reinsert.» A blocker is posted whatever its answer.
  • 2. should fix at src/framework.ts:15162, src/framework.ts:15173, src/framework.ts:15235, src/framework.ts:30406, src/framework.ts:30411, src/framework.ts:36299, src/framework.ts:36317, src/framework.ts:15702: When a barrier or unusable IDs block pairing, the result sheds alone and callers still retry with the orphaned signed call in history.
    • Failing case: For a call followed by a rewind marker or an ordinary row and then its result, an auto-refusal rewind, /unstick rewind, or exhaustion quarantine sheds only the result and retries with the call still in the compiled history; the same occurs across a notice with missing or mismatched IDs. A further shed is not guaranteed before that request, and at maxRewinds the damaged history can remain for later wakes.
    • Raised before as finding 3 of the review of 583b9a34c263 and answered by its author as a choice: «5 **Defer budget/partial-pair policy; limitation explicitly documented, not fixed.** A result can shed alone across a barrier, leaving its signed call; this still consumes a rewind. No budget bypass or general malformed-history repair is added.» Only a maintainer's choice folds a finding.
  • 3. should fix at src/framework.ts:15190, src/framework.ts:15193, src/framework.ts:15226, test/shed-window.test.ts:791: Selection skips newer uncarried or barrier-containing result bodies and then sheds their carried call alone.
    • Failing case: In the tested layout call A, an uncarried mixed body containing result A and call B, then result B, with only call A in streamCarried, the loop skips both newer bodies and removes call A; when those retained rows are presented at a subsequent compile, result A has no tool_use. A result body skipped because it contains a barrier can produce the same reverse orphan even without a carried-set restriction.
  • 4. minor at src/framework.ts:15163, src/framework.ts:15167, src/framework.ts:15235, test/shed-window.test.ts:784, test/shed-window.test.ts:792: Adjacent pairing stops at a mixed result/call body without following that body's result back to the earlier call.
    • Failing case: For call A, a carried mixed body containing result A and call B, and adjacent result B, the tested shed removes the mixed body and result B but retains call A; the next request therefore contains call A without result A. The test asserts the removal set but does not check the next compiled request for this orphan.
  • 5. minor at test/shed-window.test.ts:229, test/inference-exhaustion-rewind.test.ts:82: The notice-gap regressions call shedNewestTurn directly instead of going through a refusal or exhaustion rewind and retry.
    • Failing case: If the refusal or exhaustion caller stopped invoking the pairing primitive for a request with an intervening notice, the direct-shed next-wire tests would still pass, while the existing breaker test covers only an adjacent call and result.
  • 6. minor at test/shed-window.test.ts:225, test/shed-window.test.ts:237: The gap test's check on Oren's window never establishes that Oren's window contained the exchange.
    • Failing case: If Oren never received the call, result, or notice, retracting the exchange from every window would leave Oren's compile unchanged and this test would pass without testing preservation of another agent's copy.
  • 7. minor at test/shed-window.test.ts:834, test/shed-window.test.ts:845: The image descriptor control places a single image only in the notice, so image count and interval coverage go unverified.
    • Failing case: An implementation that always reports one image whenever the notice contains one, or ignores images in the call and result bodies, passes these controls but produces an incorrect descriptor for an exchange containing multiple images or images outside the notice.
  • 8. minor at src/framework.ts:15139, src/framework.ts:15175, src/framework.ts:15243: The hidden-row barrier check covers only system shards, so a sibling result shard lets the walk cross and remove a hidden non-system shard.
    • Failing case: In a heterogeneous sharded body containing a matching tool-result shard and a separate foreign or held text shard, between a call and its later matching result, the walk crosses the body and removes both shards with the exchange instead of treating the hidden non-result row as a barrier.
    • Raised before as finding 9 of the review of 583b9a34c263, fixed then; this is a case the fix leaves.

@theaspirational

Copy link
Copy Markdown
Contributor Author

Additional feasibility information for the open notice-retention question, without changing the patch or assuming a maintainer decision:

A colleague's bounded public-source check of Chronicle v0.6.0 (d2e95c558953729692405f1ca6329593180261a8) and main (72854fd9124b36b1277fe2d6783542c0775ce786) found single-range AppendLog Redact, append-only AppendMany, and a tree-only tree_batch. No supported disjoint AppendLog redaction or multi-update transaction was identified in those inspected interfaces. The main-only anchors are src/types.rs:288 and src/napi.rs:1582,2240; the v0.6 redaction binding is at src/napi.rs:1369. v0.7.0 was not separately checked; this is source evidence, not an executed compatibility or crash-atomicity test.

Consequently, putting N existing redactions inside a CM write() would still mean N records/events with intermediate state and possible partial completion. That is not an equivalent one-operation raw fallback. A stronger companion would need a lower-layer capability and explicit reader/format/release analysis, rather than a small CM convenience wrapper; I am not proposing a new stored format in this AF PR.

Given that cost, my preference for this PR is option B: preserve unrelated notice bodies with selective presented retraction, and explicitly decline the affected legacy-raw operation when that preservation cannot be represented safely. Do not force presentation conversion after failed write-down or silently report a successful shed. Whole-body and malformed mixed-body limits still need to be stated. Raw deletion is an existing fallback, not the goal in itself.

This remains a proposed contract for your direction, not an implemented resolution of the blocker or permission to merge.

@theaspirational

Copy link
Copy Markdown
Contributor Author

R4 dispositions for 941605b386ee: still HELD, no fix or merge approval claimed by this comment. Its CI is green; that does not resolve the findings. A source-only follow-up examined a coherent reduced-support option B rather than another collection of partial-pair guards.

1 Accept / unresolved. Preserve separate unrelated notices using selective presented retraction. For legacy raw windows, only an exactly contiguous, body-aligned removal set can use the existing one-operation helper; holes/retained notices mean an explicit unsupported outcome, not N redacts or forced conversion after failed write-down. This is a proposal, pending the maintainer contract question, not implemented behavior.

2 Accept safety requirement, not fixed. Plan a complete supported exchange before any removal, including cleanup of the refused reply. Unsupported/ambiguous pairing must not remove just the result, claim a successful shed or immediately retry that damaged request. Auto-refusal, /unstick and exhaustion callers need corresponding honest outcomes/counter handling.

3 Accept safety requirement, not fixed. Closure must be checked in both directions, including newer skipped results, so an older call is not removed while its retained result survives. A mixed body or unsettled tool round may require declining, not skipping to an older endpoint. A current snapshot cannot prove arbitrary future writes absent.

4 Accept limitation / proposed explicit decline. Mixed call/result chains would be unsupported in the small B contract, rather than pretending adjacent pairing closes the whole chain. No recursive malformed-history repair is proposed. This is a deliberate recovery limitation, not proof the input cannot occur.

5 Accept evidence requirement. Future acceptance needs actual refusal/exhaustion caller paths and next-request checks, not just direct invocation of the primitive.

6 Accept evidence requirement. The other resident must positively contain the exchange before its unchanged view is used as isolation evidence.

7 Accept evidence requirement. Cover multiple images and images in different removed bodies, with retained-notice images excluded from removal accounting.

8 Accept defensive privacy requirement. Inspect every shard for hidden non-result content, not only metadata.system. A conservative proposal declines unsupported heterogeneous bodies rather than deleting hidden siblings or introducing block-level surgery.

A significant compatibility choice: a strict closed-exchange safety claim cannot quietly preserve the old adjacent-whatever-IDs best-effort exception. Under this B proposal corrupt/missing/ambiguous IDs decline; keeping that exception would need a separately explicit best-effort contract. Known complete normal-writer rounds are the intended recovery path, not universal repair of existing history.

One exchange tombstone batch does not make refused-reply cleanup, markers and counters a cross-write transaction. Unknown/post-commit outcomes must stop rather than replay; later independent wakes are not durably suppressed by this small proposal. No new product code or tests, real-provider diagnostic/compression replay, storage-format change or live operation was run for this source-only plan. Maintainer direction on the reduced support/compatibility contract remains necessary before treating it as the PR's accepted behavior.

Use selective presented-window removal, decline unsupported legacy or corrupt shapes, and reject operator recovery while a logical turn is already alive.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@theaspirational theaspirational changed the title fix(framework): rewind complete tool exchanges across system notices fix(rewind): plan closed tool exchanges and preserve notices Nov 17, 2026
@theaspirational

Copy link
Copy Markdown
Contributor Author

Safe B round — R4 findings and the chosen reduced-support contract

We chose B rather than inclusive notice deletion or a new Chronicle format project. The implementation now declines unsupported exchanges explicitly; this includes retiring adjacent-whatever-ID best effort. Please request a different contract on review if preferred; I am not treating the earlier unanswered contract question as approval.

  1. Notice retention: supported presented recovery uses one selective exchange-head batch; separate clock/lifecycle/late notices stay. Legacy raw removal requires one exact contiguous interval; gaps decline without conversion or repeated redactions.
  2. Forward orphan / partial pairing: complete IDs and a closed round are required before any recovery cleanup. Corrupt/missing IDs or barriers decline, without shedding only a result and immediately retrying.
  3. Reverse orphan / skipped endpoints: closure checks the stored snapshot in both directions. A stored endpoint outside the presented window declines the whole exchange. A resident-but-uncarried result remains a supported, separately tested case.
  4. Mixed chains: a result-A/call-B body is explicitly unsupported in either carried state; there is no recursive partial repair.
  5. Actual callers: regressions exercise auto/forced refusals and production exhaustion/error streams with temporary real stores and fake provider requests before/after recovery.
  6. Other residents: controls prove another resident held the same exchange before comparing its presented rows, ordinals and compiled request afterward. This isolation claim is for presented removal, not global legacy raw deletion.
  7. Sizing/images: selected stored-content UTF-8 serialization, signature/input payload and three selected images are checked; a retained notice and its image are excluded from removal/accounting.
  8. Hidden siblings: every selected shard is checked; hidden non-tool/foreign content cannot borrow a tool endpoint's eligibility. Whole signed bodies are not edited into partial bodies.

A subsequent independent review found a separate real /unstick admission gap: status may be idle while an earlier logical turn is still alive. The final correction uses the actual ownership predicate before operator session/counter/probe changes, preserving deliberately scoped terminal-refusal/exhaustion recovery. Independent async-start and held-continuation controls, plus a reverted-guard negative control, verify that distinction.

Final implementation and independent reviewer each ran 169 recovery + 309 adjacent passes, with three separately identified reviewer-witness replays. The independent review reuses its identified full B review for unchanged code. These are bounded fake-provider checks, not a full-suite, live/provider, large-history, release or cross-write crash-atomicity claim. Unknown mutation outcomes stop rather than blindly replay; later independent wakes and arbitrary future writers are not durably fenced.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic context view of 891c08882189 merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 78 runs it could compare don't differ between the base and this head.

Couldn't tell whether 41 changed source lines ran, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 37 changed source lines map to nothing the host runs: 37 of src/framework.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 78 runs are the same in the base and this head: 210,168 tokens sent a request, 72.0% of them read from the cache, 139,145,027 written to it, 3,952,176 output, 24 thinking blocks dropped, USD 0.5656 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/framework.ts: lines 3371–3376, 15041–15046, 15077, 15085, 15108–15109, 15120–15121, 15151, 15157, 15173–15177, 15204–15206, 30354–30355, 30416–30418, 35659–35660 and 36266–36267 map to nothing the host runs; couldn't tell whether lines 15055, 15088, 15127, 15131, 15144, 15161, 15172, 15183, 15185–15192, 15196–15197, 15201–15202, 15207–15211, 15642–15643, 30350–30351, 30361–30362, 30373–30375, 30414, 36270–36271, 36276–36277 and 36285–36286 ran.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automatic review of 891c08882189.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

…lts; document manual recovery caveats

Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

Answers to the automated review of 891c0888, now at f3308844. One correction first: an earlier fix attempt was built on the wrong starting tree, so nothing from it was published; this commit carries the same fixes onto the published head, and an independent review checked it against that head. Everything that is not fixed is a stated limitation, and docs/recovery-b.md now spells out what recovery does not do: no rollback of external tool effects, no cross-write atomicity, no durable wake fence, and the backup is no licence to overwrite later writes.

  • 1 We keep the safe default (B): interrupted call-only bodies stay unsupported on every rewind path, because a missing result can establish neither closure nor what the tool did externally. docs/recovery-b.md now gives a manual procedure (stop every writer, take a coherent backup, repair whole bodies, reconcile unfinished dispatches and their effects, verify, restore safely); this is documentation, not automatic recovery. If you prefer automatic recovery of interrupted calls, say so on review.
  • 2 Fixed: The release fragment describes complete, unambiguous whole exchanges, retained separate presented notices, exact contiguous legacy removal and selected-body UTF-8 JSON/image sizing. The release-note regression checks Safe B wording and rejects the obsolete endpoint-fallback claims.
  • 3 Fixed: Automatic refusal give-up deletes its attempt budget and does not itself schedule a retry. A later independent wake gets a fresh budget; the durable marker remains, and the episode count is retained until non-refusal completion ends the episode. The independent-wake regression and changed refusal assertion cover this intentional exception to preservation of exhaustion budgets.
  • 4 Fixed, including the visible-orphan case: Without a carried set, visible reader-eligible calls lend result eligibility. A result-only body is passed over only when all its IDs are proven to answer stored hidden/foreign calls, with no visible call using those IDs. Absence of an eligible call alone is not proof. Visible orphan results remain an unsupported barrier, not permission to shed unrelated older history. The independent orphan-wire reproduction checks unchanged raw/window/ compiled request, counts, marker and retry queue in both modes; foreign, held and audience-only hidden-call controls remain.
  • 5 Fixed: Marker updates check the current branch snapshot for the recorded ID and rewind-marker kind before editing. Missing or branched-away markers are replaced while preserving the previous episode count. Tests exercise explicit removal and an actual branch switch.
  • 6 Fixed: Exhaustion during an active stream records a stream-generation-keyed postponed quarantine. Its owning terminal teardown abandons the submitted guard batch and clears the pending assistant round, then awaits annotation settlement and rechecks agent identity/generation before planning. The terminal-error regression uses a real submitted batch and pending round, verifies no early removal, and observes exactly one settled retry. The reconciled published end-turn fixture additionally covers unique-ID success and reused-ID decline after three answered-but-failed turns.
  • 7 Not changed here: Episode counts advance only on successful marker writes; cleanup/marker failures can make later markers understate committed removals. Confirmed removals are accounted by the caller before cleanup, but automatic refusal give-up resets its attempt budget as in 3. Cross-write removal/cleanup/marker accounting remains nontransactional; docs/recovery-b.md explicitly states the understatement caveat. If you prefer this handled in this change, say so on review.
  • 8 Fixed, with a boundary: Confirmed post-commit legacy readback now attempts cross-resident retraction before returning stopped; it never resumes automatic retry. The throwing-write test checks the other resident's row is retracted. A propagation exception is caught while staying stopped; successful repair of a second failing operation is not guaranteed.
  • 9 Not changed here: There is no durable wake fence or operator reset protocol. Unknown/partial outcomes stop the current attempt only; independent later wakes can attempt recovery again. The docs require manual inspection and explicitly disclose this boundary. If you prefer this handled in this change, say so on review.
  • 10 Not changed here: Forced-session failure summaries remain generic and report confirmed removals without claiming recovery. Detailed bounded stop reasons remain in host logs, not a new structured/channel field; this is documented. If you prefer this handled in this change, say so on review.
  • 11 Fixed: /unstick preflight distinguishes wait-for-active-work guidance from inspect/repair guidance referencing docs/recovery-b.md. The regression exercises both and checks no session or request was opened.
  • 12 Not changed here: Marker prose describes the current window mode, not per-step retention provenance across mode transitions. The docs explicitly warn that the marker is not a storage audit. If you prefer this handled in this change, say so on review.
  • 13 Fixed: test isolation. The injected system-change row has a system stamp, making it otherwise retainable. The test asserts barrier between tool endpoints before legacy contiguity rejection could mask the rule.
  • 14 Fixed: test isolation. The marker sibling has only its rewind-marker kind, not a system stamp, isolating marker-specific protection.
  • 15 Fixed: test isolation. Audience-only endpoints are tested separately from foreign ownership in both modes; ownership cannot mask the audience check.
  • 16 Fixed: test coverage. After a successful quarantine, a later unsupported attempt must preserve the nonzero exhaustion budget, existing marker, snapshots and empty retry queue.
  • 17 Fixed: release note. The changelog records model-visible legacy marker prose saying originals were removed from raw history, distinct from the presented-window retention sentence.
  • 18 Fixed: comments. Breaker comments now qualify shedding/retry by supported planning and state that unsupported plans stop unchanged for manual repair.

Build and typecheck pass; full suite 10,966 passed, 0 failed, 63 skipped, rerun by an independent review. Targeted recovery tests also pass on Membrane 0.8.0 and 0.9.0. Not run: the exact minimum-version CI install, hosted CI, Bun, and live providers.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic context view of f330884414fb merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 78 runs it could compare don't differ between the base and this head.

Couldn't tell whether 46 changed source lines ran, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 45 changed source lines map to nothing the host runs: 45 of src/framework.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 78 runs are the same in the base and this head: 210,168 tokens sent a request, 72.0% of them read from the cache, 139,145,027 written to it, 3,952,176 output, 24 thinking blocks dropped, USD 0.5656 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/framework.ts: lines 3371–3376, 4636, 15042–15047, 15078, 15086, 15104–15106, 15116–15117, 15132–15133, 15163, 15169, 15185–15189, 15220–15222, 30371–30372, 30433–30434, 31487, 35687–35689, 36267–36268, 36285 and 36300–36301 map to nothing the host runs; couldn't tell whether lines 15056, 15089, 15123–15124, 15139, 15143, 15156, 15173, 15184, 15195, 15197–15204, 15208–15211, 15213, 15217–15218, 15223–15227, 15660, 30367–30368, 30378–30379, 30390–30392, 30431, 30435, 36304–36305, 36310–36311 and 36319–36320 ran.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic review of f330884414fb.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. should fix at src/framework.ts:15107, src/framework.ts:15122, test/shed-window.test.ts:789, changelog.d/1026-bounded-recovery.changed.md:15: The planner skips visible result bodies because a hidden call shares their ID, without checking order or uniqueness, so visible orphans don't act as barriers.
    • Failing case: In the test's legacy shape, put an ordinary user message before a held or foreign tool call and a visible result for that call. The planner skips the result, quarantines the ordinary message, and retries with the visible orphan still present instead of declining the malformed exchange.
  • 2. should fix at src/framework.ts:36260, src/framework.ts:36296, src/framework.ts:15058, src/framework.ts:28895, src/framework.ts:28907, src/framework.ts:31441, src/framework.ts:31482, src/framework.ts:31486, src/framework.ts:31430, src/framework.ts:36291: The terminal-exhaustion exception skips logicalTurnAlive on both the immediate and deferred paths, so quarantine can remove history while another logical turn is queued or held.
    • Failing case: A start fails before creating a stream and releases its token, while a continuation or held retry for the same agent remains queued or parked; with no activeStreams entry, exhaustion calls quarantine directly, and terminal-exhaustion skips logicalTurnAlive even though that other turn still owns the history.
  • 3. should fix at src/framework.ts:31454, src/framework.ts:31488, src/framework.ts:36296, src/framework.ts:31453, src/framework.ts:15113: Deferred exhaustion quarantine presents arrivals first and then plans without the failed request's carried set, so it can shed a new message.
    • Failing case: While an inference is in flight, a new user message arrives; the inference then exhausts with an invalid request. Teardown presents the arrival before quarantine, which selects and retracts that newest message and retries even though the failed request never carried it.
  • 4. should fix at docs/recovery-b.md:102, docs/recovery-b.md:115, src/framework.ts:16465, docs/recovery-b.md:120: The manual repair procedure requires every writer stopped, then calls for a live host /undo or CM mutation without naming an exclusive maintenance process.
    • Failing case: For a verified trailing call-only body, an operator who stops the host and follows step 3 cannot invoke its normal /undo; restarting the host to do so violates step 1's instruction to keep every writer stopped.
  • 5. should fix at src/framework.ts:15254, src/framework.ts:15255, src/framework.ts:16610, src/framework.ts:15256, src/framework.ts:30427: Marker reuse checks for the marker in the raw branch, not the presented window, so a hidden marker is edited in place instead of replaced.
    • Failing case: After an automatic rewind gives up with its episode retained, an operator undoes the turn containing the marker, leaving the marker in raw history but outside the window. A later independent refusal rewinds another turn and edits that hidden marker, then retries without any visible notice of the new omission.
    • Raised before as finding 5 of the review of 891c08882189, fixed then; this is a case the fix leaves.
  • 6. should fix at src/framework.ts:30427, src/framework.ts:15244, src/framework.ts:15247, src/framework.ts:15254, src/framework.ts:30383, src/framework.ts:36311: Keeping the episode across give-up lets a later independent recovery edit an old prefix marker and count nonconsecutive removals as the most recent turns.
    • Failing case: After one rewind and give-up, two new messages arrive and a later wake removes the newer one; the existing marker before both messages is edited to say two most recent turns were set aside even though the intervening message remains, and editing that old prefix also invalidates cached prefixes instead of putting the new notice at the tail.
  • 7. should fix at src/framework.ts:15134, src/framework.ts:15142, src/framework.ts:15146: Whole-snapshot tool-ID uniqueness treats legitimate ID reuse across rounds or residents as ambiguity.
    • Failing case: If a provider numbers its first tool call identically on each response, two completed call/result rounds with that ID cause refusal rewind, /unstick, and exhaustion quarantine to decline the newer round; presented-window retraction retains raw rows, so further exchanges using that ID continue to decline until history is manually repaired, although a later exchange with a fresh ID is not affected.
Minor findings 8 to 25 (of 25)
  • 8. minor at src/framework.ts:15244, src/framework.ts:15258, test/shed-window.test.ts:804, src/framework.ts:15245, src/framework.ts:15254, src/framework.ts:15259, test/shed-window.test.ts:820: A replacement marker copies the old branch's episode count even when that branch's removals never happened on the current branch.
    • Failing case: Rewind one turn, branch back to a point before that rewind, then quarantine one turn on the new branch. The replacement marker says two turns were set aside although the first branch's removal did not occur in this branch.
  • 9. minor at src/types/agent.ts:282, src/framework.ts:30359, test/refusal-rewind.test.ts:448: The public refusalHandling docs say auto-rewind always redacts and retries, but unsupported or cap-exhausted plans now leave history unchanged with no retry.
    • Failing case: A host enables autoRewind for a request containing an incomplete tool exchange: planning declines it without shedding or retrying, contrary to the behavior a configuration reader is told to expect.
  • 10. minor at src/framework.ts:30378, src/framework.ts:30384, src/framework.ts:15209: When removing the refused reply throws, the code doesn't read back the result, so a committed removal skips retraction from other windows.
    • Failing case: If removeStoredMessages deletes the refused reply and then throws, the catch stops before retractRemovedElsewhere, unlike the readback path for the shed itself. Other residents' windows can retain references to the deleted reply, and the operator receives only an uncertain cleanup message.
  • 11. minor at src/framework.ts:30364, src/framework.ts:30373, src/framework.ts:30408, src/framework.ts:15297: A forced recovery that stops on a planning, removal, cleanup or marker failure is reported as if the provider refused again after every counted rewind.
    • Failing case: After one confirmed removal, make marker creation throw. The channel says requests still could not be completed after one rewind, although no request was attempted after that rewind, and does not say recovery stopped with uncertain marker state.
    • Raised before as finding 10 of the review of 891c08882189 and answered by its author as a choice: «Not changed here: Forced-session failure summaries remain generic and report confirmed removals without claiming recovery. Detailed bounded stop reasons remain in host logs, not a new structured/channel field; this is documented. If you prefer this handled in this change, say so on review.» Only a maintainer's choice folds a finding.
  • 12. minor at src/framework.ts:15184, src/framework.ts:15659: The planner catches every exception as 'snapshot unavailable' and doesn't log it, hiding programming errors.
    • Failing case: If body processing or a visibility predicate throws a TypeError, /unstick returns 'snapshot unavailable' and advises inspecting history; neither the caller nor the logs identify the programming error or its source.
  • 13. minor at src/framework.ts:36263, src/framework.ts:31486, src/framework.ts:31487, src/framework.ts:15182: Deferred quarantine doesn't retain the failed request's branch, so a branch move during annotation settlement still passes the streamId check.
    • Failing case: While whenAnnotated is pending after token release, an operator moves the store to another branch without starting another stream; streamId still matches, and planning snapshots and removes a turn from the new branch rather than stopping recovery of the old branch's failed request.
  • 14. minor at src/framework.ts:15659, package.json:19, docs/recovery-b.md:96: The /unstick refusal points operators to docs/recovery-b.md, which the published npm package doesn't include.
    • Failing case: A host installed from the npm package receives an error telling it to see docs/recovery-b.md, but the package files list includes only dist/src and src, so that path and its repair procedure are unavailable in the installation.
  • 15. minor at docs/recovery-b.md:115, src/framework.ts:16489, src/framework.ts:16556, src/framework.ts:16560: The advice to use whole-turn /undo for a trailing call-only body ignores that /undo needs a presented window and retracts the entire tail.
    • Failing case: On a legacy window /undo fails outright; on a presented window whose interrupted turn also contains earlier tool exchanges or notices, it removes those rows as well, so following the suggested repair can discard more than the verified call body.
  • 16. minor at docs/recovery-b.md:12, src/framework.ts:30378: The recovery doc says presented-window recovery leaves raw history and other windows untouched, but it omits that the refused reply is removed globally.
    • Failing case: When a supported presented-window rewind has a stored refused reply, the selected exchange is retracted from one window, but cleanup removes the reply from raw history and propagates that removal to other windows, contrary to the stated retention guarantee.
  • 17. minor at docs/tool-result-guard.md:64, src/framework.ts:29885, src/framework.ts:15054, docs/recovery-b.md:84: The guard doc still says an omitted batch's refusal goes through ordinary autoRewind, though unsettled guard annotation now makes recovery decline.
    • Failing case: When a staged batch omitted from the request is settled on refusal and its asynchronous annotation remains active, ordinary handling reaches the planner but it refuses as an unsettled tool round, so no auto-rewind or retry occurs.
  • 18. minor at test/shed-window.test.ts:883, src/framework.ts:35640: The exhaustion-teardown test asserts inside a trace listener whose exceptions the framework catches, so those assertions can't fail the test.
    • Failing case: If the guard batch is already settled, the pending assistant round is absent, or the call has already been removed when the exhausted trace fires, the listener throws after setting endingObserved to true; the test can still pass if its later retry and window assertions hold.
  • 19. minor at test/shed-window.test.ts:477, test/shed-window.test.ts:529, test/shed-window.test.ts:831, test/shed-window.test.ts:889, test/end-turn-usage.test.ts:811: Caller tests wait on fixed timer drains or the earlier exhausted trace, not on the recovery decision and retry or turn completion.
    • Failing case: Under load, runUntilIdle can see an idle-status gap during asynchronous start or teardown, and the exhausted trace precedes deferred quarantine; a retry or decline can therefore occur after the fixed loop or trace-based wait, causing a false failure or an early no-retry verdict.
  • 20. minor at test/tool-result-guard.test.ts:1344, test/tool-result-guard.test.ts:1347: The rewritten guard test credits the missing retry to unsettled guard work but never observes the guard state or the planner's decline reason.
    • Failing case: If ordinary auto-rewind stops for an unrelated reason, or is never attempted at all, the later settled batch, two requests, absent marker and unsubmitted audit can all satisfy this test even though it has not established the claimed guard-boundary behavior.
  • 21. minor at test/shed-window.test.ts:290, test/shed-window.test.ts:305, src/framework.ts:15145: The newer-barrier decline fixture adds a duplicate result, so duplicate-result validation declines before the newer-marker barrier is tested.
    • Failing case: Removing the rule that protects a newer marker/result body still leaves the extra result with ID a, causing incomplete-or-ambiguous-results decline and letting every newer-barrier variant pass.
  • 22. minor at test/shed-window.test.ts:676, test/shed-window.test.ts:680, src/presentation.ts:274: The ownership variant also leaves Mira out of the audience, so it can't show that foreign ownership alone causes the decline.
    • Failing case: If the ownRowOf check were lost while audience filtering remained, the owned fixture would still be rejected because its audience is only Oren, and the test would pass without protecting ownership isolation.
    • Raised before as finding 15 of the review of 891c08882189, fixed then; this is a case the fix leaves.
  • 23. minor at src/framework.ts:36260, src/framework.ts:31482, src/framework.ts:31477: A deferred quarantine is silently dropped when its frame no longer owns a terminal stream or the agent is disposed before the final check.
    • Failing case: After a qualifying hard-down failure, let a successor take ownership before the failed frame's finally, or let a closing conversation be disposed at line 31479: the matching entry is deleted, but no quarantine, retry, or quarantine-disposition log follows, leaving the poisoned history in place despite the breaker firing.
  • 24. minor at src/framework.ts:31277, src/framework.ts:36263, src/framework.ts:31483: The deferred entry is keyed to the stream currently registered under the agent's name, not the frame that exhausted.
    • Failing case: If an older stream throws after a successor has started, its catch emits exhaustion and records the successor's streamId; the older finally cannot consume it, and the successor can later quarantine its own successfully completed history for the old failure; if the registered replacement has no corresponding frame for the captured ID, the strong Map entry instead remains until overwritten or framework disposal.
  • 25. minor at src/framework.ts:35680, src/framework.ts:36272, src/framework.ts:15223, src/framework.ts:36291: The exhaustion comments still name shedNewestTurn as the shared production primitive, though production now calls planNewestTurn and applyShed directly.
    • Failing case: A maintainer following either comment to modify exhaustion or refusal recovery would edit the test seam shedNewestTurn, which those production paths no longer call.

…B rewind

Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

Answers to the automated review of f3308844, now at 5556756b. We keep the safe default (B): interrupted call-only bodies stay unsupported, and every path that cannot prove closure stops unchanged for manual repair. Tool-ID uniqueness is no longer store-wide: IDs are matched within reader-owned live rounds in stored order, so completed, foreign or undone older rounds no longer block a valid newer round.

  • 1 Fixed: Visible results matching hidden calls now reach closure validation and decline; no hidden-ID skip.
  • 2 Fixed: Exhaustion requires logical quiescence, including queued, parked and held continuations; refusal also declines when another continuation owns history.
  • 3 Fixed: Active-stream terminal 400 exhaustion stops immediately unchanged for manual repair, with no retry or teardown wait; no postponed quarantine is added. Changelog and recovery docs now state that boundary.
  • 4 Fixed: Repair requires one exclusive offline maintenance process with all normal writers stopped; unavailable maintenance means stop and escalate.
  • 5 Fixed: Only a presented tail marker can be reused; hidden markers get a new visible notice.
  • 6 Fixed: Give-up closes the episode; non-tail markers are not edited and later omissions start a fresh count.
  • 7 Fixed: IDs are matched within reader-owned live rounds; completed, other-resident and undone older rounds may reuse them, including after restart. Unresolved reuse, duplicate results and held/unpresented endpoints still receive closure checks.
  • 8 Fixed: Missing or branched-away markers start a fresh branch-local count instead of copying another branch's removals.
  • 9 Fixed: Public configuration docs say unsupported or cap-exhausted plans stop unchanged without retry.
  • 10 Fixed: Throwing refused-reply cleanup reads back confirmed deletion and reconciles other windows, then stops without retry.
  • 11 Fixed: Forced failure summaries report stopped, unverified recovery and confirmed removals, not another failed provider attempt.
  • 12 Fixed: Snapshot/validation exceptions log the original error before declining.
  • 13 Fixed: Removed the postponed quarantine; an active-stream failure cannot later shed from another branch during annotation settlement.
  • 14 Fixed: The published package includes docs/recovery-b.md.
  • 15 Fixed: Repair guidance excludes normal whole-turn undo and requires exact whole-body maintenance operations.
  • 16 Fixed: Recovery docs distinguish window-local exchange retraction from global refused-reply cleanup.
  • 17 Fixed: Guard docs explain that unsettled annotation makes ordinary recovery decline without retry.
  • 18 Fixed: Trace listeners capture observations; assertions run outside the swallowed-exception boundary.
  • 19 Fixed: Cited caller tests wait for request counts and logical turn teardown rather than timer drains or the earlier exhausted trace.
  • 20 Fixed: The omitted-batch test observes pending/non-idle guard state and the planner's unsettled-tool-round decline.
  • 21 Fixed: The newer-marker fixture has one result endpoint and asserts the marker-specific decline reason.
  • 22 Fixed: The ownership fixture includes Mira in the audience, isolating foreign ownership from audience filtering.
  • 23 Fixed: Active-stream exhaustion logs an immediate stopped disposition; no postponed entry can silently disappear on disposal or ownership change.
  • 24 Fixed: Removed postponed entries keyed to the currently registered stream; old failures cannot arrange quarantine for a successor.
  • 25 Fixed: Exhaustion comments name planNewestTurn/applyShed, not the direct test seam.

Build and typecheck pass; full suite 10,982 passed, 0 failed, 63 skipped. An independent review of the whole change reran the build and the full suite and added seven probes (duplicate, undone, foreign and hidden IDs, unresolved reuse, window barriers); it reused the exact-commit typecheck. Not run: live provider traffic.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic context view of 5556756b435a merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of 1 of the 78 runs it could compare differ between the base and this head.

Couldn't tell whether 64 changed source lines ran, or whether 1 deletion was reached, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 51 changed source lines map to nothing the host runs: 47 of src/framework.ts's and 4 of src/types/agent.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Separately, 3 of the checks' flags differ between the base and the head, in 1 run; they're listed under "Checks' flags that differ", below.

Usage: the agents' requests, subagents' included, in the 78 runs, base → head: 210,168 → 210,222 tokens sent a request, 72.0% of them read from the cache, 139,145,027 → 139,145,919 written to it, 3,952,176 → 3,950,756 output, 24 thinking blocks dropped, USD 0.5656 → USD 0.5658 at list price a priced request and 123 requests with no list price. The figures of 1 run moved, for any kind of request; they're under "Usage that differs", below. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Context in the 78 runs, base → head. Seams: 776 in both, moved in no run. Tokens in the parts they changed or took out: fewer in 1 run; 56,754,168 → 56,753,488 in all. The most one agent request held: lower in 1 run; 351,214 tokens at most in both. The summariser's requests: 1,841 in both, moved in no run. Their list price, leaving out 127 requests with no list price: USD 347.0521 in both, moved in no run. What these count.

No model read these records for this view, which started on its own. A view asked for with a /context-deltas comment by nissa-seru gives a model's account of the records of the pull request's head as it is when that view runs.

Runs whose records differ: 1 of 78

H1r/W16.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Checks' flags that differ (3)
  • H1r/W16 step 834005.break.3, check 14 flagged on the head 1 more time than on the base: W16's property: couldn't judge: no request at this step followed the failed 834005.break.3.primary.1

  • H1r/W16 step 834005.unstick, check 14 flagged on the head 1 more time than on the base: W16's property: request 834005.unstick.primary.1, the one refused at this step, lacks [[c:834005.break.3.r1]], which its rewind is to shed, so its retry isn't judged

  • H1r/W16 step 834005.break.3, check 1 flagged on the base 1 more time than on the head: the turn's answer never reached its channel: the host reported mcpl:speech-route-failed (turn has no locus (no home/trigger channel; nothing to deliver into))

Usage that differs: 1 of 78 runs, base → head
H1r/W16 kind requests input read from the cache written to it output thinking dropped list price, USD unpriced
agent 15 → 14 3,979 350,388 → 318,066 34,940 → 35,832 11,313 → 9,893 0 0.8273 → 0.7846 0

The figures of the other 77 runs are the same in the base and this head.

Context that differs: 1 of 78 runs, base → head
run seams tokens in parts changed or taken out largest seam most held
H1r/W16 3 5,403 → 4,723 2,001 33,317 → 32,945
Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/framework.ts: lines 3371–3376, 4636, 15041–15046, 15078, 15086, 15103–15106, 15147–15148, 15190, 15196, 15215–15219, 15250–15252, 15275, 30405–30406, 30422–30423, 30428, 30476–30477, 35720–35722, 36300–36301, 36311, 36318 and 36333 map to nothing the host runs; couldn't tell whether lines 15055, 15089, 15120, 15123, 15169, 15183, 15200, 15211–15213, 15225, 15227–15234, 15238–15241, 15243, 15247–15248, 15253–15257, 15333, 15694, 30401–30402, 30412–30413, 30421, 30425, 30427, 30433–30435, 30474, 30478 and 36334–36352 ran, or whether its deletion after line 36354 was reached.

src/types/agent.ts: lines 283, 286 and 288–289 map to nothing the host runs.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic review of 5556756b435a.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. blocker at src/framework.ts:15061, src/framework.ts:15068, src/framework.ts:15098, src/framework.ts:15155: Legacy selection uses presentation ownership rules (bearingOf) that don't match what the legacy compile sends.
    • Failing case: After a resident's initial window write-down fails, another resident's ordinary ownRowOf message is still visible through the legacy resident view, but bearingOf calls it elsewhere when there is no observe edge. With that message after an eligible older message, recovery skips the newer message and removes the older one; the poisoning message remains in the next request.
  • 2. should fix at change-text.md:16, changelog.d/unstick-live-turn.fixed.md:1, src/framework.ts:36290, src/framework.ts:15058, src/framework.ts:35712, test/inference-exhaustion-rewind.test.ts:7, src/framework.ts:36293, test/shed-window.test.ts:432, test/shed-window.test.ts:463: Descriptions, comments and test headers still promise exhaustion quarantine and retry, omitting the new active-stream refusal.
    • Failing case: On a terminal provider 400 while the stream is still active, the breaker logs manual repair and never invokes the planner, even for a complete supported exchange; only terminal refusal has the logical-turn exception.
  • 3. should fix at src/framework.ts:15062, src/framework.ts:15092, src/framework.ts:15205, src/framework.ts:15691, src/framework.ts:30393, docs/recovery-b.md:90, changelog.d/1026-bounded-recovery.changed.md:1: Each recovery plan synchronously inflates the whole raw history, and the operator docs don't disclose the cost.
    • Failing case: For a resident with a small presented window but years of image-heavy raw history, either an auto-rewind refusal or an /unstick preflight loads all those images before proceeding; the base shed read only the presented messages, whereas this can stall the host event loop or exhaust its memory even when the selected turn is small.
  • 4. should fix at test/shed-window.test.ts:462, test/shed-window.test.ts:504, test/shed-window.test.ts:632, test/inference-exhaustion-rewind.test.ts:58: The successful exhaustion-recovery tests inject synthetic traces with no live turn, so they skip the production failure path.
    • Failing case: If a real pre-stream terminal failure retained its turn token or failed to reach quarantine, the synthetic traces would still shed, write a marker and queue a retry; the real error-stream test instead encounters the active-stream decline and cannot validate successful recovery.
  • 5. should fix at changelog.d/1026-bounded-recovery.changed.md:1, changelog.d/unstick-live-turn.fixed.md:1, src/framework.ts:15688, src/framework.ts:36290: The recovery compatibility break is filed only as changed/fixed, not as a breaking entry.
    • Failing case: An existing host can upgrade within its caret range to a patch that refuses an incomplete or mismatched exchange, an empty /unstick, or active-stream quarantine where the previous implementation shed or opened a session; the fragments do not supply a breaking entry with the affected audience and migration.
  • 6. minor at src/framework.ts:15276, src/framework.ts:15281, src/framework.ts:36343, src/framework.ts:15261, test/refusal-rewind.test.ts:19, src/framework.ts:15275, src/framework.ts:15260, test/refusal-rewind.test.ts:22: The marker is reused only when it is the absolute tail, so steps aren't consolidated and the docs' one-marker-per-episode promise is false.
    • Failing case: After one successful rewind, a clock or inference-failed notice is stored after its marker; a second successful shed leaves that notice in place, so the retry sees two markers each claiming that the one most recent turn was set aside instead of one marker accounting for both removals. Repeated interleaving adds further notices and prevents the intended shed-N/add-one convergence.
  • 7. minor at test/shed-window.test.ts:504, test/shed-window.test.ts:528, test/shed-window.test.ts:632, test/end-turn-usage.test.ts:785, test/end-turn-usage.test.ts:783, src/framework.ts:15119: The exhaustion decline tests are masked by the active-stream rule, and a test comment wrongly credits the decline to reused-ID ambiguity.
    • Failing case: If the exhaustion breaker were never invoked, the real-stream test would still see three requests and unchanged rows, and the synthetic legacy decline would still see no writes; in the real-stream and end-turn variants, both ID layouts decline at the active-stream check before the planner can distinguish them.
  • 8. minor at docs/recovery-b.md:54, src/framework.ts:36330, src/framework.ts:36333: The docs say exhaustion failure leaves step counts unchanged, but the count increments before post-removal failures.
    • Failing case: If an exhaustion quarantine removes an exchange and its marker write throws, exhaustionRewinds has already advanced, even though recovery stops without a retry; an operator relying on the documented unchanged budget can misjudge how many steps remain.
  • 9. minor at src/framework.ts:15228, src/framework.ts:15238, src/framework.ts:30405, src/framework.ts:30470, src/framework.ts:36333: An uncertain shed outcome leaves no recovery fence against later wakes.
    • Failing case: If retractRows or a raw removal throws and its readback also fails, applyShed returns stopped without a record; automatic refusal give-up clears its budget, and exhaustion leaves its count unchanged. A later wake that fails again can run the planner and mutate the same history without first establishing whether the earlier write committed or partially applied, contrary to the no-replay guarantee.
    • Raised before as finding 9 of the review of 891c08882189 and answered by its author as a choice: «Not changed here: There is no durable wake fence or operator reset protocol. Unknown/partial outcomes stop the current attempt only; independent later wakes can attempt recovery again. The docs require manual inspection and explicitly disclose this boundary. If you prefer this handled in this change, say so on review.» Only a maintainer's choice folds a finding.
  • 10. minor at src/framework.ts:30392, src/framework.ts:30451, src/framework.ts:15333, src/framework.ts:15335: When a forced rewind hits its budget cap, no log entry names the cap as the stop reason.
    • Failing case: With a cap of one, the first refusal removes a turn and the retry also refuses; the budget check calls finishUnstick directly, whose log only says the session gave up after one rewind and gives the refusal category, without saying the cap stopped recovery.
  • 11. minor at src/framework.ts:15693, src/framework.ts:15194, src/framework.ts:15211: The preflight error gives the same repair-history instruction for an empty eligible window and for a snapshot read failure.
    • Failing case: If a new agent has only system notices, /unstick says there is nothing eligible but directs the operator to inspect and repair history; likewise a temporary snapshot exception directs the operator to repair history rather than investigate the read failure.
  • 12. minor at src/framework.ts:30402, src/framework.ts:30447, src/framework.ts:30461, src/framework.ts:15275, src/framework.ts:15279: The refusal step logs the incremented old episode count before checking whether the marker can be reused.
    • Failing case: After a first rewind, append a retained notice after its marker and trigger another supported refusal rewind: the log reports two turns shed so far, but updateRewindMarker creates a new marker with count one; a missing or branched-away marker has the same discrepancy.
  • 13. minor at src/framework.ts:36319, src/framework.ts:36329, src/framework.ts:36343, src/framework.ts:36351, src/framework.ts:15701, src/framework.ts:30402: Stopping an exhaustion episode leaves its shared marker count live for later independent recoveries.
    • Failing case: After exhaustion removes two turns and stops at its cap, start /unstick while the old marker is still the tail and have its first probe refuse: its first confirmed removal is logged as three turns shed even though the forced session has removed only one; the reverse transition also makes the exhaustion log compare a combined marker count with its separate cap.
  • 14. minor at src/framework.ts:36166, src/framework.ts:36292, src/framework.ts:36333, src/framework.ts:15327, src/framework.ts:28929: Exhaustion quarantine during a forced session doesn't add its confirmed removal to the session's removed record.
    • Failing case: After the hard-down threshold has been reached, an /unstick probe fails with a qualifying invalid-request error before a stream is created: exhaustion reports turn-failed with the current count, then quarantine runs with the token released, removes a turn and queues its own retry. The forced session remains open, but its eventual cleared or gave-up answer and channel summary still report zero for that removal, including if quarantine's write was confirmed only by readback.
  • 15. minor at test/refusal-rewind.test.ts:374, test/refusal-rewind.test.ts:385: The unpresented-result refusal test checks the carried call on the first request, not the retry, and never witnesses the planner's decision.
    • Failing case: If the retry did not carry the call, or refusal recovery simply stopped without planning, the endpoints, marker and absent retry could all satisfy these assertions without testing refusal of the unpresented result.
  • 16. minor at test/shed-window.test.ts:227, test/shed-window.test.ts:547, test/shed-window.test.ts:639, test/shed-window.test.ts:659, test/refusal-rewind.test.ts:203: Tests wait on request observation, runUntilIdle or fixed delays instead of the actual turn or recovery decision.
    • Failing case: Under scheduling load, a request can be recorded before its reply and recovery decision finish, or runUntilIdle can return before the start resumes; subsequent shedding, outcome or call-count assertions can then run against an earlier phase and fail nondeterministically.
    • Raised before as finding 19 of the review of f330884414fb, fixed then; this is a case the fix leaves.
  • 17. minor at change-text.md:38, src/framework.ts:15155, test/shed-window.test.ts:577: The change text says result-only bodies answering hidden/foreign calls are passed over, but the planner stops on visible orphans.
    • Failing case: A visible result whose call is hidden or belongs to another resident is selected as a witness and the plan declines for a missing or hidden call rather than proceeding to an older eligible row; the update would mislead a reviewer about the current contract.
  • 18. minor at src/framework.ts:15177, src/framework.ts:15198, src/framework.ts:15691, src/framework.ts:30393: The planner rescans the window and raw history for each selected body or row, giving quadratic work.
    • Failing case: With N stored rows and a supported newest tool exchange containing S separately stored results or shards, the position lookups can take O(N×S) comparisons, including raw lookups that are unused in presented mode; a large exchange on a long-lived resident can therefore block other host work during refusal handling or before /unstick acknowledges.

…contained every selected body

Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
@theaspirational

theaspirational commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Answers to the automated review of 5556756b, now at 4d53b33f. We keep the safe default (B). The blocker was real: our earlier fix limited recovery to bodies the failed compile contained, but tool closure could still pull in a late result that the failed request never carried, and remove it. Exhaustion recovery now declines the whole plan unless every selected body, closure included, was in the failed request. Two earlier answers, 4 and 17, were false and are corrected below.

  • 1 Fixed: Legacy selection reuses the compile's recorded visibility filter, not presentation ownership. The public refusal regression proves the failed request contains the newer co-resident own-row and the retry removes it while retaining the older row; restoring the old selector makes it fail. Visible foreign tool rounds still decline closure rather than sacrificing older history.
  • 2 Fixed: Descriptions, comments, changelog and test headers now distinguish supported quiescent pre-stream exhaustion from active-stream terminal failure, as the description names it, which stops unchanged for manual repair without quarantine or retry. Our earlier unconditional terminal-exhaustion support claim was false.
  • 3 Fixed: Disclosed synchronous whole-history inflation, event-loop stalls and memory-exhaustion risk, not just a bounded step count. Three cold plans over 32 MiB of historical image base64 with one presented row measured 34.0–37.3 ms, 32.8–32.9 MiB additional heap and 80.4–80.6 MiB additional resident memory. These are observations, not bounds; a reproducible offline fixture is included.
  • 4 Corrected again: our previous fix restricted candidate selection to the failed compile but still let tool closure absorb a late, uncarried result. The earlier blanket late-arrival guarantee was false. The independent public probe reproduced both failures at the previous head (presented and legacy). Exhaustion now checks every selected body head, including all closure endpoints, against that attempt's raw-body witness and declines the whole plan on any nonmember, without splitting the exchange, selecting older history, removing endpoints, charging a step, adding a marker or queuing a rewind retry. Refusal's uncarried-resident-result compatibility is unchanged. Public start/nudge/store regressions prove the failed request carries the call but not the late result, and both endpoints and older history remain; public refusal controls still remove the complete exchange and retry. Ordinary late-text controls still retain the arrival while shedding the carried poison. Missing provenance or a changed/unreadable branch still declines; no current-history or earlier-attempt witness is substituted. These are attempt-local checks, not a durable writer fence.
  • 5 Fixed: Added an audience-scoped breaking entry covering affected hosts/operators, explicit declines, empty unstick, active-stream refusal, migration, unchanged behavior and minimum sibling versions; it requires a new minor release line.
  • 6 We keep tail-only marker consolidation because editing an earlier prefix across retained notices would misplace omissions. Our earlier one-marker-per-episode and shed-N/add-one convergence promises were false and are removed. If you prefer consolidation across notices, say so on review.
  • 7 Fixed: Active-stream controls now witness the breaker's explicit active-stream stop, not ID ambiguity. Quiescent mismatch and legacy-gap controls witness actual planner dispositions. The earlier reused-ID explanation was false and is corrected.
  • 8 Fixed: Documentation now distinguishes pre-mutation decline/cap from post-removal failure: every confirmed removal consumes a step even if a subsequent notification, cleanup or marker write fails; retry stays stopped.
  • 9 We keep attempt-local stopping without a durable wake fence because a persisted fence and operator-reset lifecycle are beyond this Safe B change. Our earlier no-replay wording was too broad: independent later wakes can plan and mutate after unknown/partial outcomes. The docs now state this explicitly and require stopping writers for inspection. If you prefer a durable fence/reset protocol here, say so on review.
  • 10 Fixed: Refusal budget exhaustion explicitly logs the rewind cap as the stop reason before forced-session give-up.
  • 11 Fixed: Empty preflight explains that there is no eligible request content and no session was opened; snapshot failure instead directs investigation of the read failure and a retry after reads recover.
  • 12 Fixed: Refusal logs use confirmed removals for their own automatic attempt or forced session, not an incremented marker count before marker reuse is known.
  • 13 We keep tail-marker reuse across caller transitions because its count describes consecutive omissions at that position, not a caller budget. Exhaustion and forced-session logs now use separate confirmed-removal counts, so they no longer compare a combined marker count with a session cap. If you prefer resetting consolidation at every caller transition or exhaustion stop, say so on review.
  • 14 Fixed: Exhaustion adds confirmed removals, including post-commit readback confirmation, to the active forced session and consumes its remaining budget before answering. Live regressions verify both the failure answer and eventual cleared summary report one removal; exhaustion cannot bypass the forced cap.
  • 15 Fixed: The unpresented-result test checks the actual refused retry and witnesses the planner's endpoint-outside-window decline, not merely unchanged endpoints or a carried call on an earlier request.
  • 16 Fixed: Cited public caller tests and remaining refusal polling loops now wait for the observed request plus logical-turn teardown or the actual recovery outcome, rather than treating request observation or an idle drain as completion. Our earlier blanket claim that these waits were all fixed was false.
  • 17 Fixed: the description is replaced. It now says that visible orphan results answering hidden or foreign calls stop recovery; they are not passed over to shed an older row. The earlier description was false.
  • 18 Fixed: Body and row positions are indexed, raw position indexing is confined to legacy removal, the raw body grouping is reused, and the endpoint-gap upper bound is computed once rather than rescanned for every intervening row. Whole-history inflation remains explicitly disclosed separately.

Build and typecheck pass; full suite 10,998 passed, 0 failed, 63 skipped. A public probe of the late-result case failed in both presented and legacy modes before the fix and passes now. An independent review reran that probe and the earlier witnesses and checked the lines above. Not run: live provider traffic.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic context view of 4d53b33fe399 merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of 1 of the 78 runs it could compare differ between the base and this head.

Couldn't tell whether 105 changed source lines ran, or whether 1 deletion was reached, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 94 changed source lines map to nothing the host runs: 11 of src/agent.ts's, 79 of src/framework.ts's and 4 of src/types/agent.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Separately, 3 of the checks' flags differ between the base and the head, in 1 run; they're listed under "Checks' flags that differ", below.

Usage: the agents' requests, subagents' included, in the 78 runs, base → head: 210,168 → 210,222 tokens sent a request, 72.0% of them read from the cache, 139,145,027 → 139,145,919 written to it, 3,952,176 → 3,950,756 output, 24 thinking blocks dropped, USD 0.5656 → USD 0.5658 at list price a priced request and 123 requests with no list price. The figures of 1 run moved, for any kind of request; they're under "Usage that differs", below. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Context in the 78 runs, base → head. Seams: 776 in both, moved in no run. Tokens in the parts they changed or took out: fewer in 1 run; 56,754,168 → 56,753,488 in all. The most one agent request held: lower in 1 run; 351,214 tokens at most in both. The summariser's requests: 1,841 in both, moved in no run. Their list price, leaving out 127 requests with no list price: USD 347.0521 in both, moved in no run. What these count.

No model read these records for this view, which started on its own. A view asked for with a /context-deltas comment by nissa-seru gives a model's account of the records of the pull request's head as it is when that view runs.

Runs whose records differ: 1 of 78

H1r/W16.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Checks' flags that differ (3)
  • H1r/W16 step 834005.break.3, check 14 flagged on the head 1 more time than on the base: W16's property: couldn't judge: no request at this step followed the failed 834005.break.3.primary.1

  • H1r/W16 step 834005.unstick, check 14 flagged on the head 1 more time than on the base: W16's property: request 834005.unstick.primary.1, the one refused at this step, lacks [[c:834005.break.3.r1]], which its rewind is to shed, so its retry isn't judged

  • H1r/W16 step 834005.break.3, check 1 flagged on the base 1 more time than on the head: the turn's answer never reached its channel: the host reported mcpl:speech-route-failed (turn has no locus (no home/trigger channel; nothing to deliver into))

Usage that differs: 1 of 78 runs, base → head
H1r/W16 kind requests input read from the cache written to it output thinking dropped list price, USD unpriced
agent 15 → 14 3,979 350,388 → 318,066 34,940 → 35,832 11,313 → 9,893 0 0.8273 → 0.7846 0

The figures of the other 77 runs are the same in the base and this head.

Context that differs: 1 of 78 runs, base → head
run seams tokens in parts changed or taken out largest seam most held
H1r/W16 3 5,403 → 4,723 2,001 33,317 → 32,945
Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/agent.ts: lines 40–45, 67–70 and 2528 map to nothing the host runs.

src/framework.ts: lines 3371–3376, 4636, 4654–4656, 15041–15046, 15062–15064, 15072–15075, 15085, 15094, 15112–15115, 15156–15157, 15204, 15209–15212, 15218, 15240–15244, 15275–15277, 15286–15290, 15299, 28331–28332, 28868–28870, 30444–30445, 30461–30462, 30467, 30515–30516, 35758–35759, 35761–35763, 36329–36330, 36341, 36344, 36360–36364, 36370 and 36394 map to nothing the host runs; couldn't tell whether lines 15055, 15097, 15129, 15132, 15178, 15196, 15215, 15224, 15236–15238, 15250, 15252–15259, 15263–15266, 15268, 15272–15273, 15278–15282, 15357, 15717–15725, 28998, 30435–30436, 30440–30441, 30451–30452, 30460, 30464, 30466, 30472–30474, 30513, 30517, 36333, 36335–36339, 36347–36351, 36354–36355, 36374, 36377–36381, 36390–36393, 36395–36418 and 36423 ran, or whether its deletion after line 36420 was reached.

src/types/agent.ts: lines 283, 286 and 288–289 map to nothing the host runs.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic review of 4d53b33fe399.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

…l-ID walk and teardown fixes

Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

Answers to the automated review of 4d53b33f, now at 3a6c8876. The blocker was real, and our earlier answer was wrong: a real streamed provider failure reported exhaustion while the stream was still registered, so Safe B recovery always declined; our tests only threw before the stream started. Recovery now runs once the stream has actually finished and settled, still tied to the same failed attempt and every Safe B condition. This widens the published behaviour: before, only pre-stream failures could recover. The description says so.

  • 1 Fixed: this widens the published pre-stream-only path. Registered qualifying provider-400 streams retain their attempt's compile/branch witness; exhaustion recovery runs only after clean iterator completion, delivery and teardown, with terminal ownership rechecked and terminal waiters resolved with failure accounting. Live/unsettled and superseded-stream controls still decline. Presented and legacy positive witnesses both fail on the previous head (3 requests, not the required repaired fourth), and pass with the fix. Replaced the retired docs, changelog and test claims.
  • 2 Fixed: observed transcript-only own-row calls/results no longer enter the reader's native ID ownership walk. A real observing resident's earlier unfinished X no longer blocks its own complete X pair; the compiled wire proves the foreign call is text. Legacy raw-mode unresolved reuse still declines.
  • 3 Fixed: the guide now distinguishes no shedding/rewind retry from an unchanged store; failure accounting can append an inference-failed notice even when quarantine declines.
  • 4 Fixed: the probe instructions explicitly require a source checkout, not an installed package; no extra runtime package files were added.
  • 5 Fixed: carried malformed-result controls now actually carry the malformed result, use the same set for plan/apply, and assert exact decline reasons; mixed-chain controls also assert the intended reason.
  • 6 Fixed: unsupported auto/forced callers now assert their actual malformed-exchange reason, and forced re-planning specifically witnesses the newly mixed-body decline rather than a generic gave-up outcome.
  • 7 Fixed: active-stream and unsettled logical/tool-work stops advise waiting for settlement, not mandatory manual history repair.
  • 8 Fixed: removal notifications run under a reentrant-recovery guard, so a synchronous retraction listener cannot replace the forced session before accounting; failure answers also retain the original session identity. A regression verifies the rejected replacement and confirmed removal count.
  • 9 We keep current-mode marker prose because per-step raw-retention provenance across mode changes is outside this transient notice's contract, and the guide explicitly excludes storage-audit use; if you prefer per-removal mode tracking, say so on review.
  • 10 We keep initial marker metadata because CM's public editMessage updates content only, and replacing a tail marker or adding a metadata-edit API would broaden the storage/notice change; the guide now explicitly says metadata is initial, not a current aggregate; if you prefer aggregate metadata with a companion CM API change, say so on review.
  • 11 Fixed: a confirmed legacy removal reconciles other windows before returning the branch-changed stop; it still counts the committed removal and never retries. A post-write branch-change control verifies the other resident's ordinal is removed.
  • 12 Fixed: host maxRewinds must be a finite number before a session is opened; strings, NaN and infinities cannot create an unbounded forced budget. Added rejection/no-session/no-write controls.
  • 13 Fixed: existing foreign/audience result controls now name their early incomplete-results decline, and added co-shard controls reach endpoint ownership/audience validation after successful closure, asserting its exact hidden-content reason in both modes.
  • 14 Fixed: the exhaustion-cap log now requires inspection and points to exclusive offline repair guidance; it no longer recommends unqualified /unstick or /undo.
  • 15 Fixed: quarantine logs say qualifying inference failures, and the outage test names server/unclassified failures rather than retryability. A qualifying-400 control verifies recovery for true, false and unknown retryability.
  • 16 Fixed: comments/test headers now say the cap bounds steps, not preserved history; an explicit one-body control proves even the first step may remove all eligible conversational content.

Typecheck and 477 relevant tests pass, run by an independent review that also checked each line above against the code and confirmed: only a finished stream counts, recovery stays tied to the same attempt, the witness 400 is one the policy admits with a live-stream negative control, and the widening is stated. A real streamed 400 fails on the previous head and passes now. Not run: live provider traffic.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic context view of 3a6c8876d83c merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 78 runs it could compare don't differ between the base and this head.

Couldn't tell whether 106 changed source lines ran, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 121 changed source lines map to nothing the host runs: 11 of src/agent.ts's, 106 of src/framework.ts's and 4 of src/types/agent.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 78 runs are the same in the base and this head: 210,168 tokens sent a request, 72.0% of them read from the cache, 139,145,027 written to it, 3,952,176 output, 24 thinking blocks dropped, USD 0.5656 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/agent.ts: lines 40–45, 67–70 and 2528 map to nothing the host runs.

src/framework.ts: lines 3247–3248, 3374–3379, 4639, 4657–4659, 15045–15050, 15067–15069, 15078–15079, 15083–15087, 15097, 15106, 15124–15127, 15168–15169, 15216, 15221–15224, 15230, 15252–15256, 15284, 15295–15297, 15306–15310, 15319, 28354–28355, 28892–28894, 29438–29442, 30477–30478, 30494–30495, 30500, 30548–30549, 31006, 31011–31014, 31409, 31415, 31473, 31608–31610, 31617, 31619, 35820–35821, 35823–35827, 36394–36395, 36406, 36409, 36424–36428, 36432, 36434 and 36458 map to nothing the host runs; couldn't tell whether lines 15060, 15082, 15109, 15141, 15144, 15190, 15208, 15227, 15236, 15248–15250, 15265, 15267–15274, 15278–15281, 15283, 15287–15288, 15298–15302, 15377, 15737–15745, 15749, 29022, 30468–30469, 30473–30474, 30484–30485, 30493, 30497, 30499, 30505–30507, 30546, 30550, 31394–31408, 31410–31413, 31478, 31616, 36392, 36396, 36398, 36402, 36404, 36411–36415, 36418–36419, 36443–36444, 36449, 36455–36456, 36462–36464, 36470–36471, 36475–36476 and 36483–36484 ran.

src/types/agent.ts: lines 283, 286 and 288–289 map to nothing the host runs.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic review of 3a6c8876d83c.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. should fix at src/framework.ts:31593, src/framework.ts:31608, src/framework.ts:14027, src/framework.ts:24118, src/framework.ts:31601, src/framework.ts:30988: Deferred settleAgent runs after the finally block's draft-settlement check, so exhausted turns skip settleTurnDrafts.
    • Failing case: A qualifying error ends a turn with held or bounced drafts and openLogical still points to streamRouting: the check at line 31593 skips settleTurnDrafts, then exhaustedAtEnd deletes openLogical, with no later settlement for that routing; notices already in history remain unrecorded as noticed and can be repeated by catch-up.
  • 2. should fix at docs/recovery-b.md:182, src/framework.ts:15264, src/presentation.ts:1439: The repair guide's retractRows instruction omits { undone: true }, so the retracted call can be presented again.
    • Failing case: An operator retracts a verified trailing call body with cm.retractRows([head]) and verifies the offline window; on restart the presentation scan can treat that own row as unpresented and put the orphaned call back, whereas the framework's recovery uses retractRows(heads, { undone: true }) to prevent that.
  • 3. minor at src/framework.ts:31471, src/framework.ts:31533, src/framework.ts:31538, src/framework.ts:31542, src/framework.ts:31563, src/framework.ts:31573, src/framework.ts:29218, src/framework.ts:30988, src/framework.ts:29561, src/framework.ts:31469, src/framework.ts:31608: Exhaustion handling awaits unbounded iterator and speech-delivery settlement, deferring the failure report and holding turn and admission state indefinitely.
    • Failing case: After a qualifying provider error and clean iterator completion, let a channel publish queued by this or an earlier stream never settle: the finally remains at the await, retaining the turn token, primary provider gate, activeStreams entry, typing indicator and eventGate inferring flag; buffered wakes cannot proceed, and stop or quiesce cannot cancel this wait through the already-reset agent stream.
  • 4. minor at src/framework.ts:31601, src/framework.ts:30989, src/framework.ts:14037, src/framework.ts:31605, src/framework.ts:31389, src/framework.ts:14050, src/framework.ts:30995, src/framework.ts:31003, src/framework.ts:31402, src/framework.ts:35684: The ownership recheck drops the old stream's whole delayed callback, including its turn-scoped settlement and its failure notification and policy actions.
    • Failing case: If a successor stream starts while an invalid-request stream is unwinding, the ownership check declines the old callback entirely; its scripts are not told that their turn failed and its input pin is not released, whereas settling the old stream's own routing would leave the successor intact.
  • 5. minor at src/types/agent.ts:283, src/types/agent.ts:317, src/agent.ts:241, src/framework.ts:15165, src/framework.ts:15725, src/framework.ts:15055: Descriptions and comments still say rewind redacts the triggering turn and reruns, but selection walks newest-first and unsupported plans decline.
    • Failing case: If an older message caused the refusal and the most recent eligible message is unrelated, enabling auto-rewind removes the newer message first; a host relying on this description could assume that only the offending message is removed.
    • Raised before as finding 9 of the review of f330884414fb, fixed then; this is a case the fix leaves.
  • 6. minor at src/framework.ts:30987, src/framework.ts:24807, src/framework.ts:31605, src/framework.ts:36211: Dropping a stale deferred terminal leaves its name-keyed exhaustedTurns snapshot for a later unrelated failure to consume.
    • Failing case: An error after partial work records exhaustedTurns, then a successor starts or completes while the old frame awaits delivery, so the ownership check skips its report; if a subsequent turn fails before making progress, noteFailedTurnEnd does not replace the snapshot and noteInferenceExhausted writes a failure notice falsely attributing the old turn's rounds, cut-off calls or speech to the new one.
  • 7. minor at src/agent.ts:2513, src/framework.ts:15225, test/shed-window.test.ts:400, test/shed-window.test.ts:1312: Exhaustion tests never establish that real compile provenance identifies a sharded body's first row; sharded planner tests use synthetic witnesses.
    • Failing case: Compile and fail a request containing a carried multi-shard call and result, including a body whose relevant content is not in its first shard: a regression in the provenance-to-head identity mapping would make the real recovery decline or authorize the wrong body, while the existing single-row end-to-end and synthetic sharded controls can still pass.
  • 8. minor at src/framework.ts:15081, src/agent.ts:637, src/agent.ts:642, src/framework.ts:12249: The transcript-mode ID walk treats differently stamped owners as foreign even when a shared derived agent sends their turns natively.
    • Failing case: A shared child inherits transcript mode and a complete parent call/result round in its presented window; the child treats the parent as a self participant and sends the call natively, but intended excludes its parent-stamped rows, so selecting that result reports a missing call and recovery declines instead of shedding the complete exchange.
  • 9. minor at src/framework.ts:15080, src/foreign-rounds.ts:170, src/agent.ts:637: Unstamped older co-resident calls enter the native-ID walk because exclusion relies on ownRowOf rather than the compiler's participant.
    • Failing case: In an upgraded presented observer's history, an unstamped old co-resident call with ID x is followed by the observer's complete native call/result using x; the old call is transcribed on the request, but the planner treats it as an unresolved native call and declines the observer's valid exchange as reused ambiguous IDs.
    • Raised before as finding 2 of the review of 4d53b33fe399, fixed then; this is a case the fix leaves.
  • 10. minor at src/framework.ts:15275, src/framework.ts:30477, src/framework.ts:30499, src/framework.ts:36468, src/framework.ts:36477: The marker is created only after every removal and cleanup step succeeds, so a confirmed irreversible removal can stop without any agent-visible notice.
    • Failing case: When retractRows commits and then throws, or a refusal's reply cleanup fails after the shed, recovery records the removal and stops before writing a rewind marker; a later independent wake can run with the content missing and no notice explaining the gap.
  • 11. minor at src/framework.ts:15322, src/framework.ts:15327: A reused marker describes every counted omission using only the current window mode.
    • Failing case: After a legacy removal writes a tail marker, switch to a presented window retaining that marker and perform another consecutive removal: the updated two-turn marker says the originals remain in the raw record even though the first was deleted from it.
    • Raised before as finding 9 of the review of 4d53b33fe399 and answered by its author as a choice: «We keep current-mode marker prose because per-step raw-retention provenance across mode changes is outside this transient notice's contract, and the guide explicitly excludes storage-audit use; if you prefer per-removal mode tracking, say so on review.» Only a maintainer's choice folds a finding.
  • 12. minor at test/shed-window.test.ts:595, test/shed-window.test.ts:631, test/shed-window.test.ts:1535: Tests use runUntilIdle as a completion barrier, but it misses an inference start that has taken its request without registering a stream.
    • Failing case: If compilation is delayed after the scheduler removes the pending request, runUntilIdle can return while the repaired retry or observed-transcript request is still starting; the following request-count or message assertions then run too early, and the helper has no outer timeout if work remains active.
    • Raised before as finding 16 of the review of 5556756b435a, fixed then; this is a case the fix leaves.
  • 13. minor at test/shed-window.test.ts:628, test/shed-window.test.ts:634: The presented-mode observation control never checks that the foreign call actually appeared as transcript text.
    • Failing case: If observed rows stop being presented or rendered at all, the planner can still select the native pair and the request still contains one native tool call, so the test passes without exercising the observed call that is supposed to collide with its ID.
  • 14. minor at test/end-turn-usage.test.ts:824, test/end-turn-usage.test.ts:826: The zero budget and four-call count don't prove a rewind step was consumed or that the fourth request carried repaired history.
    • Failing case: If the streamed failure schedules a fourth request without incrementing its rewind counter, or that request still carries the quarantined message, the successful default response leaves the counter at zero and the assertions still pass.
  • 15. minor at src/types/agent.ts:286, src/types/agent.ts:320, src/framework.ts:36426, src/framework.ts:30526: The 'up to maxRewinds' doc claim is false because refusal rewind clamps to at least one and compares against unrounded values.
    • Failing case: With autoRewind: true, maxRewinds: 0, a host expecting no rewind can still lose one eligible body and receive a retry; similarly, 1.5 allows two rewinds.
  • 16. minor at src/framework.ts:31003, src/framework.ts:31010, src/framework.ts:31533, src/gate/event-gate.ts:4162: For non-qualifying errors, action.emit is pushed before the inference gate is released, unlike the base ordering.
    • Failing case: Have a non-recovery provider error return an action.emit handled by a module that requests inference under a debounce gate policy, and leave the stream iterator slow or hung after its error event: the event is processed while the agent remains marked inferring, so the debounce batch waits in the inference buffer until finally runs, potentially indefinitely or until the buffer cap drops it; qualifying failures instead invoke the callback after the finally's gate release.
  • 17. minor at src/framework.ts:31468, src/framework.ts:31608, src/framework.ts:36392, docs/recovery-b.md:81, changelog.d/1026-settled-stream.fixed.md:10: The settlement flag discards an available compile witness, so an unclean iterator end is logged as missing compile history needing manual repair.
    • Failing case: At the hard-down threshold, a qualifying provider error thrown from the iterator leaves streamFinished false even when compiledHistory exists; after teardown the callback receives undefined and logs 'failed compile history unavailable. Manual repair needed.' although the known problem is the unclean stream end, not missing provenance or established history damage.
  • 18. minor at src/agent.ts:237, src/framework.ts:15747, src/framework.ts:30526, src/framework.ts:36433, src/framework.ts:36440: Agent configuration never validates maxRewinds, so NaN, Infinity or string values make refusal and exhaustion budgets ineffective.
    • Failing case: An agent configured with autoRewind and maxRewinds: Infinity can keep shedding and retrying without a finite refusal cap; with maxRewinds: NaN, or a nonnumeric string from runtime configuration, the exhaustion cap is NaN and used >= cap is always false, allowing repeated qualifying failures to consume history beyond the documented hard cap of 10. NaN also makes the refusal comparison used < cap false, disabling automatic refusal recovery entirely.
  • 19. minor at src/framework.ts:3975, src/framework.ts:15264: The quarantine predicate's comment says the record keeps a shed exchange, but legacy recovery deletes it from raw storage.
    • Failing case: A maintainer relying on the comment when evaluating a 413 quarantine in a legacy window would expect to recover the original exchange from the record, whereas the raw contiguous removal deletes it.
  • 20. minor at docs/recovery-b.md:111, src/framework.ts:15057, src/framework.ts:15070: The cost guide says every plan calls getAllMessages(), overlooking guard and logical-turn checks that return earlier.
    • Failing case: An /unstick preflight on an idle-status agent with a queued continuation declines as a live assistant round without inflating raw history, contrary to the guide's guidance for operators assessing the cost of a declined plan.

@theaspirational

Copy link
Copy Markdown
Contributor Author

Answers to the automated review of 3a6c8876, now at 59f8aca3. Both should-fix findings were real. A qualifying exhausted turn now closes before the turn-end draft check, so the held-draft notice is recorded at that turn and catch-up no longer repeats it; a regression reaches the notice through a real streamed 400 and fails on the previous head. The offline repair guide now calls retractRows([head], { undone: true }). Recovery stays tied to the same attempt's finished stream, and the widening stated earlier is unchanged.

  • 1 Fixed: postponed exhausted-turn settlement now precedes the draft-settlement check. A qualifying registered 400 with a held draft records its notice and cannot repeat it on catch-up beyond the scan window; restoring the old order fails the regression. Finished-stream-only, same-attempt provenance, admitted-400/live-stream controls and the documented widening remain.
  • 2 Fixed: exclusive offline presented-window repair now uses cm.retractRows([head], { undone: true }), preventing normal presentation from restoring the orphaned call.
  • 3 We keep fail-closed iterator/delivery waits because recovery cannot treat potentially writing work as settled; if you prefer cancellable delivery deadlines and a separate non-recovery terminal path, say so on review.
  • 4 We keep ownership-gated delayed callbacks because settleAgent also resolves name-keyed ephemeral runs and policy effects that must not reach a successor; if you prefer splitting old-turn script/input-pin settlement from those effects, say so on review.
  • 5 Fixed: our earlier answer was wrong about the remaining descriptions. Public configuration and validation prose and the unstick comment now say newest eligible complete body, not the proven refusal trigger, with unsupported plans declining.
  • 6 Fixed: stale terminals discard only their captured failed-turn snapshot, preserving a successor's replacement snapshot; no-progress failures also clear inherited snapshots. Both stale-snapshot cases have regressions.
  • 7 Fixed: registered-400 positive tests now also compile real multi-shard call/result bodies whose tool IDs occur after their first shards, assert the real provenance contains the heads, and verify whole-body quarantine in both window modes.
  • 8 We keep conservative decline for inherited parent-stamped tool rounds because broadening closure ownership requires shared-agent participant/provenance controls beyond stamped ownership; if you prefer participant-aware inherited-round recovery, say so on review.
  • 9 We keep conservative decline on unstamped foreign-ID reuse (our earlier answer was wrong for unstamped rows) because safe support needs participant-aware call/result ownership rather than assuming every unstamped call is native; if you prefer that compatibility expansion with upgrade controls, say so on review.
  • 10 We keep stop-before-marker after failed removal/cleanup because those writes and the notice are not atomic and a confirmed removal is already accounted without replay or retry; if you prefer best-effort gap notices on partial failures, say so on review.
  • 11 Fixed: our earlier answer was wrong to defend an inaccurate aggregate retention claim. Consolidated markers now avoid asserting that all originals remain or were deleted; a legacy-to-presented regression covers reuse without per-removal tracking.
  • 12 Fixed: our earlier completion-barrier answer was wrong for suspended starts. The cited controls now use bounded waits for the expected request and completion plus logical-turn teardown, not runUntilIdle as the retry/start barrier.
  • 13 Fixed: the observation control explicitly checks the foreign shell call's transcript text in the compiled request, as well as the native tool-call count.
  • 14 Fixed: the hard-down control observes one spent rewind step before request four begins, and asserts that request omits the quarantined input and carries the rewind marker, before success resets the budget.
  • 15 Fixed: configuration documentation now states the existing minimum-one, fractional-round-up behavior and exhaustion's additional ten-step clamp rather than promising a literal unnormalized maximum.
  • 16 Fixed: non-qualifying terminal errors release the inference gate before exhaustion/policy emission. A real-gate regression holds iterator return and verifies the emitted policy event sees no inferring agent.
  • 17 Fixed: absent recovery witnesses now report missing compile history or uncertain stream/delivery settlement without asserting manual history repair is necessary. An unclean-iterator regression preserves history and declines retry.
  • 18 Fixed: agent configuration rejects strings, NaN and infinities for maxRewinds before opening storage or constructing an Agent; finite defaults and existing budget normalization remain. Rejection controls cover both entry points.
  • 19 Fixed: the quarantine predicate's comment distinguishes presented-mode raw retention from legacy raw deletion.
  • 20 Fixed: the cost guide now limits whole-history inflation to plans that pass the early guard and live-turn checks, including plans that decline later.

Typecheck passes. The held-draft regression and the focused lifecycle and marker tests pass. An independent review checked each line above against the code, reran the held-draft test against the previous source (it fails at the notice assertion), and confirmed again: only a finished stream counts, recovery stays tied to the same attempt, the admitted 400 has a live-stream negative control, and the widening is stated. Full-suite and live provider runs are not claimed here.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic context view of 59f8aca33a05 merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 78 runs it could compare don't differ between the base and this head.

Couldn't tell whether 109 changed source lines ran, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 140 changed source lines map to nothing the host runs: 11 of src/agent.ts's, 119 of src/framework.ts's and 10 of src/types/agent.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 78 runs are the same in the base and this head: 210,168 tokens sent a request, 72.0% of them read from the cache, 139,145,027 written to it, 3,952,176 output, 24 thinking blocks dropped, USD 0.5656 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/agent.ts: lines 40–45, 67–70 and 2532 map to nothing the host runs; couldn't tell whether line 246 ran.

src/framework.ts: lines 3247–3248, 3374–3379, 3976–3980, 4640, 4658–4660, 15046–15051, 15068–15070, 15079–15080, 15084–15088, 15098, 15107, 15125–15128, 15169–15170, 15217, 15222–15225, 15231, 15253–15257, 15285, 15296–15298, 15307–15311, 15320, 15728–15731, 24811, 28359–28360, 28897–28899, 29443–29447, 30483–30484, 30500–30501, 30506, 30554–30555, 31013, 31018–31021, 31418, 31425, 31483, 31604–31605, 31607–31609, 31615, 31618, 31620, 35834–35835, 35837–35841, 36408–36409, 36420, 36423, 36438–36442, 36446, 36448 and 36472 map to nothing the host runs; couldn't tell whether lines 15061, 15083, 15110, 15142, 15145, 15191, 15209, 15228, 15237, 15249–15251, 15266, 15268–15275, 15279–15282, 15284, 15288–15289, 15299–15303, 15379, 15740–15748, 15752, 29027, 30474–30475, 30479–30480, 30490–30491, 30499, 30503, 30505, 30511–30513, 30552, 30556, 31402–31417, 31419–31420, 31422–31423, 31488, 31616–31617, 36406, 36410, 36412, 36416, 36418, 36425–36429, 36432–36433, 36457–36458, 36463, 36469–36470, 36476–36478, 36484–36485, 36489–36490 and 36497–36498 ran.

src/types/agent.ts: lines 283–290, 318 and 320 map to nothing the host runs.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

…ine repair undone

Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic review of 59f8aca33a05.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. blocker at src/agent.ts:2517, src/framework.ts:28751, src/framework.ts:20154, src/framework.ts:31607, src/framework.ts:15177: Exhaustion recovery uses the initial compile's carried-body set, which later tool rounds never update.
    • Failing case: A stream compiles an ordinary user message, completes a tool call and submits its stored result, then receives a qualifying 400 on the next provider round. The tool call and result are added to streamCarried, but not to compiledHistory.carriedBodies; terminal recovery therefore skips that newer exchange and can remove the older user message and retry while leaving the actual newest failed-request exchange intact.
  • 2. should fix at src/framework.ts:29226, src/framework.ts:31481: Speech-delivery rejections are caught and turned into a fulfilled turnSpeechChain, so failed delivery counts as settled.
    • Failing case: A queued speech delivery throws after an uncertain publish or store write, then the stream cleanly ends with a qualifying invalid-request error at the quarantine threshold; the error is logged, but await turnSpeechChain succeeds and passes the compiled-history witness to recovery, allowing history removal despite uncertain delivery settlement.
  • 3. should fix at src/framework.ts:15328: Reused rewind markers send the agent to host logs and drop the retention statement even when the window mode is unchanged.
    • Failing case: Two consecutive supported rewinds reuse the tail marker in a presented window: on its next request the agent reads 'Raw-record retention may differ between omissions; consult the host logs' instead of being told whether the omitted content remains available, and it has no host-log access with which to resolve that uncertainty.
  • 4. should fix at changelog.d/1026-bounded-recovery.changed.md:18, src/framework.ts:15328: The changelog says presented-window markers state the originals remain in the raw record, but reused markers no longer say this.
    • Failing case: After a second consecutive presented-window rewind, the marker says retention may differ and directs the reader to host logs, contrary to the release note's unconditional description.
  • 5. should fix at test/shed-window.test.ts:589, test/shed-window.test.ts:603, test/shed-window.test.ts:1520, test/shed-window.test.ts:1560: The registered-stream tests never pin quarantine to completed delivery and teardown.
    • Failing case: If the recovery path were changed to quarantine after the error event but before queued delivery or iterator cleanup finishes, the positive streams could already have closed by the time their retry is checked, and the held-stream assertion would still only exercise the host-command guard.
  • 6. should fix at docs/recovery-b.md:36, test/shed-window.test.ts:647: The recovery guide says ID reuse by another resident creates no ambiguity, but legacy observed calls can reserve the same ID.
    • Failing case: When a legacy reader observes Oren's unresolved call with ID shared before its own completed shared round, the test shows planning declines with reused unresolved call IDs; an operator relying on the guide would expect that other-resident reuse not to block recovery.
Minor findings 7 to 24 (of 24)
  • 7. minor at src/framework.ts:31481, src/framework.ts:31543, src/framework.ts:31548, src/framework.ts:31583: Awaiting delivery before teardown has no bound, so a hung delivery holds turn, gate and shutdown open indefinitely.
    • Failing case: A qualifying exhausted stream queues a speech delivery that never resolves, then ends cleanly: its agent has already reset, so stop or quiesce-abandon cannot cancel that delivery through the agent's stream; the registered driveStream promise never settles, the agent remains blocked, and stop() without a timeout waits forever (a bounded stop instead times out and fails).
    • Raised before as finding 3 of the review of 3a6c8876d83c and answered by its author as a choice: «We keep fail-closed iterator/delivery waits because recovery cannot treat potentially writing work as settled; if you prefer cancellable delivery deadlines and a separate non-recovery terminal path, say so on review.» Only a maintainer's choice folds a finding.
  • 8. minor at src/framework.ts:31604, src/framework.ts:31610, src/framework.ts:14028, src/framework.ts:31620, src/framework.ts:31596, src/framework.ts:31607, src/framework.ts:15755, src/framework.ts:14042, src/framework.ts:14256, src/framework.ts:14337: The ownership or forced-session recheck drops the whole deferred exhausted-turn settlement instead of only the recovery that depends on the successor.
    • Failing case: While a qualifying terminal waits for iterator or delivery settlement, a successor takes ownership, or a teardown notification opens a replacement forced session after the old token is removed but before this check; in the latter case even with the same agent and stream, settleAgent never closes openLogical, ends scripts, releases the turn-input pin or rejects an ephemeral run, and draft settlement is skipped, while the failure trace and rearm are also lost.
    • Raised before as finding 4 of the review of 3a6c8876d83c and answered: «We keep ownership-gated delayed callbacks because settleAgent also resolves name-keyed ephemeral runs and policy effects that must not reach a successor; if you prefer splitting old-turn script/input-pin settlement from those effects, say so on review.» At this head, that doesn't hold: The answer justifies dropping settleAgent because its name-keyed run and policy effects must not reach a successor. The gate also drops it when only forcedRewind changed (31606) and agent, streamId and token show no successor, so in that case the run and effects belong to this same turn.
  • 9. minor at src/framework.ts:15754, src/types/agent.ts:321, src/framework.ts:30532, src/framework.ts:36447, src/types/agent.ts:320, src/framework.ts:15750: /unstick floors a fractional maxRewinds, while refusal, exhaustion and the docs round it up.
    • Failing case: With refusalHandling.maxRewinds: 1.5 and no command override, automatic refusal and exhaustion can each perform two removals, but /unstick permits only one.
  • 10. minor at src/framework.ts:29000, src/framework.ts:29021, src/framework.ts:29223: Pre-stream qualifying failures go straight to exhaustion accounting and never wait on earlier streams' pending speech deliveries.
    • Failing case: An earlier turn ends while its queued prose delivery is still pending, and a later wake compiles successfully but stream creation throws a qualifying error at the failure threshold; the earlier stream has already been deregistered and the new start clears its token, so the recovery checks can remove history while the earlier delivery can still write.
  • 11. minor at src/framework.ts:15287, src/framework.ts:13318, src/framework.ts:13322, src/framework.ts:30479, src/framework.ts:36474: The recoveryApplying guard does not defer agent teardown, so a removal listener can end the forced session before the removal is counted.
    • Failing case: For a non-default agent with a live /unstick session, a presentation:retracted listener calls stopAgent after retractRows commits. forgetFailureAccounting answers agent-ended with zero rewinds and deletes the session; applyShed then returns its record and the caller increments only the detached session object, so the answer permanently omits the removal.
    • Raised before as finding 8 of the review of 4d53b33fe399, fixed then; this is a case the fix leaves.
  • 12. minor at src/framework.ts:15294, src/framework.ts:15338, src/framework.ts:15755, src/framework.ts:30492, src/framework.ts:30501, src/framework.ts:30504, src/framework.ts:30509, src/framework.ts:36295, src/framework.ts:36399, src/framework.ts:36418, src/framework.ts:36489, src/framework.ts:36502: The reentrancy guard ends at applyShed, so later failure-notice, cleanup and marker notifications can change session ownership mid-recovery.
    • Failing case: During settled exhaustion, a presentation listener invoked by the inference-failed notice can start a replacement /unstick, causing the captured session's turn-failed answer and quarantine to be skipped. Alternatively, a listener invoked by the rewind-marker write can replace the session after a confirmed removal: the old waiter receives replaced rather than the removal-bearing failure, while the old attempt still queues a retry against the new session. A stopAgent listener during refusal cleanup likewise ends the session before the old attempt queues its retry.
  • 13. minor at src/framework.ts:30475: Refusal-rewind decline logs give only an internal plan reason, with no guidance to wait or repair.
    • Failing case: When automatic refusal recovery stops on an incomplete tool round, the logs say 'unsupported: incomplete or ambiguous results' and 'recovery stopped', but give no repair guidance or warning that repeating the wake will not fix the history.
  • 14. minor at test/shed-window.test.ts:1750, test/shed-window.test.ts:1768: The unclean-iterator test never verifies that compile provenance reached the failure path.
    • Failing case: If onCompiledHistory stopped supplying the witness entirely, this test would still see the combined 'failed compile history unavailable or stream/delivery settlement uncertain' message and unchanged history, without testing rejection of an unclean stream that has provenance.
  • 15. minor at test/shed-window.test.ts:397, test/shed-window.test.ts:440, test/shed-window.test.ts:728, test/shed-window.test.ts:958, test/shed-window.test.ts:1057: Several named decline controls assert only a generic unsupported or unchanged outcome, not their specific decline reason.
    • Failing case: If planning these hidden-shard or orphan cases returned snapshot unavailable, or the terminal-exhaustion case stopped for missing provenance or unsettled guard work, the respective assertions could still pass without testing the named decline reason.
  • 16. minor at test/tool-result-guard.test.ts:1125, test/tool-result-guard.test.ts:1175: The held-delivery controls treat a 100 ms delay as proof that the restarted stream reached its decision.
    • Failing case: If the second request is recorded but delivery or stream completion is delayed under load, the no-continuation/no-receipt assertions pass before the race has been exercised; after release, the final positive assertions can still pass.
  • 17. minor at test/prose-drafts.test.ts:1754, test/prose-drafts.test.ts:4477, test/prose-drafts.test.ts:4692: The bounce-wake cap and heartbeat tests use fixed sleeps instead of waiting for the work that could enqueue another wake.
    • Failing case: Under load, a wrongly scheduled third bounce wake or heartbeat bounce wake can remain pending beyond the sleep, so the tests observe two or one calls respectively and pass before the unwanted request starts.
  • 18. minor at test/refusal-rewind.test.ts:157: The tool fake treats its timeout as successful completion of the wait for the injected message.
    • Failing case: If the external event is delayed beyond five seconds, the fake returns the tool result without having observed message:added, so the test no longer exercises an arrival during the held tool call and can fail or judge a different ordering.
  • 19. minor at test/unstick-outcome.test.ts:259, test/unstick-outcome.test.ts:262: The agent-ended test never confirms the first outcome request registered as a waiter before the stop.
    • Failing case: An implementation that delays processing that request until after the stop and then returns the retained agent-ended answer would pass both assertions without testing notification of an already waiting request.
  • 20. minor at src/types/agent.ts:284, src/framework.ts:30443, src/framework.ts:15325: The documentation calls the rewind marker metadata-only, but the marker carries text sent to the model.
    • Failing case: After a supported refusal rewind, updateRewindMarker stores prose beginning [turns-set-aside] The ... and advises the agent how to continue; a host configuring auto-rewind could incorrectly expect no model-visible textual instruction.
  • 21. minor at src/framework.ts:31604, src/framework.ts:30995, src/framework.ts:36467, src/framework.ts:36502: The post-delivery ownership check ignores shutdown and closed admission, so quarantine can run after stop() has begun.
    • Failing case: Start stop() while a qualifying exhausted frame is awaiting delivery, then let delivery complete with the same agent, generation and forced session and a qualifying carried history: stop waits for this frame, but it removes the turn token and active stream and calls exhaustedAtEnd, whose exhaustion listener can shed history, write a rewind marker and queue an inference-failure-rewind-retry even though admission is closed; rearmExhaustedTurn itself does check providerAdmissionClosed and therefore does not rearm during stop.
  • 22. minor at src/framework.ts:24812, test/shed-window.test.ts:1675: The stale-terminal test substitutes a snapshot directly and never drives a later no-progress failure.
    • Failing case: If noteFailedTurnEnd stops deleting an earlier deferred snapshot when the new failure made no progress, the stale-terminal test still passes, while the new failure can consume the earlier turn's snapshot and write an inappropriate inference-failed marker.
    • Raised before as finding 6 of the review of 3a6c8876d83c, fixed then; this is a case the fix leaves.
  • 23. minor at src/framework.ts:36440, src/framework.ts:36447: The quarantine comment promises at most maxRewinds sheds, but fractional values round up and zero becomes one.
    • Failing case: A maintainer reading the comment for maxRewinds: 1.5 would expect at most one whole shed, but the breaker permits two; for zero it still permits one.
    • Raised before as finding 15 of the review of 3a6c8876d83c, fixed then; this is a case the fix leaves.
  • 24. minor at src/framework.ts:30442, src/types/agent.ts:283: The refusal-handler comment says rewind excises the turn that fed the refusal, but it removes the newest eligible body.
    • Failing case: When an older tool result is responsible for a refusal but a newer eligible user message was also carried, the newer message is removed first; the stale comment would lead a maintainer to believe the offending turn itself was identified and excised.
    • Raised before as finding 5 of the review of 3a6c8876d83c, fixed then; this is a case the fix leaves.

…d the witness after failed speech delivery

Co-Authored-By: GPT-6.1-Sol <noreply@openai.com>
@theaspirational

Copy link
Copy Markdown
Contributor Author

Eighth automated-review pass, now at a41d61ee. The blocker was right, and so was our earlier test gap. The carried-body witness was built only from the compile request, so on the second tool round of the same stream it was stale. Our tests had covered only one round. The compile and every later submitted tool round now share one request-body set, and a terminal failure snapshots exactly that set. 2 was right too: a rejected speech delivery could still witness recovery, and it now marks the agent uncertain and withholds recovery. Both regressions fail on the previous head. The description is replaced with one current text. It still states plainly that recovery after a clean stream end widens the published behaviour.

  • 1 Fixed: the compile and later submitted tool rounds now share one request-body set; terminal failure snapshots that exact set before settlement waits. Unverifiable hand-offs cannot witness recovery. Public-start, real-tool regressions in both window modes fail on the previous head and preserve the older input while removing only the newest failed-request exchange. Earlier claims/tests that the just-produced round lay outside the witness were wrong; those controls now assert its removal, not deletion of the older input.
  • 2 Fixed: caught queued-speech rejections preserve post ordering but mark delivery uncertain, withholding exhaustion recovery witnesses for that Agent instance. The public-start held/rejected-delivery regression fails on the previous head; no history removal, step, marker or rewind retry follows the rejection.
  • 3 Fixed: marker consolidation tracks retained/removed/mixed originals. Same-mode reuse keeps its actionable retention statement; mixed-mode reuse explicitly states both outcomes, without sending the agent to inaccessible logs. The earlier blanket-consolidation answer was insufficient; its mixed-mode test also failed to clear the host's pinned legacy state, now explicitly rebased and checked.
  • 4 Fixed: same-mode presented markers now match the retention promise; the changelog also explicitly describes the mixed-mode exception.
  • 5 Fixed: public-start controls independently hold iterator cleanup and queued delivery, then assert the registered driver and token remain live with no quarantine until both succeed; quarantine checks completed delivery, completed iterator and released stream/token.
  • 6 Fixed: the guide and changelog distinguish presented observation transcripts from native legacy observations, whose unresolved IDs can conservatively block reuse by the reader.
  • 7 We keep fail-closed unbounded iterator/delivery waits because a timeout alone cannot establish that potentially writing work stopped; if you prefer cancellable deadlines and a distinct non-recovery shutdown path, say so on review.
  • 8 We keep the existing whole-callback ownership/session gate because safely separating old-turn pins/scripts/drafts from name-keyed runs and recovery effects needs a broader settlement refactor; our earlier successor-only rationale was false for a forced-session-only change, which can still lose same-turn settlement; if you prefer that split, say so on review.
  • 9 Fixed: /unstick now rounds fractional budgets up, consistently with automatic refusal/exhaustion; a configured-1.5 regression expects two steps.
  • 10 Fixed: qualifying pre-stream failures wait on preceding streams' queued speech before releasing their token or accounting exhaustion, recheck attempt ownership, and reject uncertain delivery. Public-start predecessor-delivery controls cover both fulfillment and rejection.
  • 11 We keep the current removal-only reentrancy boundary because deferring agent teardown safely also requires lifecycle/session ownership changes, not merely blocking replacement commands; the earlier Fixed claim was incomplete for stopAgent listeners and can still underreport a committed removal; if you prefer delaying teardown through accounting, say so on review.
  • 12 We keep the current removal-only guard because a full notification/cleanup/marker transaction needs coordinated teardown and session ownership semantics across callers; session-changing listeners outside applyShed remain a known limitation, not fixed; if you prefer extending that transaction boundary, say so on review.
  • 13 Fixed: automatic refusal-plan decline logs now distinguish waiting for known work from inspecting/repairing unsupported history and warn that repeating a wake does not repair it.
  • 14 Fixed: the unclean-iterator control separately captures and asserts the actual compile callback's body set, so missing provenance cannot masquerade as a tested settlement rejection.
  • 15 Fixed: hidden-sibling, hidden-call-shard, legacy-orphan and work-boundary controls assert their specific planner reasons. The terminal control now truthfully names and pins its still-settling guard decline rather than claiming to exercise unsupported endpoint history.
  • 16 We keep the existing 100-ms controls as supplemental coverage because a deterministic replacement needs an explicit guard-decision boundary, not a longer sleep; they do not prove that the restarted decision ran, and no stronger proof is claimed here; if you prefer an explicit decision latch, say so on review.
  • 17 We keep the existing supplemental bounce/heartbeat sleep checks because draining all potential scheduler wake sources requires a dedicated scheduler barrier beyond this recovery fix; the earlier completion-barrier Fixed answer did not eliminate these races; if you prefer that deterministic drain, say so on review.
  • 18 Fixed: the injected-message timeout now rejects instead of fulfilling the tool wait, and always clears its timer and trace listener.
  • 19 Fixed: the agent-ended outcome test waits until the first request is registered as a waiter before stopping the agent, then separately checks the retained answer.
  • 20 Fixed: configuration and refusal-handler documentation now call the marker a model-visible explanatory notice without removed payload, not metadata-only; the earlier description cleanup was incomplete.
  • 21 Fixed: exhaustion checks closed provider admission before quarantine, even after delayed delivery; a public-start stop-during-delivery control asserts no shed, marker, step or rewind retry.
  • 22 Fixed: the stale-terminal control additionally drives a real later no-progress provider failure through start/compile/teardown and verifies it clears the inherited snapshot without a false progress notice; the earlier snapshot-substitution-only regression did not prove that claim.
  • 23 Fixed: the quarantine comment now states minimum one, fractional round-up and ten-step clamping before promising the normalized cap; the earlier documentation-only Fixed claim missed this comment.
  • 24 Fixed: the refusal-handler comment now says newest eligible complete body/exchange, not a proven refusal trigger; the earlier Fixed claim missed this comment.

An independent review ran the full suite at this head: 11,036 pass, 0 fail, 63 skipped. It ran the nine public-start regressions, all passing, and three of its four control cases fail on the previous head as expected. It also checked the four recovery bounds from the description: only a cleanly finished stream counts, the removal stays tied to the same failed attempt, the witness 400 is one the shed policy admits, and the widening is stated. Not tested: real provider streams, and the dependency-floor CI matrix.

@theaspirational

Copy link
Copy Markdown
Contributor Author

/review

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic context view of a41d61eeb4c5 merged onto 9c5d6275f552.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 78 runs it could compare don't differ between the base and this head.

Couldn't tell whether 128 changed source lines ran, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\ (the reason's first 263 of 1,341 characters). 154 changed source lines map to nothing the host runs: 12 of src/agent.ts's, 132 of src/framework.ts's and 10 of src/types/agent.ts's. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

3 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 78 runs are the same in the base and this head: 210,168 tokens sent a request, 72.0% of them read from the cache, 139,145,027 written to it, 3,952,176 output, 24 thinking blocks dropped, USD 0.5656 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (3)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

This head couldn't be compared at H6/continuation: the run didn't measure (on the head, the run failed; on the base, the run failed) (the head's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/head/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/head/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}; the base's run failed: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (/home/runner/work/runs/runs/w/m/work/base/candidate/src/logging-adapter.ts:979:30)\n at async settle (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:26)\n at async streamOnce (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:59)\n at async runXmlToolsYielding (/home/runner/work/runs/runs/w/m/work/base/candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:41)","timestamp":1767701760000,"ts":1767701760000}).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,243 58.5% 860,384 20,328 24 0 1.28, confirmed after a reset
H1b/continuation/fresh 15 157,111 58.0% 845,942 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,082 60.1% 790,209 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,097 60.1% 790,239 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

Couldn't tell for any line or deletion not seen to run, since H6/continuation: its profiled drive failed at step c.debt: the turn's first inference failure (inference:failed, which agent-framework may still have retried): {"type":"inference:failed","agentName":"fixture","error":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}","stack":"MembraneError: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 200634 tokens > 200000 maximum\"}}\n at errorFromProviderStatus (candidate/node_modules/@animalabs/membrane/src/types/errors.ts:663:14)\n at typeError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1074:26)\n at handleError (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:1036:24)\n at stream (candidate/node_modules/@animalabs/membrane/src/providers/anthropic.ts:892:18)\n at async stream (candidate/src/logging-adapter.ts:979:18)\n at async settle (candidate/node_modules/@animalabs/membrane/src/membrane.ts:1688:20)\n at async streamOnce (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2051:40)\n at async runXmlToolsYielding (candidate/node_modules/@animalabs/membrane/src/membrane.ts:2925:30)","timestamp":1767701760000,"ts":1767701760000}, so what it would have run after that can't be told.

src/agent.ts: lines 40–46, 68–71 and 2533 map to nothing the host runs; couldn't tell whether line 247 ran.

src/framework.ts: lines 3247–3248, 3374–3379, 3976–3980, 4533–4534, 4643, 4661–4663, 15050–15055, 15072–15074, 15083–15084, 15088–15092, 15102, 15111, 15129–15132, 15173–15174, 15221, 15226–15229, 15235, 15257–15261, 15289, 15300–15302, 15311–15315, 15324, 15735–15738, 20166–20167, 20177, 24826, 28374–28375, 28771–28772, 28918–28920, 29475–29479, 30484–30486, 30523–30524, 30540–30541, 30546, 30594–30595, 31054, 31059–31062, 31460, 31467, 31525, 31533, 31650–31651, 31653–31655, 31661, 31664, 31666, 35880–35881, 35883–35887, 36456–36457, 36468, 36471, 36486–36490, 36494–36497 and 36521 map to nothing the host runs; couldn't tell whether lines 15065, 15087, 15114, 15146, 15149, 15195, 15213, 15232, 15241, 15253–15255, 15270, 15272–15279, 15283–15286, 15288, 15292–15293, 15303–15307, 15335–15336, 15343, 15386, 15747–15755, 15759, 20174–20176, 29015–29021, 29056, 29262–29263, 30511–30512, 30517–30520, 30530–30531, 30539, 30543, 30545, 30551–30553, 30592, 30596, 31443–31459, 31461–31462, 31464–31465, 31534, 31662–31663, 36452, 36454, 36458, 36460, 36464, 36466, 36473–36477, 36480–36481, 36506–36507, 36512, 36518–36519, 36525–36527, 36533–36534, 36538–36539 and 36546–36547 ran.

src/types/agent.ts: lines 283–290, 318 and 320 map to nothing the host runs.

Held the same in base and head: connectome-host 4f6d7348956a, chronicle 0.6.0, context-manager 0.27.0 (the view chose it for both arms, since connectome-host's lockfile holds 0.25.3, which doesn't meet ^0.27.0 from the base), membrane 0.8.1.

@anima-review

anima-review Bot commented Nov 18, 2026

Copy link
Copy Markdown

Automatic review of a41d61eeb4c5.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. blocker at src/framework.ts:29012, src/framework.ts:28917, src/framework.ts:8921, src/framework.ts:29050, src/framework.ts:29017: A stop accepted during the new pre-stream speech-chain wait is never collected before exhaustion quarantine runs.
    • Failing case: After membrane creation throws a qualifying error, hold an earlier speech delivery, call abortInference while the start's check window is still registered, and then release the delivery: abortInference returns true, but the terminal branch does not call takeStartStop again and can remove history and queue a retry instead of ending the stopped turn.
  • 2. blocker at src/framework.ts:15086, src/framework.ts:15211: In legacy or raw-foreign-rounds mode, observed foreign tool rounds are treated as owned by the reader.
    • Failing case: Mira observes Oren and her window is in legacy mode after a failed presentation write-down; Oren’s complete call and result are the newest visible carried exchange. bearingOf classifies both as arrivals, intended accepts them because the window is legacy, and recovery deletes both raw rows and retracts them from Oren’s window, rather than declining the foreign round as documented.
  • 3. should fix at src/framework.ts:29255, src/framework.ts:27233, src/mcpl/channel-registry.ts:6594, test/shed-window.test.ts:1827, test/shed-window.test.ts:1892: The uncertain-delivery guard sees only rejections that escape the speech link, but real hybrid delivery catches or converts failures; the test fakes that path.
    • Failing case: A connector's hybrid-locus publish has an unknown outcome, or routeSpeech throws after an external effect, and the subsequent provider request exhausts: real delivery resolves after logging or converting the failure, so uncertainSpeechDelivery is not set and quarantine and retry can proceed, whereas the test's substituted deliverHybridProse rejects directly into chainSpeech and declines recovery.
    • Raised before as finding 2 of the review of 59f8aca33a05, fixed then; this is a case the fix leaves.
  • 4. should fix at src/framework.ts:20168, test/shed-window.test.ts:1819, test/shed-window.test.ts:1837, test/shed-window.test.ts:1857: The registered-stream regressions cover only verifiable hand-offs and do not pin the uncertainStreamHistory guard.
    • Failing case: If the uncertainStreamHistory update for a missing reply witness or an unvouched presentation hand-off is removed, the positive later-round fixture remains vouched and passes, while a qualifying failure after an unverifiable hand-off can authorize quarantine using an unsupported witness.
  • 5. should fix at src/framework.ts:31015, src/agent.ts:2464, src/framework.ts:28893, src/framework.ts:29012, src/framework.ts:31533, src/framework.ts:31618: A successor that fails during stream creation leaves its predecessor's activeStreams entry registered forever.
    • Failing case: During an error-policy retry, let the predecessor remain in driveStream while the successor's streamYielding throws: the successor reports exhaustion without clearing the predecessor entry, and the predecessor's finally sees a different streamId and also leaves it, so subsequent quarantine is blocked by a stale active stream.
  • 6. should fix at src/framework.ts:15272, src/framework.ts:30545, src/framework.ts:36540, src/framework.ts:15386: Recovery catch blocks discard the underlying exception, while the channel sends operators to the host log.
    • Failing case: If refused-reply cleanup or marker storage throws because the store is unavailable, the channel directs the operator to the log, but the log only says that cleanup/marker outcome is uncertain; it does not identify the failed step or the storage error, so the operator cannot tell what failed or how to repair it.
  • 7. should fix at src/framework.ts:31455, src/framework.ts:31520, src/framework.ts:31653: An iterator throw classed as shed-helpful still waits on speech delivery before reporting, though it can never qualify for quarantine.
    • Failing case: If a stream iterator throws a non-retryable invalid_request 400 while an earlier speech post is hung, streamFinished is false and quarantine must be declined, but settleAgent and inference:exhausted now wait indefinitely for the speech chain; previously the turn and failure were reported immediately, and an ephemeral caller could observe the failure without waiting for delivery.
  • 8. minor at src/framework.ts:31650, src/framework.ts:31037, src/framework.ts:14033, src/framework.ts:24807, src/framework.ts:36270, src/framework.ts:36445: The forced-session check runs before synchronous settlement callbacks, and noteInferenceExhausted captures the current session rather than the failed attempt's.
    • Failing case: When settlement writes a speech-not-posted notice, a synchronous presentation listener opens a new /unstick session after the old stream has released its token; the old failure then captures that new session, passes the session comparison, and can charge its removal to and answer the new session.
  • 9. minor at src/framework.ts:36311, src/framework.ts:36423, src/framework.ts:36144, src/framework.ts:36449, src/framework.ts:36516, src/framework.ts:15268, src/agent.ts:2464: The Agent and stream generation are not revalidated after the synchronous hard-down alert listener and before history removal.
    • Failing case: An ops:alert listener starts a new direct Agent stream while its state is idle: startStreamWithInjections increments streamId before its compile awaits, but has not yet installed a stream or framework turn token; the old failure's active-stream and planner checks can still pass and remove its selected history under the successor compile.
  • 10. minor at src/framework.ts:15332, src/framework.ts:15189, src/framework.ts:15233, src/framework.ts:15181: The marker text claims the omitted content was the most recent turn(s) and was carried by the failed request, though selection can skip newer content.
    • Failing case: A message arrives while a refused request is streaming: recovery leaves that newer message in context but removes an older carried turn, then the marker calls the removed turn the most recent. Likewise, refusal recovery can remove a resident result that the refused request never carried, contradicting the marker's explanation.
  • 11. minor at docs/recovery-b.md:9, changelog.d/737-notice-gap-rewind.fixed.md:7, src/framework.ts:15245, src/framework.ts:15244: The docs and changelog say descriptors count UTF-8 JSON bytes, but ordinary-body descriptors report JavaScript text length.
    • Failing case: When recovery removes an ordinary message containing multibyte text or an image, its descriptor reports text chars and an image count, not the JSON byte size; an operator using that descriptor to assess how much content was removed gets the wrong measure.
  • 12. minor at src/framework.ts:15272, src/framework.ts:30545, src/framework.ts:36540: A stopped recovery keeps no unresolved-operation fence or phase state, so later wakes start a fresh shed.
    • Failing case: A retract commits and then throws, or the shed succeeds but writing the marker throws; the code stops this attempt but clears recoveryApplying, and refusal give-up also clears its rewind budget. On a subsequent wake that refuses or exhausts again, planning can remove the next eligible body instead of finishing or reconciling the first removal, potentially leaving the agent with no marker for the first missing content and consuming additional history.
    • Raised before as finding 9 of the review of 5556756b435a and answered by its author as a choice: «We keep attempt-local stopping without a durable wake fence because a persisted fence and operator-reset lifecycle are beyond this Safe B change. Our earlier no-replay wording was too broad: independent later wakes can plan and mutate after unknown/partial outcomes. The docs now state this explicitly and require stopping writers for inspection. If you prefer a durable fence/reset protocol here, say so on review.» Only a maintainer's choice folds a finding.
  • 13. minor at src/framework.ts:31059, src/framework.ts:31457, changelog.d/1026-draft-settlement.fixed.md:7: The changelog describes the earlier gate release only for policy events, omitting that it now also precedes settlement and the exhaustion trace.
    • Failing case: On a non-qualifying error event or iterator throw, a host listening for inference:exhausted previously observed the inference gate still held, whereas it is now released before settleAgent and the trace; the fragment mentions only release before failure-policy events and does not tell hosts about this observable ordering change.
  • 14. minor at changelog.d/1026-exhaustion-compile-witness.fixed.md:4, changelog.d/1026-bounded-recovery.changed.md:4, src/framework.ts:15184, docs/recovery-b.md:147: The changelog says refusal compatibility is unchanged, though refusal recovery for malformed adjacent exchanges was retired.
    • Failing case: A host relying on refusal auto-rewind for an adjacent call/result pair with mismatched IDs would expect its previous behavior from this fragment; the planner now declines the pair instead, as the bounded-recovery fragment and compatibility disposition state.
  • 15. minor at src/framework.ts:29256, src/framework.ts:29015, src/framework.ts:31525, src/framework.ts:36454: A caught speech-delivery rejection permanently disables quarantine for the Agent, but no log names that persistent state.
    • Failing case: A queued post for a long-lived agent rejects, then a later qualifying provider failure reaches the hard-down threshold: the first log reports only the delivery error, and the later log says only that compile history is unavailable or stream/delivery settlement is uncertain, leaving the operator unaware that all further automatic exhaustion quarantine for this instance is disabled.
  • 16. minor at docs/recovery-b.md:70, src/framework.ts:12942, src/framework.ts:6155: The 'stopped and recreated' remedy misleads operators of the default-delivery agent, which stopAgent cannot stop and start() does not recreate.
    • Failing case: After a primary agent's speech delivery rejects, an operator following the agent-stop remedy receives an exception, and cancelActivation or start() leaves the same marked Agent in place; restoring automatic quarantine requires stopping the framework and creating a new framework on the store after inspection.
  • 17. minor at src/framework.ts:31650, src/framework.ts:31036, src/framework.ts:14042, src/framework.ts:36465: The terminal ownership recheck drops the whole deferred exhaustion callback, not just quarantine.
    • Failing case: If a qualifying 400 finishes while queued speech is held and an ephemeral run's idle watchdog deregisters the agent before delivery settles, the run rejects as stalled and disposal ends its scripts, but the subsequent ownership check skips settleAgent and inference:exhausted: the turn-input pin is not released and the exhaustion failure is not reported through the normal failure pipeline. A closing fork disposed in the same window likewise loses that settlement; an outstanding forced-session waiter is not answered by the skipped callback, although disposal paths that call forgetFailureAccounting answer it separately.
    • Raised before as finding 8 of the review of 59f8aca33a05 and answered by its author as a choice: «We keep the existing whole-callback ownership/session gate because safely separating old-turn pins/scripts/drafts from name-keyed runs and recovery effects needs a broader settlement refactor; our earlier successor-only rationale was false for a forced-session-only change, which can still lose same-turn settlement; if you prefer that split, say so on review.» Only a maintainer's choice folds a finding.
  • 18. minor at src/types/agent.ts:285, src/framework.ts:15345: The config docs say the notice is injected 'in its place', but the marker is appended at the presented tail.
    • Failing case: If a clock notice or later uncarried message follows the selected body, that content remains before the newly appended marker, so a host relying on the documented ordering will not find the notice at the gap.
  • 19. minor at test/refusal-rewind.test.ts:119, docs/recovery-b.md:95: The test title 'six rewinds produce ONE marker' states a convergence guarantee that intervening notices break.
    • Failing case: After a successful rewind, a separate notice is appended before the next rewind; the next marker is added rather than updating the old one, so six rewinds can produce multiple markers, while this test calls the marker helper repeatedly without inserting a notice.
    • Raised before as finding 6 of the review of 5556756b435a, fixed then; this is a case the fix leaves.

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.

A refusal rewind leaves a tool call behind when a system row sits between the call and its result

1 participant