Skip to content

refactor(mcp): bind provider-backed workflows on admitted analysis through the shared table - #11617

Merged
morluto merged 1 commit into
mainfrom
refactor/bind-enhanced-workflows
Nov 16, 2026
Merged

morluto merged 1 commit into
mainfrom
refactor/bind-enhanced-workflows

Conversation

@morluto

@morluto morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Summary

Binds the 15 provider-backed workflow tools (trace_feature, trace_call_path, trace_native_values, trace_native_ui_action, batch_decompile, decompile_all, get_call_graph, analyze_function, inspect_native_api, inspect_native_dispatch_metadata, get_objc_classes, get_objc_protocols, analyze_swift_types, find_xrefs_to_name, binary_overview) through the shared binding table instead of 15 hand-written registerTool handlers in registerEnhancedTools.ts.

Problem and expected behavior

registerEnhancedTools.ts re-implemented admission, progress, logging, summary retention and delivery for one family, and held session policy in the MCP adapter: which workflows record a replay snapshot, which analysis profile Evidence names, and when residual unknowns count as retained. Expected: one application owner completes a workflow's Evidence in the session, and the shared loop admits, reports progress, logs, retains summaries and delivers it.

Change and scope

  • New binding kind analyze (src/server/contractToolBindings.ts, createAnalysisToolHandler in contractToolHandler.ts): the workflow runs on the AnalysisOperationPort its admission grants. A binding declares detail: "delivery" (type-required exactly when the contract's input has detail: "complete" | "summary") so detail never reaches the workflow, a summary is refused before analysis when nothing retains Evidence, and the complete Evidence is retained behind the summary. Binding it on a server without analysis admission fails at startup.
  • New application owner src/application/SessionWorkflowEvidence.ts: executeSessionWorkflowEvidence (composed workflow, partial/source retention, Evidence, workflow snapshot, residual unknowns) and executeSessionFunctionAnalysis, both taking the session (WorkflowSession, a Pick of BinarySessionPort) or none.
  • src/server/serviceToolBindings.ts: enhancedWorkflows group; createServer.ts registers it with { session }. Removed src/server/registerEnhancedTools.ts and the adapter-side session closures in createServer.ts.
  • bespoke-mcp-tool-registration baseline: 15 sites removed (19 files / 72 sites → 18 / 57).

Behavior differences visible to MCP clients (all minor):

  • analyze_function reports its terminal progress after delivery, like the other workflows (it reported before summary projection), so a failed retention now reports failed.
  • A failure to record the completed Evidence, its workflow snapshot or its unknowns is delivered through the shared failure path; without partial Evidence on the error (these failures carry none) the result is identical.
  • tools/list lists these tools in contract-registry order.

Not included: the CLI path (DirectAnalysis.executeAnalysisTool) keeps its own one-shot composition; joining the two is W2 (one invoke path after admission). registerEvidenceTools.ts (direct and native provider operations) could bind with the same kind in a later PR.

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP registration of the enhanced family; session completion of workflow Evidence moves from the adapter to SessionWorkflowEvidence.
  • Contribution scope fit and linked maintainer decision: not applicable (no new authority).
  • CLI and MCP/tool-catalog contract: schemas unchanged (verify:advertised-schemas passes); CLI unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): admission and retained-resource cleanup are unchanged (the same withAdmittedAnalysis grants the port; the port keeps its resourceScope).
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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.

Evidence and regression coverage

  • Tests updated: analyzeFunctionDetail.test.ts and batchSourcePublicationRecovery.test.ts bind through the table with a records-backed session (tests/fixtures/workflowSession.ts). The batch case "known owner false" is removed: it built an adapter with a session recorder but no session lookup, which production cannot compose (a session always supplies both); the unknown-retention projection keeps its unit coverage in preserveCompletedSourceEvidence.
  • Existing MCP workflow tests run unchanged through createServer: input validation, call paths and batches, batch views, value-trace failures and cleanup-incomplete, workflow unknown publication, Kuna and IDA provider workflows, snapshot replay.
  • Lifecycle: admission, cancellation and retained-resource cleanup are not changed; nativeValueTraceCleanupIncomplete.test.ts (cleanup failure retained) passes unchanged.
  • Remaining proof gaps: no real-provider run.

For evidence-bearing changes:

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

Validation performed

  • npm run test:focused -- tests/boundary/mcp/analyzeFunctionDetail.test.ts tests/boundary/mcp/batchSourcePublicationRecovery.test.ts tests/boundary/mcp/enhancedTools.inputValidation.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts tests/boundary/mcp/nativeValueTraceCleanupIncomplete.test.ts tests/boundary/mcp/nativeValueTraceFailures.test.ts tests/boundary/mcp/serverWorkflowMcp.test.ts tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/workflowUnknownPublication.test.ts — 61 passed
  • npm run test:focused -- tests/boundary/providers/kuna/kunaBatchDecompileMcp.test.ts tests/boundary/providers/kuna/kunaAliasSearchMcp.test.ts tests/boundary/providers/kuna/kunaParallelMcp.test.ts tests/boundary/providers/ida/containment.test.ts tests/boundary/providers/ida/selectorProvenance.test.ts tests/boundary/mcp/idaToolEffects.test.ts src/server/ProgressiveToolCatalog.test.ts src/server/EvidenceMcpServer.test.ts tests/boundary/filesystem/directAnalysisSnapshotReplay.test.ts — 76 passed, 2 skipped
  • npm run verify:advertised-schemas — passed
  • node scripts/verify/architecture-guards.mjs --shrink-baselines — baseline lowered, passed
  • npm run check:fast — passed
  • npx oxfmt on changed files — clean

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

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.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T00:12:47.549801Z
We couldn’t complete this review. Comment @codex review to try again.
884cc64 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge, with a non-blocking extra recording pass for complete workflow results.

Fix All in CodexFindings

  1. P2 Complete results are recorded twice ▶
Fix with agent prompt
### Issue 1
src/server/contractToolHandler.ts:475-480
With a session, `executeSessionWorkflowEvidence` records the completed result before returning it. This call to `deliverEvidenceResult` then records it again. For a freshly built result such as `batch_decompile`, `EvidenceLedger.record` checks, copies and hashes the whole record before detecting the duplicate. Large complete responses therefore use extra time and temporary memory after they are already stored.

Pass the first recording acknowledgment into delivery, while preserving recording for `analyze_function` and newly created summaries.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Moves 15 provider-backed MCP tools into the shared binding table and gives SessionWorkflowEvidence responsibility for completing their session records.

  • Enhanced MCP workflows now run through the shared contract table.

Diagram

sequenceDiagram
  participant Client
  participant Handler as Shared MCP handler
  participant Admission as Analysis admission
  participant Workflow as SessionWorkflowEvidence
  participant Provider
  participant Records as Session records
  Client->>Handler: Call named tool
  Handler->>Handler: Separate delivery detail
  Handler->>Admission: Admit request
  Admission->>Workflow: Grant analysis port
  Workflow->>Provider: Run workflow reads
  Provider-->>Workflow: Observations
  Workflow->>Records: Retain sources and completed Evidence
  Workflow->>Records: Record snapshot and unknowns
  Workflow-->>Handler: Completed Evidence
  opt Summary requested
    Handler->>Records: Retain parent and build summary
  end
  Handler->>Records: Record delivered Evidence
  Handler-->>Client: Result and terminal progress
Loading

Reviews (2) · Last reviewed commit: "refactor(mcp): bind provider-backed work..." · Reviewed by Greptile

@morluto
morluto merged commit 0884836 into main Nov 16, 2026
8 checks passed
@morluto
morluto deleted the refactor/bind-enhanced-workflows branch November 16, 2026 00:22
Comment on lines +475 to +480
const response = deliverEvidenceResult(
server,
delivered,
contract,
retention.recordEvidence,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Complete results are recorded twice

With a session, executeSessionWorkflowEvidence records the completed result before returning it. This call to deliverEvidenceResult then records it again. For a freshly built result such as batch_decompile, EvidenceLedger.record checks, copies and hashes the whole record before detecting the duplicate. Large complete responses therefore use extra time and temporary memory after they are already stored.

Pass the first recording acknowledgment into delivery, while preserving recording for analyze_function and newly created summaries.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/server/contractToolHandler.ts
Line: 475-480

Comment:
**Complete results are recorded twice**

With a session, `executeSessionWorkflowEvidence` records the completed result before returning it. This call to `deliverEvidenceResult` then records it again. For a freshly built result such as `batch_decompile`, `EvidenceLedger.record` checks, copies and hashes the whole record before detecting the duplicate. Large complete responses therefore use extra time and temporary memory after they are already stored.

Pass the first recording acknowledgment into delivery, while preserving recording for `analyze_function` and newly created summaries.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

2SinceJuly added a commit to 2SinceJuly/rea that referenced this pull request Nov 16, 2026
Commit 76d14ff stamped the delivered copy with the retained session
selection by patching registerEnhancedTools and registerEvidenceTools.
Upstream morluto#11617 replaced both with the shared contract bindings, so the
merge dropped the stamp and the composed-workflow tools delivered an
unattributed copy again: workflowSnapshotReplayMcp compares the live
binary_overview response against the replayed Evidence and saw 19 fields
against 18.

Stamp at createAnalysisToolHandler, where every analysis workflow's
Evidence leaves for delivery, using the retention lookup already passed
in. A call whose ID is not retained, or whose record carries no
selection, is delivered unchanged.
@morluto morluto added the area: mcp MCP server, transport, and tool registration label Nov 22, 2026
vincentkoc added a commit that referenced this pull request Nov 26, 2026
* feat(providers): retain provider selection provenance with session evidence

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.

* style(domain): reformat the provider-selection assertion

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.

* fix(evidence): keep a rejected record inside the Result boundary

`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.

* fix(binary): attribute imported records to the recording session

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.

* fix(binary): admit record input before sealing it for attribution

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.

* fix(binary): re-attribute a sealed record without traversing it again

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.

* fix(providers): return the recorded Evidence after import

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.

* fix(providers): keep the caller's copy when re-attributing an imported 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.

* fix(providers): keep the caller's record when importing over a retained 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.

* fix(providers): attribute staged snapshot and unknown-mutation Evidence

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.

* fix(providers): attribute the atomic Evidence-and-Unknown mutation record

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.

* fix(evidence): require one selected candidate in provider provenance

provider_selection carries no separate selected-provider id, so a reader can only name the recording session's provider when exactly one candidate claims the selection. The schema accepted any candidates array, so an imported bundle could re-export zero or several selected candidates under a stable Evidence id and consumers would have no way to resolve the provider.

The recording paths always derive the selection from a single bound provider (AnalysisProviderRegistry selects one usable candidate, and SessionProviderRouter marks only the bound id selected), so the refine rejects only foreign input.

* fix(evidence): adopt the recording session's selection on a duplicate record

Recording an observation the ledger already holds under the same semantic ID
returned duplicate and discarded the attributed object, so lookup and export
kept the imported record's missing or foreign provider_selection. Replace the
retained display metadata with the active selection on that path; semantic
identity and the stored payload stay the same record.

The provenance schema also accepted a selected candidate that is unavailable
or unsupported, which no registry path can bind. Require the selected
candidate to be available and supported so an imported bundle cannot
re-export a selection that never occurred.

* fix(evidence): keep retained display metadata and notify observers on duplicate

Attribution replaced the whole stored record with the incoming copy, so a
provider-produced duplicate without the caller-selected path, alias set or
subject display erased the metadata the recording session retained merely to
add provider_selection. Adopt only the display facts the incoming copy actually
carries; omission is not deletion. Import keeps its documented replace
semantics.

The duplicate branch also returned before refreshEvidenceMetadata and
#emitSnapshotChanged, so replay caches and snapshot subscribers kept the old
metadata after a successful replacement. Treat a non-no-op replacement exactly
as the import path does.

* fix(artifacts): compare Evidence by identity across a replay session

The composed-workflow test opened a second fixture, which writes its own
temp artifact, so a replay record's subject path and the session-attributed
provider selection no longer matched the snapshot copy. Both are display
metadata outside the Evidence id; the provider call is what establishes
the binding here, so compare the content the id commits to and assert the
ids separately, which the test already does.

Also apply the formatter to BinarySessionInvestigation.test.ts, which
fails format:check on its own.

* fix(server): deliver the retained copy that carries the session selection

Recording stamps the active session's provider selection onto the ledger copy
of a semantic ID. The tools that build or project their own Evidence value
then delivered that unattributed copy, so the MCP response and the snapshot
export disagreed for the same evidence_id: Ghidra reference and evidence
flows, composed workflow overviews, analysis functions and the process
capture tools all failed deep-equality against the retained record.

Hand the delivered copy the session's selection when the ID is retained.
Other retained display metadata, such as a caller path carried by an
imported record, stays as the caller built it.

* test(investigation): keep the session test within its lint and format limits

Two checks on this branch failed for reasons the branch itself introduced:

format:check wants the withEvidenceProviderSelection call in
UnknownEvidence.ts wrapped at its argument list, which the branch's
edit moved off.

lint reports max-lines-per-function (152 lines, limit 150) for the
"reobserves resource-scoped ..." case after the branch expanded two
assertions in it. The provider-selection expectation is a fixed value,
so it moves to a module-level constant and the case drops back under
the limit without weakening either assertion.

* fix(server): carry the session selection on the workflow copy delivered

Commit 76d14ff stamped the delivered copy with the retained session
selection by patching registerEnhancedTools and registerEvidenceTools.
Upstream #11617 replaced both with the shared contract bindings, so the
merge dropped the stamp and the composed-workflow tools delivered an
unattributed copy again: workflowSnapshotReplayMcp compares the live
binary_overview response against the replayed Evidence and saw 19 fields
against 18.

Stamp at createAnalysisToolHandler, where every analysis workflow's
Evidence leaves for delivery, using the retention lookup already passed
in. A call whose ID is not retained, or whose record carries no
selection, is delivered unchanged.

* chore(schemas): record the provider_selection evidence schema digest

Adding provider_selection to the shared Evidence schema changes the output
compact schema of every tool that returns Evidence, so Build package
rejects 211 stale advertised catalog summaries. The summaries were
refreshed by running npm run verify:advertised-schemas -- --update-summary;
each file changes only its output compact digest.

* test(mcp): assert retained provider attribution instead of producer identity

Recording now stamps the session's provider selection onto retained Evidence,
so a producer-built copy and the retained record share every semantic member
but differ in provider_selection. Replace raw object identity/equality
assertions with display-metadata agreement plus a selection-neutral deep
comparison, and deliver the retained selection from contract tools so callers
do not receive an unattributed copy of the same evidence_id.

Verified: tests/boundary/mcp (345 files, 2289 passed / 12 skipped after
generating .cache/mcp-tool-catalog.json); npx tsc --noEmit exit 0.

* test(mcp): share the selection-neutral comparison across provenance assertions

Seven sites repeated the same spread-and-mask expression, which pushed the
test past the 150-line function limit and failed Static checks. Move it into a
withoutSelection helper that drops the session's provider_selection stamp and
compare both sides through it.

Verified: npm run check:fast (typecheck, lint, architecture guards);
the six boundary files CI reported, 37 passed.

* test(mcp): fold repeated retention checks into one helper

Static checks failed on format:check for three files and then on
max-lines-per-function after oxfmt re-wrapped the assertions. Run oxfmt on
the three files and replace the repeated selection-neutral comparisons with
an expectRetained helper so the test stays under the 150-line limit.

Verified: npm run check:fast (typecheck, lint, architecture guards);
npm run format:check; the six boundary files CI reported, 37 passed.

* test(snapshot): compare retained records without the session selection stamp

The same attribution change makes a fixture-built record differ from the
retained one by provider_selection alone, so the equality assertion failed in
both the portable and sharded lanes. Mask the stamp and keep every semantic
member under strict comparison.

Verified: npx vitest run tests/boundary/filesystem/analysisSnapshotProvenance.test.ts,
2 passed; npm run lint (0 errors); oxfmt --check.

* chore(schemas): record the provider_selection output digest on five tools

The session_provider_facts binding gained a .describe() explaining that the
selection source and candidate outcomes are retained with each admitted
Evidence record. That text is part of the advertised output schema, so every
tool whose output embeds the binding has a new compact digest.

Regenerate the committed catalog summaries with
npm run verify:advertised-schemas -- --update-summary. Only the five output
compact hashes change; no tool's shape or pattern changes.

* fix(evidence): keep a retained record's caller-selected path when adopting metadata

adoptEvidenceDisplayMetadata let a later copy's caller_input_path overwrite the value already held under the same semantic id, so a second selection through a different alias rewrote the display path the first selection recorded. Prefer the retained value and take the incoming one only as a fact the retained record lacks.

* fix(evidence): stamp the session provider selection on summarized delivery

Recording stamps the active session's provider_selection onto the retained
record under the same Evidence id. The summary delivery path re-admitted
the summarized copy without that stamp, so a caller reading a summarized
result saw no provider_selection while the retained record carried one, and
the response and the retained view disagreed for a single id. Pass the
retention lookup to deliverEvidenceResult on both the analyze_function and
external-mutation summary paths so the delivered copy carries the same stamp.

* chore(schemas): refresh UEFI tool summaries for the Evidence schema change

main added the UEFI inspection and extraction tools after this branch
regenerated the advertised catalog summaries, so their output compact
digest still recorded the pre-provider_selection value. Regenerate them
so the shared Evidence schema digest matches the branch.

* test(investigation): compare borrowed records without the selection stamp

Importing a sealed bundle stamps the session's provider_selection onto every retained record, so a borrowed record no longer shares object identity with the caller's unstamped bundle record. Replace the identity and equality assertions with a selection-neutral deep comparison, matching the attribution handling already applied to the snapshot and MCP provenance tests.

* fix(investigation): admit unknown mutations against their expanded Evidence

record_unknown and update_unknown check authentication headroom against the
caller's input before building the mutation Evidence. The Evidence repeats
parts of the input (for example the question in both parameters and the
normalized result), so with live headroom that admits the input but not the
larger record, the operation authenticated and sealed a representation past
the stated bound. #readEvidence skips the admission for immutable records, so
nothing downstream re-checked it.

Charge the derived Evidence's authentication cost in addition to the input
before sealing it, across the record, atomic record-with-unknown and update
paths. The regression test finds an allowance between the two sizes and
asserts the operation is refused with no Evidence recorded.

* chore(schemas): refresh advertised summaries after the provider-selection change

The advertised-schema catalog digests still described the pre-change input
schemas, so the Build package lane failed with 28 missing or stale summary
files and skipped every lane downstream of it. Regenerate the summaries with
npm run verify:advertised-schemas -- --update-summary.

* test(deno): damage Deno PE resource framing at the directory entry

The fixed-allowance case shrank the language directory Size to make the
65,535-row table malformed, but #14253 now walks resource trees at their
RVA whatever Size declares, so the table stayed well-formed and the run
reported the entry allowance (truncated/limit) instead of malformed
framing (unsupported_target/malformed). Point the type directory's entry
at a language directory outside the file-backed resource bytes, whose
header cannot be read. This mirrors the fix already on main (271bad7).

* fix(evidence): preserve source provenance and admit before copying

* fix(providers): scope selection provenance to native executions

* fix(providers): carry native provenance through workflow projections

* fix(providers): retain selection on shared session limitations

* fix(providers): preserve provenance during source recovery

* test(contracts): refresh combined Android reference schema

* fix(evidence): admit provider metadata before copying observations

* fix(evidence): recover completed calls after context refusal

* test(contracts): format merged call path schema summary

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant