Skip to content

refactor(evidence): unify retained inputs across domains - #8299

Merged
gensokyo-dev merged 7 commits into
mainfrom
refactor/evidence-input-contracts
Oct 31, 2026
Merged

gensokyo-dev merged 7 commits into
mainfrom
refactor/evidence-input-contracts

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #8293. Fixes #8281.

Completed analysis could remain retained while a downstream tool still required its full payload. Two real Ghidra dossiers could exceed the default input budget just to build a call path. Logical Evidence inputs now share exact inline/reference selection across domains, so producers can return summaries and consumers can reuse complete parent IDs.

Change and scope

  • One schema declaration owns borrowing validation and application resolution for 20 composition tools, including optional, nested and array sources. Converted SDK schemas advertise the canonical contract and a shared reference-format hint. Catalog conformance catches undeclared or unsupported inputs. Owner failures keep their original type/metadata and gain the declared source path when absent; existing owner paths are preserved without parsing twice.
  • Domain owners authenticate and interpret selected records. Native/process investigation logic moves into application workflows; superseded resolvers and adapter parsing are removed. Existing file/view/bundle owners keep their explicit authority. Capacity, identity, closure, uncertainty and completed-source cancellation semantics remain enforced.
  • Existing JSON CLI workflows accept an explicit --evidence-bundle, read once without modifying it. CLI/MCP use shared workflows; existing artifact-path commands retain their interfaces. Skill instructions and owning guides are updated.

Contribution scope: ordinary composition within existing local analysis authority; no new provider, target execution, injection, mutation or protection recovery capability. Maintainer scope decision: not applicable.

Contract and boundary impact

  • Semantic owner: canonical source declarations → shared application selection → authenticated domain facts. File-source interpretation remains with its existing owner.
  • CLI/MCP: additive reference inputs and selected-bundle options. Malformed complete sources in native function and process workflows are diagnosed by the canonical Evidence owner (evidence_integrity_mismatch) in both schema profiles; other workflows keep their owner-specific projections; invalid request envelopes/reference grammar remain request errors. CLI JSON syntax diagnostics preserve their public command names. Source IDs, caller values and complete Evidence access remain available.
  • Provider/platform: existing Ghidra/managed/JS/WASM/inventory/process semantics; no bridge or installation change.
  • Provenance/cleanup: exact source closure and partial/unknown facts remain visible, including terminal cancellation. Bundle reads use the existing resource owner/finalizer.
  • Generated metadata: skill revision 59 and its authored package metadata; ignored catalogs/packaged skills are regenerated and excluded from Git.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

The focused run passed 508 checks. Coverage includes inline/ref equality, missing/wrong sources, independent inline admission, parent IDs, source closure, caller identities, real SDK full/compact conversion, CLI bundle immutability, capacity and late cancellation. SDK tests were subsequently moved into the MCP boundary project and rerun. Review follow-up passed 103 related checks plus ten selected schema/CLI checks: process files authenticate sequentially through shared parsed facts, and fixed-server WASM comparisons explicitly retain caller ownership without weakening provider-source requirements. Existing authentic process captures still produce the exact original comparison ID. An additional seven-file run passed 161 checks, including 17 fixed-server/inline-view cases, both schema profiles, JSON diagnostics, selected identities and file/view source boundaries. A final-head public MCP review probe passed two valid controls and 24 malformed-source rejections across full/compact profiles, with correct source paths, zero provider calls and verified cleanup; the reported null dereference was not reachable. A subsequent six-file run passed 104 MCP checks; process-depth coverage now checks the canonical owner diagnostic, exact depth/field, successful recovery and zero provider startup. Runtime code was unchanged. Five related acceptance files also passed 17 checks: supplied inline comparisons report missing linked dependencies, retained selectors report a missing comparison, and importing the full bundle restores complete equal outputs. The rebuilt final gate passed nine files / 75 checks, including all 41 ADB CLI cases and default HTTP/stdio admission. HTTP boundary errors retain the source path and stay under 4KiB; the 1,024-element allowance is unchanged. A fresh target-free replay of the genuine Ghidra bundle returned all three complete native results equal to their original goldens, without producer calls.

Real local Codex CLI 0.165.0 explicitly requested gpt-6.1-terra / high for 14 attempts across jq/Ghidra, NuGet, Obsidian, agent-browser, CSS WASM, Rectangle/Apple, NewPipe, Shark APP/HAP and authentic jq captures. Failures and unknowns are preserved: Obsidian's existing timeout/oversized feature output is partial (#8296); the first supplemental JS task wandered and was stopped. Later scoped tasks are labeled separately.

The real WASM CLI pair produced byte-identical output and the same MCP Evidence ID: inline request 27,823,017 bytes versus 261 bytes plus the selected existing bundle. Observed elapsed/CPU/peak: 2.832s / 2.612s / 370.5MB and 2.632s / 2.385s / 310.0MB. This single ordered pair has uncontrolled shared caches; no general speedup or token-saving estimate is claimed. Actual model tokens, common producer cost, failed attempts and proof gaps are in the verification record and accompanying JSON.

A separate real public-transport matrix completed nine lanes across JS, native, managed, Android, Harmony APP/HAP, Apple/artifact, WASM and process. Sources were exported, original connections closed, and imported into fresh target-free consumers; supported inline/CLI forms produced complete equal Evidence without producer replay. Thirteen attempts retain three corrected harness assumptions and one actual SDK transport refusal. The approximately 28MB WASM inline pair exceeds the SDK default 10MiB frame limit; retained inputs and both CLI forms succeed without raising limits. Cross-domain native/process correlation remained an explicit unresolved hypothesis. This scripted matrix makes no autonomous-selection or model-token claim.

  • 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

  • Exact focused source/CLI/MCP/integration selection: 42 files / 508 checks passed; relocated SDK and affected JS checks rerun. Additional final source/CLI/MCP boundary run: seven files / 161 checks passed (154.106s elapsed, 153.592s family CPU, 1,884,516,352-byte kernel peak).
  • Source typecheck, module boundaries, architecture guards, 34 Python harness checks and Knip: passed.
  • Lint: the initial 6,105-file set plus subsequent touched/new files checked in serial batches; two new test grouping errors corrected and rerun. Full check:fast lint exceeded the local early-stop budget, so its whole-process form is not claimed as passed. Local Git hooks are skipped after these equivalent bounded checks; CI retains its full gate.
  • npm run docs:check (including nine README checks) and final npm run format:check (6,581 files): passed.
  • One unchanged ADB CLI child hit its existing 20s helper deadline in CI. Isolated fresh/same Node-cache probes returned expected validation in 1.970/1.170s, and all 41 rebuilt-runtime ADB CLI cases passed locally. No timeout increase or device execution; baseline flakiness is not claimed.
  • Heavy validation used one CPU, 4GiB hard / 3GiB early-stop scopes; model/CLI process and copied-auth cleanup verified. No OOM event occurred.

Compatibility, safety, and release

Additive successful-input contracts and canonical malformed-source diagnostics; no migration or manual package-version bump. Real Ghidra/WABT, public shipped artifacts and controlled Linux process captures were exercised. Real Hopper, IDA, Windows capture, devices, Harmony execution and passive browser reconciliation remain unverified. No original source recovery or runtime equivalence is claimed.

Author readiness

Human owner: @gensokyo-dev

The owner explicitly delegated implementation, final-diff review, verification, readiness declarations and merge to this agent. The agent performed the review and checks and fills these declarations under that instruction; a separate human inspection is not claimed.

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

Derive source borrowing and exact reference selection from declared contracts.
Share CLI/MCP workflows while retaining source ownership, closure and admission.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T14:21:45.602813Z 3a0b428 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 Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[High impact] The reviewed changes appear safe to merge, with no new blocking issue found.

Summary

The PR shares inline and retained Evidence selection across domain workflows and adds explicitly selected bundles to existing CLI commands.

  • Analysis workflows select retained Evidence from declared inputs.
  • JSON CLI workflows can reuse records from an explicit Evidence bundle.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Inline[Complete inline Evidence] --> Select[Shared request resolver]
  Ledger[Current MCP ledger] --> Select
  Bundle[Explicit CLI bundle] --> Select
  Select --> Owner[Domain owner authenticates sources]
  Owner --> Workflow[Shared application workflow]
  Workflow --> Result[Derived Evidence and source records]
  Result --> Retain[Retain sources when a recorder exists]
  Retain --> Deliver[CLI or MCP reply]
Loading

Reviews (7) · Last reviewed commit: "fix(evidence): preserve source paths thr..." · Reviewed by Greptile

Comment thread src/server/registerWasmTools.ts Resolved
Authenticate process input files before admitting later sources and compare
their parsed facts through the shared application owner. Keep fixed-server
WASM inline composition available with explicit caller-owned retention.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Keep public CLI command names in JSON syntax errors while canonical workflow
operations still own dispatch. Verify caller-owned sources on fixed MCP ports
and retain native malformed-source diagnostics from the Evidence owner.

Record all thirteen real public-transport attempts across nine domain lanes,
including fresh imports, supported CLI parity, failures and resource bounds.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)

@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: 70db1e8164

ℹ️ 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".

…w checks

Keep native Evidence-integrity diagnostics distinct from reconciliation input
errors. Record the current-head full/compact MCP probe and explain why the
reported null-source refinement path is unreachable.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Assert canonical Evidence integrity diagnostics after borrowing admission,
including the selected side, parameters field and exact nesting bound. Verify
that normal comparison still works afterward and no provider is opened.

Record the six-file diagnostic and lifecycle gate and its resource evidence.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
…osure

Check the actual missing dependency for complete inline comparison sources and
the missing comparison for retained selectors. Both forms recover to complete,
equal Evidence after importing the originating bundle.

Record the affected acceptance workflows and resource measurements.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Retain the original source-owner failure and diagnostics while adding its
schema-declared input path only when absent. Keep owner paths and error identity
intact without another source parse.

Verify compact default HTTP failures, capacity and recovery, resolver ownership,
all ADB CLI cases, and a fresh genuine retained native replay. Record the
unreproduced CI timeout and actual resource evidence without changing its limit.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@gensokyo-dev
gensokyo-dev merged commit a989c0e into main Oct 31, 2026
53 of 55 checks passed
@gensokyo-dev
gensokyo-dev deleted the refactor/evidence-input-contracts branch October 31, 2026 14:45
Entrpi added a commit to Entrpi/rea that referenced this pull request Oct 31, 2026
Upstream morluto#8299 and morluto#8267 declare Evidence inputs once for 20 composition
tools, which covers feat-evidence-source-contract (78da95a) and
feat-evidence-sources-process-managed (31dbe14, which contains it).
Reverse their net patch against 317bf3f (57 files), so main's version
takes their files. Also restore morluto#8015's
managedFieldConstantsComparison.test.ts, which this branch had adapted
to the stack's async executeManagedMemberComparison. No topic uses the
stack's names. Both branches stay on the fork.
coyoteXujie pushed a commit to coyoteXujie/rea that referenced this pull request Nov 2, 2026
Declare logical Evidence sources once and resolve exact retained inputs through
shared application workflows across 20 composition tools. Preserve domain-owned
authentication, source closure, caller choices, coverage and resource admission.

Validation includes public CLI/MCP regressions, local Codex terra/high trials
and fresh-import real-artifact workflows. Measurements, failed attempts and
coverage limits are recorded in docs/verification/evidence-input-composition-2026-10-31.md.

Fixes morluto#8293.
Fixes morluto#8281.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
@morluto morluto added the area: evidence Evidence, artifacts, and reconstruction label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction

Projects

None yet

2 participants