Skip to content

fix!: qualify call paths by provider discovery - #8443

Merged
morluto merged 12 commits into
mainfrom
codex/call-discovery-scope
Nov 7, 2026
Merged

morluto merged 12 commits into
mainfrom
codex/call-discovery-scope

Conversation

@morluto

@morluto morluto commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Separate retrieval of the provider's observed call edges from discovery of applicable code. Related to #8362.

Problem and expected behavior

Kuna can label a reachable code address as data and return no outgoing edge. Its graph read can be complete even though call discovery is not. Previously trace_call_path and build_call_path could report that the goal was absent; a found path could also be described as shortest without saying which graph was searched.

Change and scope

Kuna preserves the data-node classification as directional discovery information. Call-path workflows retain observed paths and report the graph-scoped outcome alongside discovery coverage. A negative result is unknown when discovery is unestablished. Function comparison reports differences between observed sets with discovery limitations; reconstruction verification treats a call or unchanged overall claim as unknown when static caller or callee discovery is incomplete or unreported, while preserving independently established non-call changes. Revised provider and workflow profiles distinguish the changed semantics. Existing historical Evidence remains unchanged.

Contract and boundary impact

  • Semantic owner: providers report discovery facts; shared workflows interpret them; CLI/MCP expose the resulting scope.
  • Contribution scope: ordinary read-only analysis fix; no additional target execution or mutation authority.
  • CLI/MCP: both path results gain search_scope details; negative statuses change where discovery was unestablished. Call comparison carries discovery limitations and reconstruction verification propagates them from source Evidence.
  • Provider compatibility: Kuna identifies data nodes; other providers without discovery facts report unknown discovery. No claim is made that a provider found all runtime calls.
  • Evidence: discovery is part of relationship coverage and Evidence identity; workflow profiles change. Snapshot matching continues to require the applicable profile.
  • Target and cleanup: existing provider workflows and target selection; no new target side effects.
  • Generated catalog: regenerated locally for validation; ignored outputs are not committed.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Ghidra's existing headless analysis scripts and Kuna were launched; the fixtures themselves were not executed.

Evidence and regression coverage

The previous release produced not_reached in both directions for a real Mach-O where Kuna classified the intermediate address as data; direct instruction inspection and Ghidra observed the missing static edge. A paired no-call fixture produced the same Kuna graph, so the graph cannot distinguish those cases alone. The new real Kuna MCP control reports goal_status: "unknown" and search_scope.observed_goal_status: "not_reached" in both directions; the direct observed path remains reached.

A second unchanged fixture produced a three-hop Kuna path and a two-hop Ghidra path. Both remain visible with discovery qualification. Boundary tests cover both directions, dossier reconstruction, full/compact MCP schema profiles, retained views and independent graph traversal. Reconstructed paths carry each expanded function’s explicit discovery reason inline; the data-node dossier regression uses controlled Evidence because Kuna refuses to analyze that data-classified node as a function. Real snapshot round-trip and import of old Evidence preserved the records and changed the active profile. A controlled public MCP comparison probe additionally exercised partial, absent, and explicitly complete discovery in full and compact profiles: observed call-set comparison remained unchanged, while verification returned unknown, unknown, and pass respectively. These synthetic comparison controls are distinct from the real-provider check: replaying retained Ghidra dossiers from the two controlled fixtures through target-free MCP showed an unchanged observed call-set comparison in both revisions; verification changed from pass at the parent commit to unknown with unreported discovery in the current revision, in both schema profiles. The analogous Kuna comparison and verification were unknown in both revisions. Both fixture hashes were unchanged. These observations do not establish runtime reachability or exhaustive provider discovery.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

A same-session real Kuna compact MCP control at main 60c0cf977 and this PR head followed the reported incoming call address through address_name, xrefs, procedure lookup and path tracing. The path changed from an unqualified negative to an observed-graph negative with partial discovery while retaining the incoming edge. The valid-address procedure lookups still categorically label the unflagged section as data and suggest schema inspection; that separate classification and recovery issue remains open in #8352. Successful replies used the advertised schemas; error payloads were inspected, not separately schema-validated in this control. The unexecuted fixture hash was unchanged.

Kuna 1.988 release control

At exact head b7160bd7, real full-schema stdio MCP with Kuna 1.986 and 1.988 on the original two-hop and paired NOP fixtures returned goal_status: unknown and the observed-graph not_reached scope; the direct positive remained reached. In 1.986 the data-node discovery was partial; in 1.988 the omitted node left discovery unknown. The unrelated negative also became unknown. Target digests were unchanged, and targets were not executed. These are one-host controlled cases, not broad accuracy or agent-behavior measurements.

A separate 1.988 snapshot saved on main was refused with profile_mismatch on this head. Extracting its Evidence bundle into a file and importing it in a target-free session preserved the old negative record exactly; a fresh analysis returned unknown with a different profile. This was a manual JSON extraction, not a dedicated snapshot migration workflow. Snapshot and target bytes were unchanged.

Ghidra path scope control

Real Ghidra 12.1.4, JDK 21, macOS arm64, full and compact advertised stdio MCP schemas: on base 53363166f, the original two-hop fixture returned reached and the paired NOP fixture returned not_reached. At exact PR head b7160bd7, the first stayed reached; the paired fixture became unknown while search_scope.observed_goal_status retained not_reached. A direct positive remained reached and an unrelated negative likewise became unknown. Both target hashes were unchanged and neither executable ran. This shows the user-visible cost of unknown provider discovery; it is not an agent-selection or broad correctness study.

Ghidra computed-call reverse control

At ef5a7e68, real Ghidra 12.1.4 stdio MCP on macOS arm64, in both compact and full profiles, analyzed the mutable-slot ELF from #8277. A backward search from the alternate target to the indirect caller returned unknown with observed-graph not_reached and discovery unknown; the recorded-target backward positive stayed reached. procedure_callers still reported complete coverage for the alternate target, so this path-level qualification does not resolve the provider's individual caller-coverage claim. On separate #8340 head b7e0b280, that backward path remained not_reached; the forward computed-call path was unknown. Successful outputs validated against advertised schemas. The unexecuted target SHA-256 60152582c3d599b9a6923d7ac7138887b6e5ab9f40114735c88980429cfe70e5 was unchanged. This is one fixture, not a combined-branch or broad provider-accuracy test.

Current main integration

Merged main d3ab0faf5 and combined its cleanup-aware relationship reads with discovery aggregation. A stopped or unavailable read now leaves discovery unknown while retaining the original cleanup/cancellation outcome. New public MCP controls cover both traversal directions when a complete-discovery read is followed by an incomplete cleanup.

At merge head ef5a7e68b, real Kuna 1.988 on macOS arm64 through compact and full stdio MCP reported the unflagged-section two-hop fixture as unknown with observed-graph not_reached; the direct positive remained reached. Advertised output schemas validated, and the target SHA-256 59f969db3cc65c93ab6e412f85a60094437ee600e7e4aac73d9dd0d7e3164b04 remained unchanged. The fixture was not executed.

  • Focused call-path and cleanup MCP tests: 42 passed, including the two new directional cleanup controls.

  • npm run check:fast passed after the merge; changed-file formatting and git diff --check passed.

  • Kuna 1.990 paired-path control on head ef5a7e68b: real compact/full MCP returned unknown with observed not_reached for both the direct-call and NOP fixtures, while the direct positive remained reached; an unrelated negative also became unknown. Independent LLVM disassembly confirmed the differing instruction, and both targets remained unchanged. The baseline 1.990 branch returned definite not_reached for both; see [Bug] Kuna call paths can report complete negative despite omitted direct calls #8362. This tests one controlled pair on macOS arm64 and does not recover the missing edge.

  • Ghidra control on the rebuilt pair: real Ghidra 12.1.4 returned reached for the call fixture and unknown with observed not_reached for the NOP fixture in both MCP profiles. The direct positive stayed reached; unrelated negatives remained unknown. Target hashes stayed unchanged. This is one macOS arm64 pair, not proof of complete Ghidra discovery.

  • Combined Kuna path recovery control: a disposable checkout combining fix!: qualify call paths by provider discovery #8443 head ef5a7e68b and fix(kuna): guide inventory selector recovery #8397 head 65939bc4a returned discovery-qualified unknown, an inventory-specific assembly refusal, and a reached Ghidra path after explicit same-session provider selection. The original Kuna trace was retained exactly; successful responses validated against fetched compact/full MCP schemas. This is one real Kuna 1.990 / Ghidra 12.1.4 fixture on macOS arm64, not an automatic fallback or a merge of either PR. Details: [Bug] Kuna call paths can report complete negative despite omitted direct calls #8362.

