Repository navigation
feat(providers): retain native selection provenance in Evidence - #9668
Conversation
…idence The registry records how a deep provider became selected and why every other candidate was rejected, and binary_session exposes those facts for the active route. Evidence already carried provider identity, but nothing recorded which candidates the session evaluated, so a retained record could not explain why this engine produced the observation or what the alternatives were. Attach provider_selection to Evidence admitted by the session: the selection source and, for each evaluated candidate, its identity and version, selection state, availability and target-support outcome, and the stable rejection codes. The field is optional and excluded from semantic identity, following caller_input_path, so each admitted record stays attributable to the exact provider instance without changing observation identity, evidence IDs or replay. Copy only stable selection facts. Candidate diagnostics, remediation prose and target content stay in the session status projection instead of being repeated in every record.
Codex Review Summary: ❌ FailedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46318fde74
ℹ️ 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".
oxfmt --check rejected the three-line expect() call; the formatter's single-line layout is the canonical one, so Static checks failed only on formatting.
|
Merged Verified locally after the merge: Note: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 182a5c47e6
ℹ️ 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".
`recordEvidence` ran `withEvidenceProviderSelection` before handing the record to the ledger. That helper parses to seal the rebound envelope, so a tampered or otherwise invalid record threw a `ZodError` from the attribution step and never reached `EvidenceLedger.record`, which is where the declared `Result` is produced. `tests/boundary/mcp/processEvidenceIdentityMcp.test.ts:454` asserts `session.recordEvidence(tampered).ok === false` and fails on the throw. Authenticate the input first and return the ledger's own rejection for a value it would refuse anyway; attribution then only ever sees a record its reader accepts.
Import replaces a same-ID record's presentation metadata, and provider_selection is part of that metadata. When runDirectAnalysis imports the provider's own bundle, the copy it rebuilds carries no selection, so the import erased the attribution the session had stamped and the caller kept an unattributed record instead. Attribute at both merge sites, where the session already authenticates everything it admits. A refreshed route after a failed switch can bind a different selection than the one the earlier binding held, so re-derive it there as the initial open does; spreading the previous binding kept the stale value.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d001fc0d5b
ℹ️ 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".
recordEvidence and the two bundle import paths seal Evidence through withEvidenceProviderSelection before handing it to the ledger. A sealed value skips the ledger's ordinary-JSON and heap-headroom admission, so a session with no authentication allowance accepted a mutable record and a large record was copied and traversed before the guard ran. Hold the caller's own value to that admission first, then attribute. The import paths also refuse with a Result instead of falling through to an unattributed import when admission fails.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6570fe022a
ℹ️ 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".
recordEvidence now admits the caller's value before attributing it, but a record returned by evidenceForAnalysis has already been through that admission and is sealed. Running the ordinary-JSON walk and the heap-headroom check over it again repeats the work the ledger itself skips for a sealed value. Ask the ledger first: a value it holds is the admission it made, so the check costs one lookup. Only a value the ledger has not seen pays for the full walk.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b0a708b5f
ℹ️ 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".
|
Merged CI has not re-run on this head yet. |
Import re-stamps session provenance onto the Evidence it records, but callers kept the pre-import copy, so retained selection attribution and cache metadata were dropped from what analysis reported. Read the recorded record back after a successful import, and leave an already-retained record as the ledger attributed it instead of re-deriving attribution from the caller's copy.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5989df5ac
ℹ️ 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".
…d record The merge with main brought in the unchanged-record path, where an import whose only change is display metadata now replaces the ledger's record. Re-attributing that incoming value put the session's provider selection on the caller's copy, so the import reported a record that differed from what the caller sent. Attribution now applies only to records the ledger does not already hold. The snapshot cache test now asserts the session's attribution explicitly instead of byte equality with the un-attributed source.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fac647f1f5
ℹ️ 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".
…ed one The previous change skipped attribution for a record the ledger already held, which left the imported copy's own selection — missing or from another session — in place. Import replaces a same-ID record's presentation metadata, and provider_selection is part of it, so the session's attribution wins over the caller's copy while the caller's other display metadata is kept untouched.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a47748ac17
ℹ️ 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".
Address the open review findings on session provider provenance: - importAnalysisSnapshot merged the re-attributed bundle into the ledger but staged the snapshot's own bundle, so AnalysisSnapshotCache rebuilt replay bindings from records the merge had replaced. Hand the merged bundle back to the stage so replays bind to the attributed evidence. - recordResult recorded an attributed record and then serialized the caller's copy, so successful MCP responses omitted provider_selection while the ledger and exports carried it. Read the recorded Evidence back before delivery, as the direct analysis path already does. - recordUnknown and updateUnknown synthesized unknown-mutation Evidence without the active session's provider selection, so those exported records were unattributed. Thread the binding's selection through to unknownMutationEvidence, which is where the record is produced.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eeca98bb2b
ℹ️ 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".
…cord recordEvidenceWithUnknown synthesizes its own rea.residual-unknown-mutation record, so the selection the session threads into recordUnknown and updateUnknown never reached it. The atomic comparison workflows therefore exported one record without provider_selection, contradicting the guarantee that every admitted record carries the recording session's selection. Thread the active binding through the atomic method as well; analyst-authored mutation records still keep analyst-inference authority and gain only the session selection.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 679fbe2cbe
ℹ️ 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".
|
The parent scope in #9133 is native-provider provenance. I’m narrowing the repair to fresh native observations; imports retain their history, and derived or artifact results keep their source links without being relabelled. This removes the broad writer changes behind several review findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Thanks @2SinceJuly! Landed in 2bb086c. The native-only implementation, recovery cases, full CI, and real Ghidra validation are complete. |
…n re-merge Main's morluto#9668 added the optional provider_selection provenance field to the shared Evidence envelope, so every tool's output compact schema changed; this branch's summary predates the re-merge to 0f5ab1e and went stale. The tool's own output (normalized_result) is unchanged: the compact schema gains only the optional provider_selection property, pruned to a bare object by the compact budget. Signed-off-by: Reynold Hu <[email protected]>
Summary
Native analysis Evidence now records why Hopper, Ghidra, IDA, or Kuna was selected: the request/environment/automatic source, evaluated candidates, availability, target support, and rejection codes. This follows the first implementation scope in #9133 and the provenance request in #9137; both parent issues are already closed.
Behavior and scope
provider_selectioncontract, schema summaries, and CLI reference. No new tool, provider, target execution, installation, or mutation authority.Example native metadata:
provider_selection.selection_source = "request", with Ghidra marked selected, available, supported, and with no rejection codes. Derived summaries and older unannotated records omit this field.Validation
ff01a11498c42ff10c36ad66c0c4108065e4004d.e99d0b2d86431c3b20b662c3d706fb5c932079a5is integrated, with the independent schema-input/output conflict separately reviewed.7a3de8dd74994e6dad5954b4006105e9e27a846d, containing this PR head.Author readiness
Human owner: @2SinceJuly
Before merge
type(scope): outcome.