Commit Graph

1430 Commits

Author SHA1 Message Date
Vincent Koc 567441f50c test(javascript): share application version comparison CLI setup (#15986) 2026-12-02 13:52:05 +00:00
Vincent Koc 9df3dd2fba test(sqlite): share exact schema-name parity assertions (#15877) 2026-12-02 10:28:51 +00:00
Vincent Koc 190fe6275d test(model): share model Evidence view assertions (#15866) 2026-12-02 09:43:57 +00:00
Vincent Koc 0e23515936 test(wasm): share comparison Evidence fixtures (#15847) 2026-12-02 08:36:18 +00:00
Vincent Koc 11e0599256 test(gpu): share kernel report CLI fixture (#15844) 2026-12-02 08:20:45 +00:00
hhang ff188a3d29 fix(artifacts): check packed DDS payload extents (#15731)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
2026-12-02 13:45:02 +08:00
Vincent Koc d8f79e1122 test(setup): reuse Cline setup helpers (#15773) 2026-12-02 04:40:59 +00:00
Vincent Koc 142bc62471 test(protobuf): share HAR record request fixtures (#15767) 2026-12-02 03:41:36 +00:00
Vincent Koc ca0ab102ab test(javascript): share CLI and MCP Evidence checks (#15741) 2026-12-02 02:31:44 +00:00
gensokyo-dev e2fce6bb6c fix(maven): read POMs in their declared XML encoding
The Maven reader decoded every file as strict UTF-8, so an ISO-8859-1 POM
such as Maven's own pom-encoding fixture, or a BOM-marked UTF-16 POM,
failed as "not valid UTF-8". Decode with the shared XML text decoder and
admit ISO-8859-1. A POM that declares an encoding REA does not decode is
now refused as unsupported and names that declaration.

Fixes #15664

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 09:04:06 +08:00
gensokyo-dev 3474dd6716 fix(artifacts): report a DDS with no payload bytes as truncated
Every DDS surface holds at least one texel, so a file that ends at its
payload offset is truncated even when the format's exact size is not
derived, such as planar video formats.

Fixes #15674

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 09:03:56 +08:00
gensokyo-dev ea8b79b362 fix(artifacts): derive the DDS payload size for every fixed-size DXGI format
The DXGI table listed only RGBA32, RGBA16 and RGBA8/BGRA8 formats, so a
DX10 texture in R8_UINT, R16_FLOAT, R32_FLOAT, RG8 and other single- or
two-channel formats had no expected payload size and passed the extent
check even with no pixel data. List every format with a fixed number of
bytes per texel.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 09:03:56 +08:00
Islam Gagiev 78243cb17d fix(artifacts): preserve pre-epoch ar member timestamps (#15502) 2026-12-02 08:48:43 +08:00
Vincent Koc 9006d17aef test(javascript): reuse package fixture file writer (#15701)
* test(javascript): reuse package fixture file writer

* test(javascript): remove unused fixture path imports
2026-12-02 00:42:49 +00:00
morluto 75474075c4 test(settings): fail analysis settings setup steps with the refusal (#15704)
* test(settings): fail analysis settings setup steps with the refusal

Setup MCP calls asserted only `isError` was not true, so a refused
setup step failed as "expected true not to be true" without the
refusal, and several setup calls were not checked at all. They now use
callOk, which fails at that step with the tool's content. Inventory
lookups no longer hide a missing substep or occurrence behind optional
chaining.

* test(settings): keep the fixture's reply checks on setup steps

callOk now also accepts a fixture's call function, so setup steps keep
the output-schema checks connectLocalToolsMcp applies to replies.
2026-12-02 00:40:31 +00:00
morluto 925dce1ded fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget (#15687)
* fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget

Neither tool had a detail input or a summary view, so their complete
Evidence was always delivered inline: about 200-480 KB of CLI JSON for
stock kernel32.dll, shell32.dll and explorer.exe, and over 1 MB over MCP.

Both now follow the inspect_deb_package pattern. With detail omitted,
complete Evidence is returned when it fits the agent result budget, and
otherwise the retained summary with delivery facts; detail complete always
returns everything, and inspect_analysis_view evidence-json pages the
retained record. The CLI gains --detail and --evidence_output.

The imports summary carries image identity, imphash, coverage with DLL
and function counts, issue/limitation counts and one name/function_count/
delay_load row per DLL, bounded to 16 KiB of rows with an omitted count.
The resources summary carries image identity, the resource directory,
coverage, directory/resource/icon-group counts and resource counts by type
and by language, each bounded to 8 KiB of rows with an omitted count.

The byte-bounded leading-prefix rule extract_artifact's summary used is
now byteBoundedList, shared by the three summaries.

BREAKING CHANGE: inspect_pe_imports and inspect_pe_resources output is now
complete Evidence or, when detail is omitted and the Evidence exceeds the
agent result budget, the inspect_analysis_view summary with delivery facts.
Callers that need the complete record inline pass detail "complete"
(CLI --detail complete); otherwise follow delivery.next.

Fixes #15619

* test(pe): cover byte-bounded lists and named resource identities in summaries

* fix(cli): withhold an over-budget summary answer and print its paging facts

The CLI printed {summary, evidence_bundle, delivery} for over-budget Evidence without measuring it, so a summary larger than a smaller configured agent result budget was printed whole. Like MCP since #15591, the CLI now measures that answer and, when it is over the budget, prints the bundle receipt and the delivery facts marked withheld, whose next call pages the saved Evidence.
2026-12-01 19:32:41 -05:00
morluto 941af21c73 test(javascript): fix the deadline phase in the oversized bundle test (#15703)
The test derives a retained-Evidence cap from a baseline run and expects
a second run to record the same failure bytes. With a 1 ms source
deadline the timeout lands before or during the worker launch depending
on host speed; during the launch the failure also keeps the interrupted
ownership inspection, about 7 KB more on macOS. The cap then either
rejects the record or admits the whole bundle, no removal happens and
the marker read fails with ENOENT.

The publication preload can now hold a mkdtemp under a named prefix.
Both runs hold the worker's runtime directory for 20 ms, so the 1 ms
deadline, armed first, always fires before launch.
2026-12-02 00:29:51 +00:00
Vincent Koc 691e089197 test(interface-builder): share app bundle fixture setup (#15695) 2026-12-02 00:12:54 +00:00
morluto 4c3159568c fix(limits): report a limit requirement only when the reader knows it (#15685)
* fix(limits): report a limit requirement only when the reader knows it

OCI image layouts, SWF movies, Zstandard frame walks, LZMA streams without
a declared size, XAR TOCs, cpio archives and VSIX/NuGet metadata members
stopped at the first excess and reported that stopping counter or running
sum as the requirement. Raising the limit to it failed again one step later.

None of those inputs declares a total before the stop, so the refusal now
leaves the requirement unknown. A declared size or count (ZIP member sizes,
the ZIP entry total, SWF FileLength, an LZMA declared size) is still
reported, and VSIX/NuGet now pass every such requirement as required_value
instead of only those above the control's maximum.

Fixes #15647

* test(oci): assert descriptor limits report no requirement
2026-12-02 00:01:47 +00:00
morluto 761dd472b1 test(bun): expect resource_constraint for the Bun module-count admission (#15686)
#15588 reports an artifact read refused by a reader limit as
resource_constraint, but the Bun module-count CLI and MCP tests still
pinned partial through a ternary the sweep missed. Main pushes skip the
portable suite, so they failed only on pull requests.
2026-12-01 23:46:42 +00:00
Vincent Koc caf4550b42 test(python): share pyc code fixture construction (#15652) 2026-12-01 22:38:11 +00:00
morluto 44fbcfc787 feat(evtx)!: page event records with offset and report page facts (#15636)
* feat(evtx): page event records with offset and report page facts

inspect_evtx_archive stopped walking at max_records, so records past the first 20,000 (the newest events of a default-size Application log) could not be listed. The walk now covers every record. max_records stays a 20,000-record page bound, which limits retained Evidence. A new zero-based offset selects the first record listed. The result reports page { offset, limit, returned, total, next_offset }, and the record-limit-reached diagnostic names offset=next_offset. Coverage now describes parse loss only, so a page that leaves records out by selection is no longer partial, and chunk ending facts and endpoint checks cover records past the page.

Fixes #15612

* feat(evtx)!: qualify the file-tail offset for small and wrapped logs

The suggested tail offset is now the larger of 0 and page.total minus max_records, so a log smaller than one page gets a valid offset. File order is oldest first only in a log that has not wrapped; the guide and descriptions now say how chunks[] locates the newest records in a wrapped log.

BREAKING CHANGE: inspect_evtx_archive results now require page. Evidence saved before this change has no page, and inspect_analysis_view refuses to summarise it. Re-run inspect_evtx_archive on the log to produce current Evidence.
2026-12-01 17:15:02 -05:00
Vincent Koc a3a57ef998 test(pyinstaller): share stored PYZ member fixtures (#15643) 2026-12-01 22:13:55 +00:00
morluto efbb66c16a fix(errors)!: report wrong-format, missing-file and missing-Evidence refusals by their cause (#15581)
* fix(errors)!: report wrong-format, missing-file and missing-Evidence refusals by their cause

- inspect_labview_artifact refuses a file with no LabVIEW RSRC data as an
  unrecognized target (code unsupported_target, failure_kind unrecognized),
  as its format siblings do, instead of invalid_request. A PE whose
  resource tree could not be fully read is a malformed PE target.
- inspect_gpu_code_objects, inspect_model_artifact and Apktool reported a
  missing or non-regular selected file through their own copy of the
  selected-file refusal (BinaryTargetError, target_unavailable). They now
  use the shared projectSelectedArtifactFileFailure owner
  (invalid_request, conforming, with its own next step), and the copy is
  removed. The shared owner keeps the verified-symlink recovery the copy
  carried.
- A retained Evidence reference the session does not hold is
  invalid_request / invalid_input instead of evidence_integrity_mismatch.
  Altered or unauthenticated Evidence stays evidence_integrity_mismatch.

BREAKING CHANGE: error codes change for three refusals. A non-LabVIEW
file given to inspect_labview_artifact is unsupported_target (was
invalid_request). A missing or non-regular selected file for
inspect_gpu_code_objects, inspect_model_artifact or Apktool operations is
invalid_request (was target_unavailable). A missing retained Evidence
reference (details.reason "missing") is invalid_request with category
invalid_input (was evidence_integrity_mismatch / integrity_mismatch).
Callers that branch on these codes should match the new values;
details.reason, retry_class and the remediation are unchanged in meaning.

* test(model): expect the shared selected-file refusal for a missing model path

The process-global host read failure test still expected
target_unavailable for path errors on a model file. Those are now the
shared selected-file input refusal.

* fix(resources): name a rejected symlink in the shared selected-file refusal

The GPU and model readers' copy of the selected-file refusal said the
path was a symbolic link; the shared owner reported only ELOOP, so
rejectedSymlinkRecovery failed once they moved to it. Use the rejected
symlink's own message, and keep the errno message for every other
selected-path refusal.

* docs(errors): describe missing references and closure members as the caller's selection

The comment above RESOURCE_SNAPSHOT_NOT_APPLICABLE still said a missing
Evidence reference stays an integrity failure. Missing references,
including retained sources and closure members, are invalid_request; only
altered or unauthenticated Evidence stays an integrity failure.
2026-12-01 17:11:08 -05:00
morluto a5bf175e06 fix(artifacts)!: report reader admission limits as resource_constraint (#15588)
* fix(artifacts)!: report reader admission limits as resource_constraint

An artifact read refused by a reader limit (artifact_limits.*) or a
release-fixed allowance was code partial, which the error contract
reserves for a result cut short by a delivery or decode limit. The
read was refused at admission, so it is now resource_constraint, like
every other admission limit. The retry class is unchanged: change_first
when the limit can be raised, never when it cannot. A limit without
admission facts, such as a parser budget, stays partial.

The reader's own recovery, which names the parameter, its supported
range and the next step, and the reader_limit fact are unchanged.

Refs #15323

BREAKING CHANGE: artifact refusals with details.reason "limit" and a
details.reader_limit or fixed allowance report code and category
resource_constraint instead of partial. Match resource_constraint, or
read details.reason and details.reader_limit, which are unchanged.

* fix(errors): catalogue each artifact admission limit with the retry it returns

The catalogue listed one row for reader limits and fixed allowances with
change_first, though a fixed allowance and a reader limit already at its
maximum return never, and the release-fixed row still said partial.
List the raisable reader limit, the reader limit at its maximum and the
release-fixed allowance as separate rows, and test each row against the
error it projects.
2026-12-01 17:10:56 -05:00
morluto 0f1bedc65a fix(packages): report the declared ZIP entry total in entry-count refusals (#15634)
* fix(packages): report the declared ZIP entry total in entry-count refusals

inspect_vsix_package and inspect_nuget_nupkg reported the stopping counter
(max_entries + 1) as the requirement, so retrying with it failed one entry
later each time. The end-of-central-directory record declares the total
before enumeration; zipDirectoryRecords now carries that total with each
record, and the VSIX, NuGet and artifact ZIP readers report it as the
requirement (artifact_limits.zip.member_count now reports required_value).

inspect_pe_imports said the image "declares" max + 1 descriptors or
functions. Those tables are null-terminated and declare no total, so the
refusal now says the count is above the allowance and leaves the total
unknown.

Refs #15608

* test(zip): cover the ZIP64 entry total in member-count refusals
2026-12-01 16:35:49 -05:00
morluto 3ff4a50481 fix(artifacts/ar): list members recorded under absolute paths (#15631)
lib.exe records the absolute object path it was given, such as
C:\build\Release\decode.obj, as the member name. The ar reader passed
that name to the shared path validator, which rejects absolute names,
so every such member was dropped and a static library built this way
looked empty with unknown coverage.

An absolute member name names a build-host location, not archive
structure. The reader now lists it under its last component, as
`llvm-ar x` writes it, keeps the recorded name in source_path, and adds
one reader-level limitation counting such members. Coverage stays
complete. A last component that is itself unsafe (empty, `.`, `..`)
is still refused and counted as before.

The absolute-name rule now has one owner in ArtifactPaths:
absoluteArtifactPathBasename classifies drive-absolute and POSIX-rooted
names, and normalizeArtifactPath uses it for its refusal.

Fixes #15618
2026-12-01 21:20:51 +00:00
Vincent Koc 980e1ddfd8 test(uefi): reuse NVRAM GUID encoding fixture (#15602) 2026-12-01 20:05:16 +00:00
Vincent Koc ba5d56dcfc test(gpu): reuse CUDA resource fixtures (#15594) 2026-12-01 19:37:23 +00:00
morluto a69837647b test: fix false-pass assertions, consolidate suites, and close coverage gaps (#15519)
* test: fix false-pass assertions, consolidate suites, and close coverage gaps

* test: finish signal-0, unchecked close_binary, and vacuous .every() audit

* test(registration): run shared capture inside test so child inherits scaled deadline

* test(artifacts): bind final verification fault to reader source and post-read phase
2026-12-01 18:10:12 +00:00
morluto fb5b6d4abb test: assert the refusal each MCP, boundary and verifier check expects (#15531)
Replace bare toThrow() across the MCP, CLI and other boundary tests, the
Hopper and fixture conformance verifiers, the evaluation guards and the
process-global tests with the SDK cancellation code and reason, schema
issue paths, tagged error reasons, cleanup facts, errno codes and
verifier messages each case is meant to refuse.
2026-12-01 17:02:41 +00:00
gensokyo-dev 37000bb737 test(api-contract): report only the invalid field when format is omitted
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 01:02:36 +08:00
morluto 6ac87697e7 fix(errors)!: make retry_class the only retry field of a target failure (#15450)
* fix(errors)!: make retry_class the only retry field of a target failure

A target failure reported two retry fields: its own `retry` hint
(`none | backoff | after_change`) and the `retry_class` every error
carries. They mapped one to one, so readers had to reconcile both.
`retry_class` is now the single owner: the target-failure table declares
it directly, the projection no longer emits `retry`, the error schema no
longer accepts it, and the CLI recovery rewrite reads `retry_class`.

BREAKING CHANGE: target failures no longer include `retry`, and the
error schema rejects it. Read `retry_class` instead: `backoff` is
`same_call`, `after_change` is `change_first` and `none` is `never`.

* test(errors): readers reject the removed target-failure retry field
2026-12-01 10:36:15 -05:00
Vincent Koc 9bce30bd20 test(keyed-archive): share XML and bundle fixtures (#15475) 2026-12-01 13:17:25 +00:00
Vincent Koc 123f35749a test(setup): share the test-owned home runner (#15468) 2026-12-01 12:41:12 +00:00
morluto cad578e74a fix(adb): refuse device directories before pulling (#15433)
* fix(adb): refuse device directories before pulling

adb pull copies a directory tree with no byte limit. pull_adb_file accepted
a directory device_path (for example /sdcard), and pull_adb_package accepted
a pm path line naming a directory; adb then pulled the whole tree under the
600 s timeout, the tool reported that the result could not be read back, and
the tree stayed on disk unrecorded.

Both pulls now run the existing test -d probe that push already uses.
pull_adb_file refuses a directory as invalid_request on device_path and
names list_adb_directory; pull_adb_package refuses a pm path directory with
reason directory_device_path before creating output. A probe that cannot
establish the answer fails the call rather than pulling.

Refs #15326

* fix(adb): keep the pm path answer when a directory probe fails

A failed directory probe now retains the completed pm path paths and the
entry being checked as a partial observation, and the pull_adb_file
directory refusal escapes the device path for display.
2026-12-01 01:42:08 -05:00
morluto 91b9999d99 fix(devicetree): keep limit recovery out of the refusal reason (#15443) 2026-12-01 06:30:58 +00:00
morluto 6dae75eae0 fix(model): report a file that is not a model as unrecognized (#15444) 2026-12-01 06:28:37 +00:00
morluto 9b471ab6ca fix(uefi): name the output budget and depth limit that stopped extraction (#15434)
extract_uefi_firmware with an exhausted output budget reported one generic
size-truncated gap per withheld payload (2995 with max_output_files 5),
empty limitations for a whole-image target, and nothing naming the limit.

Each budget gap now starts with the parameter and value that stopped it
(max_output_files or max_output_bytes), and the first limitation states how
many payloads and bytes the budget withheld, which parameter stopped them,
its maximum and how to continue. Depth-limited gaps name max_depth. A target
offset that maps nothing names inspect_uefi_firmware as the way to find valid
offsets.

Refs #15343
2026-12-01 01:11:08 -05:00
morluto bd353e7e5c fix(errors)!: producers declare retry class, refusal recovery and real error codes (#15372)
* fix(errors)!: derive retryable from the producer's declared retry class

`retryable` means the unchanged request may succeed, but it was computed
downstream as an OR of a code table and five class rules. Every error
classification now declares a retry class (same_call, change_first, never,
unknown_outcome); `retryable` is `same_call` after one incomplete-cleanup
check, and the RETRYABLE_CODES table is deleted.

Producer corrections:
- update_unknown revision conflicts are change_first and report
  details.current_revision; duplicate record_unknown reports
  details.existing_unknown_id.
- close_gdb_session's explicit-disposition refusal is change_first.
- Per-call artifact reader limits are change_first (never when the limit
  cannot rise).
- An exited or unreachable Hopper bridge, and a Hopper start that another
  REA session owns, are change_first.
- File-descriptor exhaustion (EMFILE/ENFILE) outside process launch is
  occupied host capacity (same_call) for private workspaces, model and GPU
  readers and JavaScript application reads.
- apktool JVM native-thread exhaustion follows the shared capacity default.

BREAKING CHANGE: these refusals now report `retryable: false` (descriptor
pressure now reports `retryable: true` as `resource_constraint`). Callers
that repeated them unchanged should follow the remediation first: re-read
the unknown and retry with details.current_revision, dispose GDB inferiors,
raise the reported reader limit, or restart the Hopper provider.

* fix(errors): require producers to name recovery for conforming refusals

A refusal whose arguments match the input schema was presented as a schema
error whenever its producer left out remediation, and many producers did.
AnalysisInputError's options are now a union: a conforming refusal must
supply both its outcome (userMessage) and next step (remediationAction),
so the compiler lists every producer; only contract violations may fall
back to the schema guidance.

Producers fixed: unknown Frida session and script, decompile_all
output-directory state, the duplicate unknown build computer factory
(collapsed), stale Cutter sessions, Mach-O architecture selection, output
roots that already exist, selected files the host refuses, Ghidra lookups
the bridge could not resolve, YARA path refusals, unresolved native symbol
names, apt key files and withheld sign-in state. A missing selected APK is
now target_unavailable like every other selected-file reader.

The capability fallback "Choose another analysis or target" is deleted; a
capability refusal without its own recovery names details.reason and
binary_session.

Refs #15312

* fix(errors): classify caller selections and target bytes by their real failure

Several refusals reported a code that reads as corruption or a crash:
- a missing unknown_id and a missing Evidence reference now report
  invalid_request instead of execution_failure and
  evidence_integrity_mismatch;
- close_binary with snapshot_path in a resource-only session reports
  invalid_request instead of evidence_integrity_mismatch;
- ADB push onto an existing device path and pulls into an occupied output
  directory are conforming invalid_request refusals naming overwrite or
  output_directory, not unreadable_output;
- damaged APK ZIP, signing-block, signer and central-directory structures
  are malformed targets, not invalid input;
- NuGet and VSIX bytes without a ZIP signature are unrecognized, not
  malformed;
- a historical source graph file whose entries contradict its root
  commitment is an integrity failure, not invalid input;
- a CDP protocol failure states what happened instead of the unclassified
  fallback message.

Refs #15319

* feat(errors): expose the producer's retry class as retry_class

Every error projection now carries retry_class (same_call, change_first, never or unknown_outcome) beside retryable, which stays true exactly for same_call. The field is additive: the error schema accepts errors retained by earlier releases without it.

Refs #15323

* fix(errors): address review of the folded error-contract PRs

Keep a provider's own capability message as its remediation; the binary_session fallback applies only to a bare declared reason. Delete the unused conformingInputRefusal helper. Compose both retry fields for a refused publication whose cleanup is incomplete. Report descriptor exhaustion from a JavaScript directory opendir as occupied capacity. Let an exited Hopper startup attempt without a setup failure code retry unchanged. Declare retry for the Ghidra superseded checkpoint and unknown IDA readiness. Redact ambiguous selector candidates. Give a Ghidra document miss its own recovery. Drop an unchanged-files claim the journal repair cannot make. Name each withheld sign-in refusal's step. Hash the source graph commitment before the cancellation yield. Keep the browser protocol_error message neutral. Add tests for mutation-audit survivors C3, C5, P2, P4, P8, H1, H4 and H5.

* fix(errors): keep a missing Evidence reference an integrity failure and state only the observed commitment mismatch

* test(desktop): assert the unknown build computer refusal's remediation, not its message

The refusal now carries its next step in remediation.action instead of the message, so the closed-computer checks assert the exact code, message and remediation facts.

* fix(errors): keep producer retry choices apart from cleanup and fixed ceilings

A capture's retryable flag no longer folds in pending cleanup, so the projection applies the cleanup rule once and a transient capture with pending cleanup reports change_first instead of never. A release-fixed artifact allowance reports never, and a stale admitted session identity reports change_first (reopen, then retry); both have catalogue rows. The bare capability-unavailable remediation names binary_session only for a binary-analysis session, so standalone bridges such as Cutter are pointed at their own reason.

* test(vsix): expect a non-ZIP selection to be refused as unrecognized

This PR reports bytes without a ZIP signature as another format (unrecognized), not a damaged package; the exact-reason assertion added on main still expected malformed.

* test(delivery): expect the capacity refusal's retry class in delivered failure facts

The exact failure facts asserted on main predate the projection's retry_class; occupied capacity reports same_call.

* fix(errors): mark a sent Hopper cancellation unknown and missing Evidence recoverable

A cancellation Hopper already received may still apply, so its retry class is unknown_outcome instead of same_call; an unsent cancellation keeps same_call. A missing EvidenceReferenceError is change_first, since importing the referenced records lets the same request succeed; other reference failures stay never. Both have catalogue rows.

* fix(hopper): ask for changed launch arguments before retrying an unencodable launch

A launcher path or argument that cannot be encoded as an AppleScript literal meets the same pre-launch guard on every attempt, so the start refusal is change_first and its retry_action is unknown; a start failure without a declared reason stays same_call.

* fix(errors): keep a one-shot cleanup failure's retry class with its cleanup state

A one-shot reply that reports cleanup_incomplete spread the primary or cleanup projection and overrode only retryable, so a timed-out read whose close also failed carried retry_class same_call. The reply now reads its retry class from the typed composed failure, and never offers the same call before cleanup settles.

* test(evtx): expect an unreadable selected log to be refused with its own recovery

This PR treats a well-formed path the host refused as a regular file as conforming input with its own remediation; the evtx boundary test still expected a schema-recovery refusal.

* test(javascript): expect a broken source-graph commitment as an integrity failure

This PR reports a well-formed historical source graph whose entries disagree with its root_sha256 as evidence_integrity_mismatch, not an input issue; the exact refusal assertion added on main still expected invalid_request.
2026-12-01 05:32:33 +00:00
morluto bdba620af3 fix(mcp): serve input rules agents need within every client's schema budget (#15393)
* test(mcp): check schema parity against the served tools/list

Schema parity tests registered contracts on a bare SDK server, so they
checked a schema REA never serves and missed the compact presentation's
losses (#15310, #15311).

- Add servedToolCatalog, which lists every tools/list page from a session
  server, and use it for parity checks in toolSchemaValidity and
  advertisedDialect.
- Add a catalog-wide test that derives one violating value per
  constrained canonical field from each contract example and requires
  the served schema to reject it or the served description to name the
  rule. Today's gaps are listed by root cause; an entry that stops
  matching fails the test.
- Remove absoluteLocalPathTools.test.ts; the catalog test covers every
  absolute-path field it checked.

Refs #15328

* test(mcp): add a seeded property and visited fields to served parity

- Generate string values for every constrained string field with a fixed
  fast-check seed; the refinement gaps it found (rules in .refine() with
  no served keyword or guidance) are listed with a violating value each.
- Assert the sweep derives violations for root, nested and array
  absolute-path fields.
- Check canonical schema validity against the contract schemas directly
  instead of a bare SDK server, and drop the served-listing test that
  validated canonicalInputSchema.
- Move the reserved environment key check into the compact handler test,
  which now requires the served description to name the rule.
- testing.md: assert parity against the served tools/list.

Refs #15328

* fix(mcp): advertise the absolute-path pattern and dialect-dropped rules

absoluteLocalPathStringSchema serialized as two allOf patterns, and the
dialect projection kept only the first (NUL-free), so every absolute-path
field advertised a schema that accepts relative paths.

- absoluteLocalPathStringSchema emits one pattern: the absolute envelope
  over a NUL-free path. NUL is still refused first with its own message.
- mergeAllOf conjoins exactly what it can: bounds keep the tighter value
  and negated-class patterns become one class. A pattern it cannot
  conjoin is named in tool guidance instead of dropped silently.
- multipleOf, length bounds of 1999 or more and exclusive bounds on
  non-integers become tool guidance, including on nullable values.
- Move the allOf merge into advertisedAllOf.ts.

Fixes #15310
Refs #15328

* fix(mcp): keep defaults, scalar rules, examples and field semantics in compact schemas

Compact input schemas dropped facts an agent needs for a correct first
call: every default, the enums and bounds of reduced root properties, any
example for reduced or pruned schemas, and the Frida cross-field rules.
Name-keyed fallback descriptions also labelled fields of another type.

- Tool guidance names root property defaults in one "Defaults:" sentence.
- A reduced schema keeps the enum, const, pattern and bounds of each
  scalar root property.
- A reduced or depth-pruned schema states its smallest canonical example
  (up to 1,024 bytes), and a pruned schema says nested fields are omitted.
- Frida contracts state each cross-field rule once, as the refusal and
  the root description.
- Fallback descriptions apply only to a property of the JSON type they
  describe; they move to propertyFallbackDescriptions.ts.

Refs #15311
Refs #15328

* test(mcp): validate the served schema in three advertisement tests

compare_artifacts sources, compare_web_captures inputs and the
analyze_javascript_application source selection called a canonical or
bare-server schema advertised. They now validate the served listing;
canonical rejections stay on the contract parser, and the gaps the
reduced form leaves are asserted with a pointer to the parity list.

Refs #15328

* test(mcp): check recovery promises on an agent's first wrong calls

Calls every served tool with generated wrong arguments on a session with
nothing open: an unknown path key, an omitted required field, valid
arguments for an active-target tool, a missing file and an unknown id.
Every refusal must name only advertised tools, name open_binary for an
active-target tool, give no schema remediation to arguments the served
schema accepts, and claim retryable only when an identical replay can
succeed. A seeded property varies the guessed key and missing path.

Known failures are listed by root cause (#15309, #15312, #15323 and the
active-target declarations #15350 removes); a new failure or a stale
entry fails the sweep.

* test(mcp): assert the served schema where tests claimed the advertisement

Five tests validated the canonical schema and called it advertised, so they
asserted rules the served tools/list does not carry: batch_decompile
maxItems, inspect_api_contract format and view, the inspect_dart_aot length
and line-terminator rules, extract_artifact uniqueItems, and examples on
compare_javascript_export_shapes. Each now validates the served schema and
keeps the handler enforcement. A missing rule is pinned as a known gap (in
the parity sweep where it can see the field, or beside the test where the
contract example leaves it unreachable), so the expectation fails once the
rule is served.

The parity sweep now also derives maxItems and uniqueItems violations from
example arrays; it finds inspect_managed_members type_names uniqueItems.
Two value-correct tests are relabelled and check the served schema too.

* fix(mcp): fit every advertised input schema under Codex's 5,000-byte compaction threshold

Codex compacts any MCP input schema above 5,000 serialized bytes and drops
descriptions and nested structure first, so update_analysis_settings
reached the model as a list of empty objects with no setting IDs. Lower the
advertised input budget from 13 KiB to 5,000 bytes, bound $ref expansion
separately so projection and depth pruning are judged on their result,
and advertise update_analysis_settings changes as one object whose setting
enum lists every ID; the canonical parser still enforces each setting's
bounds.

Refs #15339

* fix(mcp): address review findings across the served-schema stack

Keep the recorded description, or its absence, when the deferred runtime
materializes, so discovery and the loaded listing agree. Measure example
guidance in UTF-8 bytes once, resolve defaults through each property's own
reference scope, keep root names and types when scalar rules alone would
overflow the reduced form, and decline joining negated classes that a
literal hyphen could turn into a range.

Served parity now counts guidance only when one sentence labels the field
and states its rule, and counts uniqueItems guidance. That stricter match
exposed seven gaps the loose match hid; they join their root causes, and
the fixed arrayRules gap is removed. The first-contact sweep keys findings
by check, checks a structured next step against the served catalog, and
uses the catalog's own MCP settings.

* chore(mcp): refresh advertised catalog summaries

* fix(paths): keep the NUL path refusal's format reason

Moving the NUL check out of the advertised pattern turned its issue into a
custom refinement, so tool refusals reported reason invalid_value instead
of invalid_format with expected regex. The check now raises the same
format issue, and still stops before the absolute-path rule.

* fix(mcp): state the optional Frida device choice and match bounds by rule

The Frida device rule now says both fields may be omitted for the local
device. Served parity matches a numeric bound by its direction, unit and
complete value, so another bound on the same field cannot cover it.

* test(mcp): stop pinning served-schema omissions in workflow tests

Workflow tests asserted that the served schema accepts values runtime
refuses, so serving a rule would fail them. They keep the valid-input and
runtime-refusal checks; the catalog-wide parity sweep tracks what is
served.

* test(mcp): count a required field only when guidance requires it

A sentence that only mentions a field, or a same-named key under another
parent, no longer covers a missing required rule. Guidance must state the
requirement about the field's full path, or state a shape listing every
required key of the field's parent.

* test(mcp): credit a served rejection only to the rule that failed

The parity sweep counted any served rejection as coverage, so a probe that
also broke another rule (a too-long locale that breaks its pattern) hid a
missing bound. Served validation now reports every failing keyword, and a
rejection covers a rule only when that rule's served keyword fails.
2026-12-01 00:23:37 -05:00
morluto 3bc9cfc379 test(setup): give the aliased Hermes fixture entry a tool timeout (#15416)
Since #15371 Hermes registrations carry a per-server timeout, and doctor reports a missing one as config drift. The uninstall fixture builds its REA entry by hand without one, so its healthy-before-uninstall precondition failed. The entry now sets an hour, longer than REA's recommendation, which setup and doctor keep.
2026-12-01 03:23:18 +00:00
morluto b211f216d8 fix(errors): vsix and pyc limit refusals state recovery from the measured requirement (#15407)
* fix(errors): let the typed limit refusal state recovery, with the measured requirement

A resource constraint with a typed adjustable limit now takes its recovery from the shared refusal owner, which compares the measured requirement with the control's maximum, instead of producer prose. The VSIX and pyc providers drop their hand-built "raise X up to MAX" text. pyc string and key limits report the size the parser measured; VSIX reports its early-stop lower bound only when it already exceeds the control's maximum.

Refs #15325

* fix(python): report an integer key's limit without a byte requirement it did not measure

* fix(errors): keep producer-authored recovery precedence; vsix and pyc state only typed facts

The global precedence change hid multi-control advice (V8) and producer-measured requirements kept in prose (Maven/Gradle). The VSIX and pyc producers no longer author prose for a single-control limit, so the shared typed recovery applies to them without changing other producers.
2026-12-01 02:30:52 +00:00
morluto c7fa6af8a3 test: fail loudly on setup refusals and assert exact MCP refusal and linkage facts (#15368)
* test(mcp): assert exact refusal, identity and Evidence linkage facts

Replace isError-only, expect.any and oracle-mirror checks in MCP and CLI workflow tests with the exact code, reason, subject identity and Evidence links the producers report. The capability-unavailable unknowns test now opens its target, so it exercises the path it names instead of NoBinaryOpenError.

* test: fail loudly on setup refusals, unrecorded paths and zombie liveness

Three shared helpers remove weakness classes from the suite:

- callOk (tests/support/mcp/toolResult.ts) fails at the setup step when a
  tool used as fixture setup refuses. It replaces the build-computer copy
  and the unchecked open_binary calls. serverUnknownsMcp's
  capability-unavailable test passed only because open_binary failed: its
  fixture refused health, and NoBinaryOpenError has the same "unavailable"
  category. The fixture now answers health, and the test asserts
  capability_unavailable for procedure_pseudo_code.
- expectRemoved (tests/support/expectRemoved.ts) throws when no path was
  recorded; access(list[0] ?? "") passed because "" is also ENOENT.
- expectProcessRunning checks ps state instead of signal 0, which still
  reaches a zombie that REA wrongly signalled.

Also asserts the open target before and after an ordinary close, the
written overwrite snapshot, and the comparison's links, status and
supporting unknown.

* test(mcp): compare delivered recovery with its owning projection
2026-12-01 02:26:44 +00:00
morluto 089dfa3a8b fix(setup): derive client deadlines from one record per client (#15371)
* fix(setup): derive client deadlines from one record per client

Each supported client definition now declares the MCP deadlines it applies
to REA's server: key, unit, built-in default, maximum, coverage and whether
progress resets it. Setup raises a shorter or missing deadline to REA's
recommendation within the client's maximum and keeps a longer one; doctor
reports the same shortfall from the same record. Cline, Zed, Antigravity,
Hermes, Goose and Gemini CLI gain deadlines; the codex/kimi/grok/dsh name
branches, the Goose timeout literal and the per-client startup constants
are removed.

Refs #15337

* fix(setup): keep a raised Goose timeout over a short inherited one and expect Antigravity's deadline
2026-12-01 01:48:59 +00:00
Beqa 4b19f283d3 fix(setup): own REA scripts when the registered Node path is gone (#15281)
* fix(setup): own REA scripts when the registered Node path is gone

When a saved node/script/mcp launcher pointed at a missing interpreter,
ownership stayed unknown and setup refused to refresh after nvm/fnm moved
Node. Check the script whenever a current entrypoint is available, not only
when the interpreter path still resolves as a foreign binary.

Fixes #15024

* fix(setup): own vanished Node only for verified rea-agents scripts

Narrow the missing-interpreter path: keep a disappeared runtime unknown
unless its basename is node/bun and the script verifies as an installed
rea-agents package. Preserve the existing foreign-runtime script check
and the maintainer invariant that a matching non-package script stays
unknown after the executable vanishes.

Merge upstream/main for ownedPackageCommand OpenCode fixtures.
2026-12-01 02:57:17 +08:00
ShuaixinHuang e8419acaf5 fix(javascript): explain relation omissions at semantic node ceilings (#15295) 2026-12-01 02:51:17 +08:00
Ysopwnable b3cf255894 test(setup): remove PATH assumptions from launcher fixtures (#15282)
Use a shared package-owned launcher in setup and uninstall fixtures.
Exercise publication, recovery, and policy under an isolated PATH.

Follow-up to #15046.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-01 01:44:05 +08:00
Ysopwnable ea2db355a5 test(setup): declare ownership in Hermes CLI fixtures (#15277)
Give Hermes YAML preservation and policy fixtures a launcher with
explicit REA ownership. Cover setup on CI runners without an installed
bare rea command on PATH.

Follow-up to #15046.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-01 01:25:14 +08:00
Ysopwnable a8fa92107c test(setup): cover shared Copilot CLI project configuration (#15275)
Exercise owned Copilot CLI removal and backup in the shared project
MCP file. Assert the winning Mastra Code registration in doctor when
multiple clients report the same shared file.

Follow-up to #15230.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-01 01:07:54 +08:00