Repository navigation
fix(mcp): report references a provider truncated in trace_feature - #2348
Merged
morluto merged 15 commits intoOct 13, 2026
Merged
Conversation
…ncated A provider that reports a capped xrefs read makes the trace truncated with a residual unknown for that target. An explicit complete report and a provider that reports nothing leave the trace as before.
Executions gain an optional flag for a capped xrefs read, set by the IDA adapter from the upstream cap. trace_feature marks the trace truncated with a residual unknown for that target only when the provider reports a truncation; a provider that reports nothing keeps its previous result. The trace_feature workflow profile is revised so earlier results are not replayed.
… and failures of the trace coverage
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Merged
10 tasks done
Owner
|
@greptileai review |
Contributor
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
Contributor
|
…xref-coverage # Conflicts: # src/application/AnalysisProvider.ts
…xref-coverage # Conflicts: # src/ida/IdaWorkspaceThinning.test.ts
…-feature-xref-coverage # Conflicts: # src/application/InvestigationProviders.ts
Node timers can fire while performance.now() is still a fraction of a millisecond short of the monotonic deadline. ProviderStartupDeadline then reported interruption "timeout" and an aborted signal while remainingMs() returned ceil(0.x) = 1, so polling loops guarded by remainingMs() > 0 (Hopper and Ghidra startup) could run past an elapsed deadline, and the real-timer test "aborts a bounded wait when its real monotonic deadline expires" failed intermittently in CI (expected 1 to be 0). Once the deadline's own timer has classified a timeout, report zero remaining time. A deterministic regression test fires the timer with the monotonic clock 0.4 ms short of the deadline. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit dfdaa0c)
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
trace_featurealways reportedtruncated: falsewith no residual unknowns, even when a provider capped the references it returned for a match. A provider can now report that anxrefsread was truncated, and the trace marks that target as a residual unknown. A provider that reports nothing produces the same trace as before.Prerequisite for #2335 (headless IDA containing procedures); this change alone does not close it.
Problem and expected behavior
The IDA adapter reads references with upstream
xrefs_to(limit 1000) and recordsmore: trueonly as a diagnostic limitation string.EnhancedTools.#callkeeps just the result, andtraceLiteralFeaturereturnstruncated: false, residual_unknowns: []unconditionally, so a trace over a capped read looks complete.Expected: when the provider explicitly reports that the references to a matched address were truncated, the trace keeps the references it received, sets
truncated: true, and adds a residual unknown naming that address. An explicit "not capped" report and a provider that reports nothing leave the trace unchanged. No completeness is inferred from limitation text.Change and scope
src/application/AnalysisProvider.ts:AnalysisExecutionandcreateAnalysisExecutiongain an optionalreferencesTruncated(true: the provider capped thexrefsread; false: it explicitly reported no cap; absent: it reports nothing). It is internal: it is not part of Evidence, tool output or the snapshot format.src/ida/IdaOperationRunner.ts,src/ida/IdaSessionClient.ts: the IDA adapter sets it from the upstreammoreflag ofxrefs_to; the existing limitation text is unchanged.src/application/EnhancedLiteralTracing.ts,src/application/EnhancedTools.ts:trace_featurereadsxrefsthrough#observeand, only whenreferencesTruncatedis true, setstruncated: trueand adds "References to were truncated by the provider; additional references may exist." once per address.src/application/InvestigationProviders.ts: thetrace_featureworkflow profile revision is bumped, so earlier results are not replayed under the new semantics (same pattern as the graph and batch workflows).src/application/binary/AnalysisSnapshotCache.ts:recorddoes not store an execution whosereferencesTruncatedis true, because the snapshot format cannot carry the field and a replay would present a capped read as complete. Only IDA sets the field today and its operations are never cached.Intentionally not included:
evidence_linksfor the primitive reads behind a composed workflow.trace_featureusable there (separate change).truncatedandresidual_unknownsalready exist in the output.Contract and boundary impact
src/application, set by the IDA adapter; consumed by thetrace_featureworkflow.more; legacyget_xrefs_toreports no flag and stays silent.Evidence and regression coverage
tests/boundary/mcp/enhancedTools.traceFeatureCoverage.test.ts(production MCP server over an in-memory transport, exacttoEqualon the whole trace): a capped target is a residual unknown while an uncapped sibling is not and all references are kept; a truncation is not carried over to the next target that reports nothing; a target matched twice is reported once; an explicit "not capped" report leaves the trace complete; a provider that reports nothing, even with limitation text mentioning a cap, returns exactly the trace it returned before; neither spelling of the field appears in the output; a failed references read stops the trace without reading further targets; a cancelled trace reads no references.tests/composition/analysis-sessions/binarySession.test.ts: the session forwards the field on both execution paths and a truncated read is never replayed, while an explicit complete report is.src/ida/IdaReferenceCoverage.test.ts(real headless session client over the recording fake):more: truegivestrueand keeps the limitation,more: falsegivesfalse, no flag gives nothing, the legacy profile and other operations report nothing;src/ida/IdaNativeProtocol.test.tsasserts the native profile forwards the explicit flag.src/application/binary/AnalysisSnapshotCache.test.ts: a truncated execution is not replayed while a complete or silent one is, and thetrace_featureprofile is revised while other workflows keep theirs.a97b713f7(RED commitd8b802b3a: 5 failed in the three files; the unchanged-trace test passes there by design).build_call_path, error cases, universal and stripped binaries) gives results identical toa97b713f7, andnpm run verify:idapasses.trace_featureuntil containing procedures are supported for headless IDA.Validation performed
npm run check:fast,npm run check,npm run docs:check,npm run verify:test-discovery(966 files) - greennpm run test:focusedover the five affected test files - 87 passednpm run test:fast- 408 files, 5310 passed, 7 skipped, 0 failed;npm run test:mcp- 103 files passed, 2 skipped, 447 passed, 3 skipped;npm run test:boundary -- tests/boundary/providers/idaafternpm run build:cached- 14 passedmacOS arm64 only; Linux and Windows were not executed.
Compatibility, safety, and release
trace_featureresult for a provider that reports a truncated read now hastruncated: trueand a residual unknown.Review checklist
type(scope): outcome.