Repository navigation
fix!: preserve address context resource recovery - #8424
Merged
Merged
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.
This was referenced Nov 1, 2026
Contributor
[Medium impact] The reviewed changes appear safe to merge, with no outstanding findings. SummaryPreserves
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Inspect address facets] --> B{Record fits retention allowance?}
B -->|Yes| C[Keep successful facet and retained record]
B -->|No| D[Keep resource error and unretained record]
C --> E{Context reply fits delivery limit?}
D --> E
E -->|Yes| F[Return context]
E -->|No| G[Omit unretained records in estimated size order]
G --> H{Smaller reply fits?}
H -->|Yes| F
H -->|No| I[Return delivery error and recovery guidance]
Reviews (6) · Last reviewed commit: "style(test): format CLI help default ann..." · Reviewed by Greptile |
11 tasks
morluto
marked this pull request as ready for review
November 1, 2026 03:55
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. |
* 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
Facet refusals still carry resource_constraint recovery and unretained Evidence, while caller lifetime, capability guidance, and evidence-bundle overflow steps from main stay in the same projection.
3 tasks
3 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an
inspect_address_contextfacet reaches the investigation's Evidence retention limit, it currently advises calling the operation directly. That call can hit the same limit, while the actionable capacity recovery and reported limits are lost. Preserve the canonicalresource_constrainterror and its recovery on the unavailable facet, alongside any successful siblings and their retained records.Addresses #8421. The earlier parent changes #8417 and #8419 are merged. This branch also incorporates the authenticated-but-unretained observation work from #8426; #8444 remains a separate follow-up stacked on this branch. Aggregate Evidence handoff remains #8364.
For example, a procedure facet now returns
error.code: "resource_constraint", the reported retention limits, and the existing export/new-investigation or larger-heap guidance. Other errors retain their current behavior, and incomplete cleanup remains a top-level failure.Compatibility and size
Breaking for strict clients caching the earlier full MCP schema: it only accepts
invalid_requestin a facet'serror; refreshtools/listto acceptresource_constraint. The real result was rejected by the prior full schema, accepted by the prior compact schema, and accepted by both newly advertised profiles. No compatibility shim is introduced.On one real Ghidra case, minified structured context increased from 206 to 334
o200k_basetokens. Theinspect_address_contexttool definition increased from 227 to 231 tokens in compact mode and 954 to 1,172 in full mode. These are local JSON counts, not latency, CPU, memory, or autonomous-agent measurements. Large diagnostic and response-budget behavior remains unverified.Validation
Hosted static checks failed on the unrelated main formatting defect fixed by style(test): format CLI help default annotations #9280. The branch now includes that fix, and Node 24
npm run format:checkpassed; new hosted checks are pending.After merging main
0ecf3a4cbf, Node 24.22.1 focused Vitest runs passed 61 tests: four capacity, overflow and retention suites (15), plus direct cleanup and Ghidra Evidence MCP suites (46). The earlier CI shard failure was the stale Ghidra Evidence wording assertion fixed on main. No full CI or real-provider run was performed after this merge.The following observations and checks were performed on earlier revisions, not the merged head:
Review follow-up (
c99ab7ee21): one-shot failures now bind the exact caller-selected path to authenticated Evidence inside an unretained-evidence wrapper. A production-session capacity regression failed on the prior head and passed after the fix.directAnalysisCleanup.test.tsandevidenceRetentionRecovery.test.tspassed (39 tests);npm run typecheckand targeted lint passed (lint reported one existing warning). No real-provider capacity run was performed for this follow-up.Real Ghidra 12.1.4 on macOS arm64, JDK 21: the real MCP server and SDK used an in-memory transport and production
BinarySessionwith an injected 20,000-byte Evidence allowance. A name facet and its record survived; the procedure facet returned the same typed capacity error and recovery as the direct call. Both advertised schema profiles passed, with an unexecuted arm64 Mach-O whose digest was unchanged. A default-allowance control returned available name and procedure facets. This does not reproduce exhaustion of the default production allowance.Real Kuna 1.986 zero-allowance control: context returned the name with no retained Evidence; a subsequent direct name call returned
resource_constraint. This does not exercise the new facet error path and illustrates the separate live-provider handoff gap in [Design] Preserve contributing evidence for address-context handoffs #8364.Production-session MCP regression with a controlled provider and limited real Evidence ledger: 2 tests passed under full and compact profiles; both failed on the parent because they returned generic direct-call advice. Successful sibling and retained record are asserted.
npm run test:focused -- tests/boundary/mcp/addressContextCapacity.test.ts tests/boundary/mcp/addressContextInputErrors.test.ts tests/boundary/mcp/addressContextBookmarks.test.ts— 17 passed after rebasing.npm run check:fast— passed after rebasing.npm run docs:check, formatting andgit diff --check— passed; the rebase only added a parent test-only change.Ajv 2020 checked actual fetched old and new schema profiles against the real-Ghidra result and rejected a deliberately wrong error code in the new full profile; compact remains intentionally broad.
The new resource-error facet path was not exercised with Kuna. Windows, real cleanup failure, autonomous agents, and unusually large diagnostics were not exercised. No provider replay policy is changed.
Author readiness
Human owner:
Before merge
type(scope): outcome.