Validation performed

  • Hosted CI run 41363820022 on head ef5a7e68b failed: repository-wide formatting reported 16 files outside this PR diff, and process-boundary Frida verifier cleanup tests failed because their temporary fixture lacked dist/domain/fridaRemoteAddress.js. These failures were not reproduced or fixed in this PR; the hosted checks do not establish a green gate. Human author-readiness checks also remain unfilled.

  • Focused Kuna boundary, call-path reconstruction, public MCP and JSON Schema parity tests: 114 passed before the main integration. A separate 91-test run covered snapshot profiles and retained views after the compact-schema correction.

  • Focused public MCP tests for call paths, directional coverage, reconstruction, retained views and unknown identity: passed after updating historical expectations. After the comparison and verification changes, 253 focused tests passed across 11 suites. The CI stdio acceptance control initially failed because its synthetic dossiers omitted discovery; after declaring complete discovery in that fixture, that control and its related MCP suite passed (26 tests). Public stdio MCP controls passed in both schema profiles. Real Ghidra and Kuna dossiers from the controlled fixtures were also replayed through target-free stdio servers at the parent and current commits in both profiles.

  • npm run check:fast — passed.

  • npm run docs:check — passed, including 9 README consistency tests.

  • Real Kuna 1.986 and Ghidra 12.1.4 stdio MCP controls — passed on the supplied static fixtures; fixture SHA-256 remained unchanged. Kuna control covered full and compact profiles. Historical Evidence import and new snapshot round-trip passed.

Compatibility, safety, and release

  • Breaking: a previously valid call or unchanged overall reconstruction verification can now be unknown when discovery was never established. A previously valid trace_call_path or build_call_path negative can also now be unknown when discovery was never established; consumers can inspect search_scope.observed_goal_status or search_scope.observed_status for the observed-graph outcome. Output schemas gain scope and discovery fields; clients caching strict old schemas must refresh them. Keeping the old unqualified negative would preserve the misleading result.
  • Real Hopper and IDA were not exercised for this change; their absent discovery metadata is treated as unknown.
  • No package or installation changes. No new target execution, injection, or mutation.

Latest main integration

Merged main c3647ade1 at 670d025e3. check:fast, docs:check, formatting, the previously failing provider-verifier cleanup suite (8 tests), and the affected domain, composition and MCP call-path suites (63 tests) passed locally. Real Kuna 1.990 and Ghidra 12.1.4 stdio MCP controls in compact and full output-schema profiles (default input profile) preserved the expected outcomes: the sampled Kuna negative was unknown with observed not_reached, the direct positive was reached, and Ghidra found the sampled two-hop path; the unrelated negative remained unknown. The unexecuted target SHA-256 stayed 17a184835ff22f86c6398d96b699acdd2eb200ebb3d966d6fb5af7d0cebff4ed. Hosted checks are rerunning; this is one host and fixture, not evidence of complete discovery.

Review follow-up and current validation

At head 95c8fc2aa5, merged main f8bb792f15 and corrected the discovery ownership gap: equal observed call sets previously lost their incomplete discovery qualification when producing unknown inputs and changed-behavior findings. The shared call-coverage owner now retains typed discovery status in comparison evidence. An incomplete or unreported discovery produces an unresolved call finding even when observed sets match, and remains unresolved alongside a separately observed change. Older evidence without this field remains unknown. Observed equality and differences are preserved; they do not establish exhaustive discovery.

  • npm run check:fast passed on this head; 107 focused domain and public MCP tests passed, including full and compact SDK-advertised output-schema validation with Ajv 2020. Mutation controls confirmed the public regressions fail when uncertainty propagation is removed.
  • Repository-wide formatting currently fails on an unrelated main-branch file; the separate fix is style(test): format CLI help default annotations #9280. Hosted CI is pending. Generated catalog validation and real-provider controls were not rerun at this head; the earlier provider observations above identify their exact heads and limits.

Facet availability follow-up

At bd234dedfa (including main ac30fbd658), an unavailable or undeclared call facet still makes its observed comparison unknown, but the replacement result retains the independently recorded discovery status. Previously that replacement discarded the status and downstream findings incorrectly said discovery was unrecorded. Public MCP controls for complete and partial discovery with an unavailable facet passed, alongside the existing four coverage controls; check:fast passed. The unrelated main formatting file now passes its targeted formatting check. Hosted checks are pending; real-provider controls were not rerun for this follow-up.

Current main refresh

Head 4262983238 merges main c928bb8d80. The snapshot-cache test conflict preserved main's classified-reference non-replay control and this PR's revised call-path and trace workflow profile controls. Focused snapshot, call-path, comparison, discovery, changed-behavior and MCP tests passed (239 tests), including both advertised MCP schema profiles and reference-classification comparisons. npm run check:fast and git diff --check passed. Hosted checks are pending; real-provider checks were not rerun on this head.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Kuna 1.989 discovery control

On head ef5a7e68b, real Kuna 1.989 and both compact and full stdio MCP profiles, the owned unflagged-section call fixture and paired NOP fixture both produced unknown with observed-graph not_reached; the direct positive remained reached and the unrelated negative became unknown. On the version-bump branch, both fixtures instead returned complete-looking not_reached. Independent llvm-objdump showed the call versus NOP; target hashes were unchanged and targets were not executed. Direct Kuna 1.989 xrefs --from now distinguishes the exact source in these fixtures and reports decode coverage, but REA's graph path does not yet use that observation; see #8362. This one-host control establishes neither broad coverage nor a new edge-recovery implementation.

@morluto
morluto marked this pull request as ready for review November 1, 2026 05:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T16:51:46.308149Z 4262983 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge; no new actionable issue was found.

Summary

Separates reading provider-observed call edges from establishing call discovery.

  • Call-path searches qualify missing paths by discovery coverage.
  • Function comparisons keep observed call sets separate from discovery limits.
  • Reconstruction checks leave unproven call claims unresolved.

The previous and current commits have different merge bases with the target, so this review covered the full PR diff.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  P[Provider observation] --> E[Observed call edges]
  P --> D[Directional discovery facts]
  E --> S[Search observed graph]
  D --> Q[Qualify search result]
  S --> Q
  Q --> F[Keep found paths]
  Q --> C{Missing goal and complete coverage?}
  C -->|Yes| A[Report absent]
  C -->|No| U[Report unknown]
  D --> V[Qualify comparison and reconstruction]
Loading

Reviews (11) · Last reviewed commit: "Merge branch 'main' of https://github.co..." · Reviewed by Greptile

Comment thread src/domain/callPath.ts Resolved
morluto and others added 2 commits November 4, 2026 08:31
trace_call_path and trace_native_values both use workflow revision 2.
Value-trace absence stays specific to trace_native_values, and an
unrevised operation still matches the default profile.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 367be83922

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@morluto
morluto merged commit 31278c7 into main Nov 7, 2026
15 of 17 checks passed
@morluto
morluto deleted the codex/call-discovery-scope branch November 7, 2026 17:21
@morluto morluto added area: providers Provider and capability discovery, including provider proposal triage bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants