Repository navigation
fix!: preserve results when source publication fails - #8444
Conversation
BREAKING CHANGE: Strict clients that cached the previous full inspect_address_context output schema must refresh tools/list and accept the typed error field on unavailable facets.
BREAKING CHANGE: Clients validating unavailable context facets against a cached strict full output schema must refresh tools/list to accept resource_constraint errors.
[Medium impact] The reviewed change appears safe to merge; the Frida assertion matches the recovery response and preserves its existing checks. SummaryPreserves completed observations when recording source Evidence fails.
The earlier findings appear addressed in the current code. This review used source inspection; no tests were run. Checking whether another PR supersedes this one was blocked by missing GitHub authentication. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Analysis completes] --> B[Record source Evidence]
B -->|Succeeds| C[Publish result normally]
B -->|Fails| D[Keep source error]
D --> E{Enough memory for recovery?}
E -->|No| F[Report completed result omitted]
E -->|Yes| G[Authenticate completed result]
G --> H[Return retained reference or inline result]
H --> I[Keep cleanup and cancellation facts]
F --> I
Reviews (26) · Last reviewed commit: "test(frida): assert inline evidence reco..." · Reviewed by Greptile |
|
A real-Kuna, injected-zero-capacity integration control found an interaction with #8444: after the combined branches complete This is a source-publication ownership and resource-boundary follow-up; it does not invalidate the normal-capacity source-closure fix. A fix needs to keep the failed source and completed workflow distinct and report actual retention/closure, while honoring headroom and transport bounds. |
* fix: preserve completed evidence on retention refusal * fix: preserve context when unretained evidence exceeds delivery limits * fix(mcp): recover oversized context from session evidence * fix(evidence): preserve completed atomic write results
285b5a5 to
f7c1679
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
# Conflicts: # src/application/WorkflowAnalysisProfile.ts
morluto#8444 passes formatHint to BinarySession.open; on this branch the raw load refactor carries the format in loadSelection.
Main's morluto#8444 tests pass formatHint to BinarySession.open. This branch's raw load refactor carries the format in loadSelection, so those calls now pass loadSelection: { format: "dos-com" }.
…ation Since #8444 the completed observation is projected once at the composed error's details.partial_observation rather than inside primary_error, so restore #7319's retained-Evidence assertion there. Refs #7279 Co-Authored-By: gensokyo-dev <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ation Since #8444 the completed observation is projected once at the composed error's details.partial_observation rather than inside primary_error, so restore #7319's retained-Evidence assertion there. Refs #7279 Co-Authored-By: gensokyo-dev <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
warcLateCompletionMcp asserted that a cancelled inspect_warc_archive retains its completed Evidence through toPartialErrorToolResult. Main no longer has that behavior: 88cf498 (morluto#8444) removed the retention branch and origin/main has no warc cancellation test at all, while featureTraceViewsMcp keeps the opposite expectation for the same staging step. Keeping both made Portable tests hang until the 240s timeout. The sibling test in featureTraceViewsMcp still covers cancellation delivery.
Problem and outcome
A provider or composed workflow can finish a result and then lose it when Evidence publication fails. Preserve the publication error and, when delivery permits, the completed observation with an explicit retention state. State when source closure is not established and when a completed result cannot safely be constructed or delivered. Unretained Evidence is not included in session exports. Addresses #8425.
Direct session, MCP and one-shot analysis now check authentication headroom before constructing completed Evidence. The session can reuse its own immutable retained record for the exact unchanged observation and request only when its path and caller metadata also match; transformed observations, mismatched parameters, missing ownership or separately supplied source records use the regular construction path. Source-ID accounting avoids constructing the full link array before admission. Cleanup and cancellation remain visible, and cleanup ownership is retained until release succeeds.
This changes error payloads and recovery guidance. It adds no target execution, mutation or provider capability.
Validation
check:fast,docs:checkandgit diff --checkpassed. Public MCP controls cover copied results, transformed parameters, forged provider IDs and linked source records. The copied-result and parameter controls fail against an ID-only reuse shortcut. One-shot controls cover cancellation during final close, an injected cleanup failure and cleanup retry._mainobservation as unretained Evidence; a larger allowance returned and retained it. The unexecuted target was unchanged. A separate real Ghidra target-switch control used byte-identical files at two paths; both profiles returned the selected path with the same semantic ID, and both files were unchanged.Earlier heads also passed broader publication, error projection and cleanup checks, plus
docs:check; see #8425 for the detailed controls. Limits above were injected, not public configuration. Actual OOM, real-provider cleanup failure, other hosts, and every provider-created source remain unverified.Review follow-up: completed Evidence and admission
A previously retained record can share an Evidence ID with a completed observation from a different caller path because display metadata is excluded from that ID. Recovery now looks up the immutable retained record and compares its display metadata at the Evidence owner; it returns the retained ID only when those facts agree, otherwise preserving the current authenticated Evidence inline as unretained. This applies to provider, composed-workflow and other source-publication consumers. Source closure remains unestablished on the failure.
Admission no longer copies the variable-size locations, limitations or links arrays before checking headroom. It borrows them for the size check, accounts separately for the generated subjectless limitation, and constructs the independent normalized snapshot after admission. This prevents the rejected observation from creating an additional input-sized array before the check; it does not establish an RSS reduction for real providers.
On Node 24.22.1, seven source/one-shot/MCP test files passed 127 tests. The new real MCP recovery case fails on the previous head by returning the stale path, and passes after the change. An admission collection-identity regression also fails on the previous head; a subjectless admission control checks conservative accounting.
check:fast,format:check, andgit diff --checkpassed.A small repeated in-memory MCP test task (nine existing cases, fresh processes; OS cache uncontrolled) took 5.09/4.85 s and 6.31/6.44 s user+system CPU on the prior head, versus 4.13/3.92 s and 5.46/5.22 s on this change.
/usr/bin/time -lreported maximum individual-process RSS 942,686,208/953,171,968 bytes before and 931,446,784/955,940,864 bytes after; it does not establish process-family peak memory. Samples ran candidate before baseline and are not a general performance comparison. Model token usage, real-provider workload costs, actual OOM, and process-family peak memory were not measured.After merging the updated #8424 base at
65a2d037, the same seven focused source, one-shot, and MCP suites passed 127 tests on Node 24.22.1, andcheck:fastpassed uncached. Full CI and real-provider verification on this integrated head remain pending.Review follow-up: the source-publication secondary failure now has a structured assertion for its error code, provider, and operation rather than a frozen explanatory sentence. The
xrefsregistration selects its named official contract family rather than loading the entire catalog. Both MCP boundary suites passed 16 tests after merging the updated #8424 base967c695e; Node 24check:fast,format:check, andgit diff --checkpassed. Full CI and real-provider qualification on this head remain pending.After #8424 landed on main, merged main
106ba1730fand reconciled the recovery changes with the updated session retention condition and ledger-failure partial observation. On the integrated head, ten focused Evidence, MCP, one-shot and cleanup test files passed 147 tests on Node 24.22.1; uncachedcheck:fast,format:check, andgit diff --checkpassed. CI and real-provider qualification on this integrated head remain pending.The feature-trace replay profile retains main's workflow revision 8 after profile extraction (e663fc5). The cache regression failed before the fix; 44 cache tests, 37 snapshot replay boundary tests and
check:fastpassed on macOS with Node 24.22.1. Two Windows-only replay tests were skipped; this follow-up did not exercise a real provider.Merged main
a67525cdf1and reconciled the shared workflow profile with the current trace-call-path revision. On the integrated head, ten focused Evidence and MCP suites passed 147 tests, and snapshot replay passed 37 tests (2 skipped). Node 24check:fast,format:check, andgit diff --checkpassed. CI and real-provider checks for this head remain pending.Merged main
015a02d57b, preserving partial source closure on failures and the updated trace-feature coverage limitation in both constructed Evidence and admission accounting. Seven focused workflow, source recovery, snapshot replay and MCP suites passed 117 tests (2 skipped). Node 24 uncachedcheck:fast,format:check, andgit diff --checkpassed. CI and real-provider verification on this integrated head remain pending.Author readiness
Human owner: