Commit Graph
10327 Commits
Author SHA1 Message Date
Vincent Koc e22bc84894 refactor(ghidra): share the executable file probe (#14573) 2026-11-25 16:43:43 +00:00
Vincent Koc 0f81637e08 refactor(artifacts): reuse carrier ranges and Mach-O field decoding (#14574) 2026-11-25 16:43:29 +00:00
morluto 43cdd264b2 perf(tar): update global PAX map in place after budget accounting (#14580) 2026-11-25 11:41:23 -05:00
morluto ba26a8b644 Merge remote-tracking branch 'origin/main' into worktree-agent-a13528ab5112902c9 2026-11-25 11:40:56 -05:00
morluto e9e7ca7dbd Merge remote-tracking branch 'origin/main' into worktree-agent-a13528ab5112902c9 2026-11-25 11:40:35 -05:00
Vincent Koc 0dd878946a refactor(manifest): share ordered sibling group traversal (#14571) 2026-11-26 00:40:33 +08:00
Vincent Koc 18aec2e763 test(browser): reuse page and Evidence inspection fixtures (#14581) 2026-11-25 16:40:12 +00:00
morluto 400f626e52 Merge remote-tracking branch 'origin/main' into worktree-agent-a13528ab5112902c9 2026-11-25 11:39:36 -05:00
morluto 3280b1a669 ci(apple): run the macOS lane when a pull request changes a macOS-gated test
Pull requests ran the macOS lane only for its listed paths, so a change
to a test gated to macOS never ran it before main's full sweep. The CI
planner runs before dependencies are installed and cannot load the
parser, so a dependency-free candidate test now admits every module
that could gate a test to macOS: one that names a "darwin" or "linux"
literal and has a skipIf/runIf gate or a case list chosen by a
conditional on that literal. The planner selects the lane when a changed
test at head is a candidate, and the exact discovery parses only
candidates, so the two cannot disagree about a gated module. The test
over-selects modules that are not gated; a deleted test selects nothing.
2026-11-25 11:39:33 -05:00
Vincent Koc 5dae66d563 test(cli): use the registered argument schemas directly (#14586) 2026-11-25 16:39:17 +00:00
Vincent Koc 1db0721234 test(bun): share the file-handle read observer (#14577) 2026-11-25 16:38:57 +00:00
Vincent Koc 3bb225c564 test(mcp): share the successful tool assertion (#14576) 2026-11-25 16:37:29 +00:00
Vincent Koc e6a4965084 test(uefi): reuse the driver file across firmware fixtures (#14570) 2026-11-26 00:25:51 +08:00
morluto 123b693f08 feat(delivery)!: bound default results by an agent result budget (#14252)
* feat(delivery)!: bound default results by an agent result budget

Omitted detail now returns complete Evidence only when it fits the new
delivery.agent_result_budget_bytes runtime setting (default 49152 compact
JSON bytes, about 12k tokens at an estimated 4 bytes per token). Larger
results are retained and delivered as the producer's summary with a
limitation naming the budget and the recovery call; nothing is refused or
truncated. inspect_analysis_view gains an evidence-json view that pages the
exact JSON text of retained Evidence. The CLI applies the same budget and
publishes the complete bundle with --evidence_output.

inspect_managed_members type_names now also narrows member_refs and
exported_types, and inspect-byte-entropy gains CLI evidence delivery.

BREAKING CHANGE: An omitted detail no longer always returns complete
Evidence inline on MCP or the CLI for tools with a detail selector
(including inspect_managed_members, inspect_managed_artifact,
inspect_byte_entropy, inspect_artifact, analyze_javascript_application,
list_procedures, list_strings and the other operations listed in
src/domain/agentBudgetOperations.ts). Over the budget they return the
retained summary; pass detail complete (--detail complete) for complete
inline delivery. inspect_managed_members type_names narrows member_refs
and exported_types.

Fixes #14172
Fixes #14180
Part of #14187
Part of #14156

* test(schemas): record advertised summaries for budgeted detail

* fix(delivery): keep budgeted summaries canonical and carry delivery facts beside them

Review fixes for the agent result budget:

- Deliver the producer's own summary record, identical to detail summary,
  so its identity holds in summary consumers such as compare_artifacts.
  The budget, sizes, retention and the exact paging call travel as
  delivery facts: a second MCP text block and _meta, or a delivery field
  in CLI output.
- Capture the caller's detail for application-validated tools too, so
  inspect_binary_layout and similar tools are budgeted.
- Keep recovery facts when a budgeted summary itself exceeds the frame.
- Size an omitted evidence-json limit by escaped UTF-8 bytes and never
  split a surrogate pair, even in a one-unit page.
- Add the REA_AGENT_RESULT_BUDGET_BYTES launch seed; the shared test
  environment raises it for semantic tests, and budget tests clear it.
- Align tool descriptions and verifiers that read complete Evidence.

* fix(delivery): retain the budgeted summary like an explicit summary

* fix(delivery): read the budget seed from the captured environment and count delivery facts in the frame

- The agent result budget seed is read from the environment the server or
  CLI invocation captured: ToolResultDelivery takes it at construction,
  and a CLI invocation binds it in its publication context. The ambient
  process environment is no longer read.
- The frame check reserves the bytes of the delivery block and _meta that
  are added after encoding, so a budgeted response cannot exceed the frame.
- Conformance workflows that resend complete Evidence raise the budget
  through the shared inline-Evidence environment, as do the artifact and
  binary layout verifiers.

* fix(delivery)!: request complete Evidence explicitly and never spill CLI overflow

- Shared test and verifier environments no longer raise the agent result
  budget. Every test and verifier workflow that reads complete Evidence
  from a budgeted tool now requests it with detail complete or --detail
  complete, including the real-provider verifiers outside PR CI (Ghidra,
  Hopper, IDA, Kuna and client verifiers). Default delivery is exercised
  as shipped.
- Budgeting applies only to tools with a detail selector, so every
  budgeted call has a complete opt-out.
- CLI overflow without --evidence_output writes nothing; its delivery
  facts carry exact rerun argv for --detail complete and
  --evidence_output, omitted when the command declares sensitive values.

* test(delivery): prove captured budget seeds with valid in-range values

* test: state complete-detail requests once and fix codemod regressions

- Add tests/support/completeDetail.ts with COMPLETE_DETAIL and
  completeArguments so tests that read complete Evidence request it in one
  place, keeping functions within max-lines-per-function without raising
  the limit.
- Restore provider-client tests (GhidraClient, Hopper health): their
  callTool("name", ...) calls are bridge requests, not MCP tools, and take
  no detail.
- Update the game-scale type inventory test for member_refs narrowing.

* test: request complete Evidence in shared JavaScript analysis helpers and remaining CLI workflows

* test: request complete Evidence by default in the shared test transports

The shared MCP client helpers (createTestMcp, connectLocalToolsMcp and
the CLI fixture's shared MCP session) and the CLI runners (the cli
fixture and the shared CLI session) now apply one named default,
completeEvidenceByDefault. A budgeted tool called with neither detail nor
view gets detail complete; the CLI does the same with --detail complete,
chosen by the command's tool contract. A budgeted operation that resolves
to no contract fails loudly at load. Tests whose subject is delivery opt
out with delivery "budgeted". This is a test-harness choice; production
delivery is unchanged and the budget tests prove the default path.

Per-call complete-detail edits are reverted in the 204 test files whose
transports all apply the default. Explicit requests remain where a test
drives its own SDK client, server, CLI instance or process, and where
the detail choice is the test's subject.

* test: resolve CLI complete-detail defaults from the CLI registry

The Real Apple and browser verifiers read complete Evidence through
artifactCliEvidence, which ran the compiled CLI without a detail choice
and got the budgeted {summary, delivery} output. The helper now requests
complete Evidence for commands that take --detail, read from the compiled
CLI's own registry (scripts/lib/complete-evidence-cli.mjs).

The test harness default had a sibling bug: it treated every cli-flagged
budgeted contract as taking --detail, but only Evidence-delivery commands
do (inspect-binary-layout does not). It now reads the source CLI registry
too, and covers every command the CLI budgets.

* test(verifiers): request complete Evidence at each verifier's SDK client and CLI argv

The real-browser failure was the same missing normalized_result as the
Apple one: browser-capture-metadata-budget-e2e reads analyze-web-bundle
through artifactCliEvidence, fixed in the previous commit.

The shared verifier module, scripts/lib/complete-evidence.mjs, now owns
both transports:
- completeEvidenceClient wraps each verifier's SDK Client once, so every
  callTool to a budgeted tool with neither detail nor view requests
  complete Evidence, whatever local call helper a verifier uses (86
  clients, including the Ghidra, Hopper, IDA and Kuna verifiers'
  argument-less list_procedures and inspect_native_load_image calls).
- completeEvidenceCliArguments covers the remaining verifier CLI argv
  that chose no detail, such as function, decompile, analyze and the
  Android and Apple commands.
Commands and tools that are not budgeted are sent as written.

* test(delivery): await async completeEvidenceCliArguments helper in boundary test

* test(delivery): request complete detail in Electron CLI artifact format test

* docs(delivery): document delivery.rerun as add-only argument arrays

* test(schemas): record advertised summaries for the unified delivery budget

Tool descriptions now name the agent result budget, and the evidence-json default page is derived from the 32 KiB default, which changes the advertised input digests of the 28 affected tools. Recorded from the Build package job's output.

* test(delivery): pin the budget boundary and keep failures unbudgeted

Main's retainedSummaryDelivery tests pinned the size decision at exactly
32,768 and 32,769 UTF-8 JSON bytes. Unifying that decision into
budgetedSummaryBytes deleted them, and their port never landed, so the
byte measurement went unchecked.

Restore them against budgetedSummaryBytes at the configured budget and
one byte over, for the default and a runtime budget, with ASCII, escaped
and multibyte text, plus each condition of the decision. Off-by-one
mutants (< for <=, a cap one byte short) fail six cases; measuring UTF-16
code units instead of UTF-8 bytes fails the multibyte cases.

An MCP case pins that a target failure from a budgeted tool under the
minimum budget is identical with detail omitted and complete, with no
delivery facts.

* test(verifiers): route literal CLI argv for budgeted commands through complete Evidence

real-browser failed with "Scenario CLI did not report external disconnect
ownership": runScenarioCli ran capture-browser-scenario without --detail,
so an over-budget capture came back as its summary, which has no
browser.cleanup. The earlier sweep counted these files as covered
because their MCP clients were wrapped, but their CLI argv was not.

Route the shared runScenarioCli helper (five callers), the local cli
helpers in the module, source-map and script-export verifiers, and
every other literal argv for a budgeted CLI command without --detail or
--view (EVM interface, binary layout, packet capture, devicetree, DOM
destinations, Ghidra relocation symbols, WABT cleanup, Termux browser)
through completeEvidenceCliArguments. A sweep of scripts/ for budgeted
command literals with --json and no detail selection now finds none.

* fix(verifiers): leave clients without callTool unwrapped

The native verifier cleanup test drives native-value-e2e with a connection double whose Client has only connect and close. completeEvidenceClient bound client.callTool unconditionally, so wrapping threw a TypeError before connect ran. That TypeError replaced the primary connection failure the test asserts is preserved, and all four fault cases failed in Test shard 5 and Portable tests. A client without callTool has no tool call to complete, so the helper now returns it unchanged. Locally all five fault modes of the fixture now exit 0.

* fix(delivery): keep the catalog recorder on shipped helpers and expect view-implied summary

The verifier sweep wrapped record-mcp-catalog.mjs in completeEvidenceClient,
which lives in an unshipped helper. deferredRuntime copies only the
package's shipped files plus the recorder, so the recorder failed to load
(ERR_MODULE_NOT_FOUND) and its cleanup recorder never wrote. The recorder
only lists tools and prompts, so the wrapper had no effect; it is removed.

This branch makes a view with no --detail select summary delivery, as MCP
does for a view. Three CLI cases still expected the old view refusal; with
a view alone the missing input is now the summary bundle, so they expect
evidence_output, and a view with --detail complete still refuses the view.

* fix(delivery): request complete Evidence where callers need the whole result

Budgeted delivery made four callers receive a summary they cannot use:

- The GitHub Actions example uploads the analysis as a CI artifact, so it
  now asks for --detail complete; over budget it had saved a summary.
- javascriptIntegrityPolicyCli spawns the CLI itself, outside the test
  harness default, and reads normalized_result; it now applies the same
  completeEvidenceCliArguments default.
- nativeObservationViewsMcp builds its own client to prove complete
  observations overflow into a paging continuation; it now applies the
  harness default so each call asks for complete Evidence.
- The CLI parity goldens are re-recorded for the --detail and
  --evidence_output options the budgeted commands now advertise.

* fix(tests): give processes tests spawn the largest agent result budget

About 90 tests spawn scripts/rea.mjs or a server directly, outside the
harness default that asks for complete Evidence, and read analysis facts
from the result. Over the default budget they received a summary instead;
javascriptChildHandleOwnership failed this way.

The Vitest environment now seeds REA_AGENT_RESULT_BUDGET_BYTES with the
largest accepted value, so a spawned CLI or server delivers complete
Evidence, as the in-process default does. Delivery tests keep their own
budget: agentResultBudgetMcp builds its server without the seed, so its
default-budget cases still exercise the shipped default.

* fix(tests): give budgeted harness tests the shipped agent result budget

The test environment seeds the largest agent result budget so spawned
processes deliver complete Evidence. In-memory servers built by
createApplicationMcpHarness (and connectGhidraMcp, which uses it) inherit
process.env too, so a test that chose testDelivery "budgeted" kept the
seed: the 600-row list_procedures case and the omitted-detail web page
views returned complete Evidence instead of a summary.

testDeliveryEnvironment now owns that choice: a budgeted test's server
environment drops the seed and uses the shipped default. The application
harness applies it to every server it builds.

* fix(tests): expect view-implied summary delivery in the Playwright trace refusal

A view with no --detail now selects summary delivery, so its refusal
names the missing evidence_output bundle; --detail complete still refuses
the view. The trace test still expected a view refusal in both cases.
2026-11-25 11:25:18 -05:00
morluto a2989e6c4b Merge remote-tracking branch 'origin/main' into worktree-agent-a13528ab5112902c9 2026-11-25 11:18:57 -05:00
morluto fa2776d065 ci(apple): discover and run every macOS-gated test on macOS
Tests gated with skipIf/runIf to macOS never ran on the Linux lanes and
only ran on macOS when hand-picked, so they went stale. A small owned
script parses each tracked test with @babel/parser and evaluates its
skipIf/runIf conditions (and platform-conditional for/each case lists)
for linux and darwin with three-valued logic, listing the tests that
are skipped on Linux and may run on macOS. The apple-artifacts job runs
all of them; the hand-picked step keeps only the ungated tests.
2026-11-25 11:18:45 -05:00
morluto a4d9a2412f test(apple): expect path-selected inspect_artifact in resource-only sessions
#14270 made inspect_artifact take an optional path and stop requiring an
open target, so a resource-only session reports it available. The
macOS-only acceptance test still expected target_unsupported. It now
expects inspect_artifact available, inventories the bundle by path in
the resource session, and still expects the target-less call refused.
2026-11-25 11:18:43 -05:00
morluto b7f662bd19 fix(errors)!: keep only changed reader integrity checks retryable
readerIntegrityFailure turned every reader integrity failure into
AnalysisArtifactChangedError, so a session target that no longer matched
its admitted digest (admitted-identity) and other non-change checks were
reported as artifact_changed with retryable true, though an unchanged
retry fails the same comparison every time.

It now consults integrityCheckMeansChanged, the owner of that meaning:
a changed check stays AnalysisArtifactChangedError, and any other check
is an ArtifactOperationError with reason integrity, the reader's
integrity_check and its userMessage as message and recovery.
ArtifactOperationError's operation is widened to the public operation
name so every reader can raise it, with the one classification owner.
Sigrok's recording dialect used its own unconditional changed mapping;
it now uses readerIntegrityFailure too, and also keeps the named check.

Every artifact_changed projection now carries the changed kind's retry
hint, not only the ArtifactOperationError producer.

BREAKING CHANGE: inspect_plist, inspect_apk_signature,
inspect_ntfs_journal, inspect_api_contract, audit_release_exposure,
inspect_web_network_capture, inspect_playwright_trace,
inspect_packet_capture, inspect_packet_fields, inspect_gpu_code_objects,
inspect_model_artifact, inspect_native_dispatch_metadata, inspect_macho,
list_architectures, inspect_sqlite_database, sigrok recording operations,
Android mapping reads and the shared provider classifier report a
non-change integrity check (for example admitted-identity) as
artifact_operation_failed, category integrity_mismatch, retryable false,
with details.reason "integrity" and details.integrity_check, instead of
artifact_changed. artifact_changed errors from AnalysisArtifactChangedError
now include retry "backoff".
2026-11-25 11:18:40 -05:00
Vincent Koc ca70be0feb refactor(javascript): share statement position caching (#14561) 2026-11-26 00:01:15 +08:00
Vincent Koc edca3783ca test(fixtures): share byte digest calculations (#14564) 2026-11-25 16:00:10 +00:00
Vincent Koc 150d6f0e19 refactor(verifiers): share legacy Ghidra snapshot construction (#14566) 2026-11-25 15:59:57 +00:00
Vincent Koc 59b75ecc3e refactor(domain): share first duplicate index lookup (#14560) 2026-11-25 15:55:09 +00:00
Vincent Koc dcce28e284 refactor(providers): share queued close attempts (#14563) 2026-11-25 15:54:04 +00:00
Vincent Koc 2f5dc7b27c refactor(lint): share counted findings reporting (#14558) 2026-11-25 15:53:43 +00:00
Vincent Koc 41bdf03a98 test(browser): share validated inspection comparisons (#14567) 2026-11-25 15:52:17 +00:00
Vincent Koc b89c7ecc05 test(artifacts): share carrier writes across four readers (#14565) 2026-11-25 15:50:57 +00:00
Vincent Koc 9200a2ab5a test(hopper): share the dialog window fixture (#14556) 2026-11-25 15:43:34 +00:00
Vincent Koc 83e7fe789f test(artifacts): reuse temp files in four reader suites (#14559) 2026-11-25 15:33:04 +00:00
Vincent Koc 21a91b5f2a test(native): share Swift reader location and evidence fixtures (#14551) 2026-11-25 15:19:35 +00:00
Vincent Koc 5cd8658643 refactor(domain): reuse ordered map appends in index builders (#14548) 2026-11-25 15:19:22 +00:00
Vincent Koc 15e5b421bf test(sessions): share fixture provider identity construction (#14545) 2026-11-25 15:18:24 +00:00
Vincent Koc 54a02d68c6 test(domain): share absolute path schema cases (#14549) 2026-11-25 15:17:48 +00:00
Vincent Koc 0acafdeafa test(ci): require planner directories in classifier checkouts (#14553) 2026-11-25 15:11:55 +00:00
RRFZ 0cbde34808 fix(gpu): accept non-negative signed MessagePack integer keys in AMDGPU metadata (#14517) 2026-11-25 10:09:13 -05:00
Vincent Koc 1db5c70752 test(lint): share Vitest rule tester setup (#14552) 2026-11-25 15:08:38 +00:00
Vincent Koc e2c092613c perf(ci): limit classifier checkouts to inputs used by the tier (#14546) 2026-11-25 15:06:43 +00:00
Vincent Koc 8835c18c47 test(javascript): reuse semantic graph node and registry fixtures (#14550) 2026-11-25 15:06:38 +00:00
Vincent Koc b6b36947cd test(providers): share deferred artifact finalization setup (#14547) 2026-11-25 15:03:03 +00:00
Vincent Koc 7e12b4f32d test(artifacts): share temporary fixture file writes (#14540)
* test(artifacts): share temporary fixture file writes

* test(artifacts): remove unused fixture imports
2026-11-25 14:53:38 +00:00
Vincent Koc 4f7645af9c build(deps): update rolldown to 1.3.3 (#14536)
* build(deps): update rolldown to 1.3.3

* fix(licenses): verify notices for bundled Rolldown helpers
2026-11-25 14:53:18 +00:00
morluto 59d24c1c17 Merge remote-tracking branch 'origin/main' into HEAD 2026-11-25 09:52:45 -05:00
morluto f1a775bbaf fix(tests): assert the Mach-O file-type refusal's structured facts
#14281 moved dyld_info's file-type refusal onto the TargetFailure model.
The supported forms now appear in the refusal reason, and recovery comes
from the shared target-failure table, so remediation no longer says
"linked Mach-O". The test still pinned that wording and failed on main;
CI did not select it for #14281 or #14416.

It now asserts the facts the model owns: failure_kind unsupported, format
macho, field filetype, retry none, and the reason naming the linked
executables and relocatable objects dyld_info reads.
2026-11-25 09:52:44 -05:00
Vincent Koc 8da1e56277 refactor(web): reuse the shared map list appender (#14531)
refactor(indexes): share ordered map bucket appends
2026-11-25 14:49:42 +00:00
Vincent Koc e5a883e0d9 refactor(readers): share exact admitted range checks (#14544) 2026-11-25 22:47:59 +08:00
Vincent Koc 82c3b2972f test(artifacts): use the native byte stream consumer (#14533) 2026-11-25 09:47:47 -05:00
Vincent Koc e043558082 test(cli): share rendered HTML text extraction (#14534) 2026-11-25 09:47:43 -05:00
Vincent Koc d11eba6295 test(mcp): share address context capacity setup (#14542) 2026-11-25 09:47:36 -05:00
Vincent Koc 2ace7a8d38 refactor(javascript): share one-sided version comparison results (#14539) 2026-11-25 14:47:18 +00:00
Vincent Koc f148353ff1 perf(ci): reuse collected job lists for failure reports (#14537) 2026-11-25 14:46:46 +00:00
Vincent Koc 2f510acf51 test(native): share Mach-O inspection invocation fixtures (#14543) 2026-11-25 14:43:46 +00:00