Commit Graph
10479 Commits
Author SHA1 Message Date
Vincent Koc da129c00a3 test(artifacts): reuse temporary files in Android reader fixtures (#14750) 2026-11-26 15:26:08 +00:00
Lewis WangandClaude Opus 5.5 94c1c6aec0 fix(native): decode Objective-C categories that Swift lists in __objc_catlist2 (#14025)
* fix(native): decode Objective-C categories that Swift lists in __objc_catlist2

Swift lists categories on a class it reaches through a Swift class stub
in __objc_catlist2, and the Objective-C runtime loads that list like
__objc_catlist. inspect_native_dispatch_metadata read only __objc_catlist,
so these categories, their methods and protocols were missing while
objc_properties_categories coverage reported complete.

Read both lists. A stub's first word is a plain value from 1 to 15, as
the runtime's isStubClass checks, and it holds no class_t, so a category
whose class reference is a stub keeps a null class and coverage names
the reference instead of reading unrelated bytes as a class name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(native): version the dispatch reader profile for __objc_catlist2 categories

Reading __objc_catlist2 changes inspect_native_dispatch_metadata results,
but the reader still declared apple-metadata-reader-4, so a snapshot saved
before this change matched the current profile and replayed its empty,
complete category result. Declare reader version and revision 5 so those
snapshots are refused with a binding mismatch and the image is read again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 10:25:48 -05:00
RRFZ d5b4c4bb61 fix(verify): bound concurrent file reads in architecture and limit guards (#14720)
* fix(verify): bound concurrent file reads in architecture and limit guards

`scripts/verify/architecture-guards.mjs` reads every `.ts`, `.mts`, `.mjs`,
and `.py` file under `src/`, `tests/`, `scripts/`, and `bridge/` (8,203 files
on current `main`) via unbounded `Promise.all(paths.map(readFile))`. On
Windows, queuing all `open()` calls at once exceeds the UCRT 8,192 file
descriptor ceiling and deterministically fails `npm run verify:architecture-guards`,
`npm run check:fast`, and the pre-push hook with `EMFILE: too many open files`.

Add a zero-dependency JSDoc-typed `mapWithConcurrency` helper in
`scripts/verify/bounded-file-reads.mjs` (default cap 64, registered in
`tsconfig.scripts.json` so it runs before `npm ci`), apply it across all four
bulk `readFile` loops in `scripts/verify/architecture-guards.mjs` and the
sibling `src/` scan in `scripts/verify/rea-numeric-limits.mjs`, and add unit
coverage in `tests/evaluation/boundedFileReads.test.ts`.

* test(verify): copy bounded-file-reads helper in numericLimitGuardPermission fixture

`scripts/verify/rea-numeric-limits.mjs` now imports
`./bounded-file-reads.mjs`. Copy both scripts into the temporary checkout
in `tests/boundary/process/numericLimitGuardPermission.test.ts` so the
copied verifier starts cleanly on non-root Linux/macOS runs instead of
failing with `ERR_MODULE_NOT_FOUND`.
2026-11-26 23:25:32 +08:00
RRFZ 5a283a5f87 fix(native): resolve Objective-C protocol _classProperties via pointer fixups (#14283)
Resolve a protocol_t `_classProperties` slot through `resolvePointer`
instead of `read.pointer(...) !== 0n`, sharing the undecoded class-property
slot check in `AppleObjcProperties.ts` with `AppleObjcCategories.ts`.
A bound slot now counts as present and undecoded, and an unreadable or
unknown-fixup zero slot keeps the protocol record and coverage partial
rather than treating the list as absent.
2026-11-26 10:24:35 -05:00
RRFZ 83c4c34de8 fix(har): fall back to postData.params when postData.text is empty or unreadable (#14256) 2026-11-26 10:22:28 -05:00
RRFZ 00939f9bd2 fix(firmware): mark ESP flash coverage unknown when bootloader region is omitted (#14285)
When planEspFlashLayout locates a bootloader whose flash address is at or
after the selected partition table, it omits the bootloader region and
records a limitation. finishEspFlashLayout previously checked only
plan.input.bootloader === undefined, so a dump whose partitions covered
the rest of the image could still report coverage: "complete".

Check whether a bootloader region was actually placed in plan.regions
instead of re-deriving presence from plan.input.bootloader, matching
EspFlashImageArtifactReader. Update docs/esp-flash-image.md and add unit,
reader, and CLI regressions.
2026-11-26 10:22:05 -05:00
Anurag SinghandAnurag Singh 80c17a88f5 fix(artifacts): keep boot image coverage unknown when layout bytes are not exposed (#14370)
* fix(artifacts): keep boot image coverage unknown when layout bytes are not exposed

Android boot and vendor_boot inventories reported complete coverage while
a limitation said declared layout bytes were not exposed as children: a
vendor_boot v4 section without table entries, table entries that cover
only part of the section, and bytes between the sequential layout and a
v1/v2 recovery_dtbo. The same section bytes already left coverage unknown
when the vendor table failed to parse.

The header and vendor table parsers now report unexposed bytes as typed
facts (unexposedLayoutBytes, unexposedSectionBytes) next to the existing
limitations, and the reader derives coverage from them instead of from
the parse-failure flags alone. The legacy tail's facts are named as the
parse fields they become and are spread into the parse result.

Fixes #14369

* docs(artifacts): separate boot image metadata ranges from children in the coverage rule

---------

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>
2026-11-26 10:21:24 -05:00
ShuaixinHuangandShuaixinHuang b06adc4b49 fix(apple): preserve unknown CPU subtype in dylib selection (#14706)
* fix(apple): preserve unknown CPU subtype in dylib resolution

* chore: remove unused internal LZMA request type

* chore: mark partial module AST visitor switch explicitly

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
2026-11-26 10:21:18 -05:00
Vincent Koc e42341d84b refactor(javascript): share the artifact reconstruction cancellation check (#14732) 2026-11-26 23:17:59 +08:00
Vincent Koc 10502f8fa1 fix(environment): release abort listeners when waits settle (#14730) 2026-11-26 23:17:42 +08:00
Vincent Koc f9d674e748 fix(views): validate retained web source metadata against producer rules (#14729) 2026-11-26 15:11:33 +00:00
Leo Camus b4fd7f7b8c fix(tar): read pax values that hdrcharset=BINARY leaves as raw bytes (#14632)
* fix(tar): read pax values that hdrcharset=BINARY leaves as raw bytes

A pax extended header may declare hdrcharset=BINARY, and then its path,
linkpath, uname and gname values are raw bytes rather than UTF-8 (POSIX
pax, "hdrcharset"). Python tarfile and libarchive write exactly this for
a file name that is not UTF-8. parsePaxRecords refused every non-UTF-8
value, so the walk stopped as malformed at that header and no member
from it on was inventoried.

Under hdrcharset=BINARY those four values are now decoded as Latin-1,
with a limitation giving the raw bytes, as header names already are.
Any other non-UTF-8 value still stops the walk.

* fix(tar): charge hdrcharset=BINARY warnings to the metadata allowance

Each Latin-1 warning carries the raw value in hex, twice its size, and a
repeated global header appends a new one while a same-sized replacement
leaves the global map charge unchanged. Charge every warning to
artifact_limits.tar.metadata_bytes before building it.

* fix(tar): refund hdrcharset=BINARY warnings no member keeps

A local pax header's warnings were charged to
artifact_limits.tar.metadata_bytes but never refunded when they were
discarded: by the next local header that replaces them, or by an omitted
member or the archive root, which do not keep them. Repeated binary owner
names on omitted members could exhaust the allowance while the retained
data fit. Refund the charge whenever the warnings are dropped.
2026-11-26 10:11:28 -05:00
Vincent Koc b343218357 test(filesystem): release the lease after simulated device changes (#14731) 2026-11-26 15:07:51 +00:00
Vincent Koc 1f262f5d13 refactor(parsers): share typed failure handling for Android and ISO images (#14719) 2026-11-26 22:59:27 +08:00
Vincent Koc 7ffa72ee59 test(cli): share command results across fresh and shared processes (#14718) 2026-11-26 22:59:12 +08:00
ASHISH PATIL 65311cff1e fix(setup): normalize win32 paths and trailing backslashes in fxLocation (#14725) 2026-11-26 14:58:47 +00:00
gensokyo-devandgensokyo-dev f781e31091 ci: fit the binary layout toolchain download into three attempts
Each hosted APT download attempt now has its own deadline, so the
900-second budget would let three attempts outlast the 25-minute job.
Give each attempt 360 seconds: a resumed second attempt still covers the
slowest observed cold download (657 seconds), and the test asserts that
three attempts leave the job five minutes to build and verify fixtures.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 22:53:06 +08:00
gensokyo-devandgensokyo-dev 1919f7ef67 ci: retry transient failures of pinned release downloads
curl --retry covers only timeouts and a few HTTP statuses, so a
connection reset mid-transfer failed the Ghidra SDK acquisition outright.
Retry every transient error for the pinned downloads, as the web network
capture lane already does; each archive is still checked against its
pinned SHA-256 before use.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 22:53:06 +08:00
gensokyo-devandgensokyo-dev d87c365950 ci: resume hosted APT package downloads across bounded attempts
A slow archive connection can still be progressing when the single
download deadline expires, failing the Windows native controls lane
while MinGW archives were mid-transfer. Download within three bounded
attempts instead; APT keeps completed archives and resumes partial ones,
so a later attempt reconnects and continues. Installation still runs
only from the local cache after a successful download.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 22:53:06 +08:00
192177f0c9 feat(artifacts): inventory and expand Android sparse images offline (#13244)
* feat(artifacts): inventory and expand Android sparse images offline

* chore(schemas): update artifact tool schema summaries for the sparse image limit

* fix(artifacts): retire undrained sparse image streams on cancellation

* fix(artifacts): keep large RAW reads in the sparse stream's owner

A large RAW run was streamed through a nested readFileHandleChunks
Readable, which could prefetch a descriptor read while the outer
iterator was idle, so close or cancellation could retire the stream
with that read still running. Read the run directly in the expansion
iterator so every read is pending in the owner that cancellation waits
on, and add held-read close and cancellation regressions.

* fix(firmware): drop unused ANDROID_SPARSE_MAGIC_BYTES export

* test(artifacts): release held sparse reads before restoring mocks

Release the held RAW read and join the retiring close or cancellation in
finally before restoring the read spy, so a failed assertion cannot leave
reader.close() waiting on a read nobody will finish. Use
awaitAcknowledgement for the held-read start barrier and drop the
per-test five-second timeouts in favor of the shared test deadlines.

* fix(lint): register sparse-image forwarded fixed ceiling

Upstream main added the fixed-ceiling registry check. The sparse-image
reader projects the parser's own named ceiling, so register it as
forwarding like the boot-image reader.

* Address review feedback

* test(android-sparse): expect partial code for chunk budget refusal

* test(android-sparse): expect partial code in MCP chunk budget refusal

* fix(artifacts): keep the chunk_sz offset when a RAW chunk outgrows its header

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
2026-11-26 21:16:57 +08:00
Vincent Koc 0771d11c7f test(fixtures): share literal-only LZ4 blocks across fixture builders (#14696) 2026-11-26 20:57:23 +08:00
Anurag SinghandAnurag Singh e314337129 fix(artifacts): read the next tar header after header-only members (#14500)
* fix(artifacts): read the next tar header after header-only members

POSIX ustar stores no data blocks for symbolic links, devices,
directories and FIFOs, and a directory's size field may be nonzero by
design. The tar walk skipped the declared size after every header, so
such a header hid the members that followed. When the skipped span
landed on a later header, those members were missing while coverage
stayed complete. Otherwise the walk stopped as malformed.

The stored data length now comes from the header's type, through the
same directory rule that classifies members. Hard links keep their
declared size, because pax interchange archives may store a body.

Fixes #14497

* test(artifacts): cover pax and long-name sizes on header-only tar members

---------

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>
2026-11-26 20:57:18 +08:00
Vincent Koc dde8a9db05 refactor(android): share boot image parser layout types (#14695) 2026-11-26 20:57:08 +08:00
gensokyo-devandgensokyo-dev 402771122c docs(android): describe budgeted delivery and the class and reference views
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev e731ca7bbe feat(android)!: count components in package summaries
The inspect_android_package summary kept every component declaration.
On VLC 3.7.2 its 60 components made the summary 62,118 bytes, above the
agent result budget it was delivered for, although the component-summary
and components facets already page and count them.

The summary's components now carry the component status, limitations and
counts by kind, exported declaration, exported default and declaration
coverage, computed by the same helper as the component-summary facet.
Component rows page through the components facet.

With real JADX on VLC the package summary was 6,280 bytes.

BREAKING CHANGE: the inspect_android_package summary no longer lists
component declarations. Page them with view {kind: "android", facet:
"components"}, or pass detail: "complete".

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev 5257f40ffb feat(android)!: count class members in summaries and page them
The inspect_android_class summary was the complete normalized class: on
VLC's org.videolan.vlc.PlaybackService, with 302 methods, it was 70,266
bytes, twice the agent result budget it was delivered for. Claude Code
saved it to a file, and REA-only agents read the class back through about
five evidence-json pages.

The class summary now carries the class name, engine, counts of methods,
constructors, overloaded method names, fields, encoded static values and
inner classes, the overloaded method names with their overload counts,
and the mapping's identity and record counts. The android-class view pages
methods (exact names, name prefixes, constructors), fields (exact names,
name prefixes, static values), inner classes and mapping symbols, and
inspect_android_class accepts it with detail summary in the same call.
Method summaries are unchanged and keep their own projector.

With real JADX on VLC the class summary was 4,601 bytes.

BREAKING CHANGE: the inspect_android_class summary, delivered for detail
summary or above the agent result budget, no longer lists methods, fields,
inner classes or mapping symbols. Page them with the android-class view,
or pass detail: "complete".

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev 32280113a7 feat(android)!: budget trace_android_references delivery
trace_android_references returned every using node inline. On VLC's
org.videolan.vlc.PlaybackService the MCP result was 214,955 bytes, so
Claude Code saved it to a file a REA-only agent could not read, and
inspect_analysis_view did not support the operation. In two trials asking
which outer classes reference the class, Claude Code answered nothing
after 17 to 20 calls and about 870,000 tokens.

trace_android_references now takes detail and view and joins the agent
result budget. Omitted, a trace that fits delivery.agent_result_budget_bytes
is inline and a larger one is retained behind its summary. With detail
summary, view returns one android-references page in the same call. The
CLI uses the shared Evidence delivery with --view.

With real JADX on VLC the default reply was 5,987 bytes, and the
top-classes page of all 97 top classes 16,724 bytes. In two trials each,
Claude Code then answered correctly with 92,000 to 125,000 tokens, and
Codex with 208,000 to 217,000 tokens instead of 364,000 to 408,000.

BREAKING CHANGE: a trace_android_references call that omits detail on a
trace above the agent result budget now returns the retained summary.
Pass detail: "complete" (--detail complete) for the previous shape.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev c0f1bc6a6d feat(analysis-view): page retained Android reference traces
A retained trace_android_references result could only be read back
whole. It lists every using node, so on VLC's PlaybackService it was
76 KB of normalized result beside a 140 KB raw provider reply.

The android-references view pages one retained trace. Facet top-classes
lists distinct top classes with their package and using-node count,
sorted by name; facet references lists using nodes with their index and
only the selected fields. Both filter by exact kinds, packages (the top
class's name before its last dot) and top classes, and every page carries
the trace target, total and direct-invoke coverage.

The summary keeps the target, total and coverage, and counts using nodes
by kind, top class and package, with the 32 most referenced packages.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev 3ffbf5dea0 docs(apktool): describe decode delivery and resource views
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev a16facbd9f feat(apktool)!: budget decode_android_resources delivery
decode_android_resources returned the complete decode inline. Claude Code
saves an MCP result above about 25,000 tokens to a file, so on VLC 3.7.2
(180,996 bytes) a Claude Code agent limited to REA tools never saw the
strings: in two trials it failed every answer after 20 or more calls and
about 900,000 tokens. Even string_limit 1 returned 77 KB, because the
manifest text is always inline.

decode_android_resources now takes detail and joins the agent result
budget. Omitted, a decode that fits delivery.agent_result_budget_bytes is
inline and a larger one is retained behind its summary. With detail
summary, view returns one android-resources page in the same call, so the
German and Japanese values of one string take one call. The CLI uses the
shared Evidence delivery with --view.

On VLC with real Apktool 3.0.3 the default reply was 3,368 bytes, and the
two-locale strings page 2,695 bytes.

BREAKING CHANGE: a decode_android_resources call that omits detail on a
decode above the agent result budget now returns the retained summary.
Pass detail: "complete" (--detail complete) for the previous shape.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
gensokyo-devandgensokyo-dev 8ce5c00a6e feat(analysis-view): page retained Apktool resource decodes
A retained decode_android_resources result could only be read back whole.
It carries the full manifest text and every returned string, so on VLC
3.7.2 it was 180,996 bytes.

The android-resources view pages one retained decode. Facet strings lists
{locale, name, value} rows across the decoded tables, selected by locales
(null is the default table) and matched by exact names or name prefixes;
coverage.total counts every match, and each page carries the selected
tables' own counts, pages and coverage. A locale the decode did not return
is refused with the decoded tables named. Facet manifest pages the manifest
text by UTF-16 offset.

Pages stop at the analysis-view page bytes through a shared
selectByteBoundedViewRows: a row that does not fit ends the page with
byte_limited and next_offset after the last returned row, and a row that
cannot fit alone is refused naming the retained parent. Unfiltered pages
visit only their own rows, and the flattened string rows are built once
per retained decode. A decode recorded with include_strings false refuses
the strings facet instead of reporting an empty table.

The summary keeps the client, target, metadata, locales, decoded file
count and coverage, each table's counts and page without its strings, and
the manifest length without its text.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-26 19:56:07 +08:00
Saim ShafiqueandVincent Koc aa78851b85 fix(browser): return completed scenario capture when cleanup is unconfirmed (#6381)
* fix(browser): return completed scenario capture when cleanup is unconfirmed

When every scenario action completed but session cleanup timed out or
failed, capture_browser_scenario reported a hard cleanup_incomplete
failure and retained the finished observation only as a raw partial
with no evidence_id, so the caller lost a result that had succeeded.

Model capture and cleanup separately: the capture schema now admits
cleanup "incomplete" for a completed capture, and the Playwright
provider returns the completed capture in that case, with the cleanup
reason and the resources that may remain reported as a limitation.
The cleanup lease stays retained, so provider close and the next
capture still retry and surface unconfirmed cleanup. Captures whose
operation failed keep the existing cleanup error and partial
observation behavior.

Fixes #6166

Co-authored-by: Saim Shafique <128062316+sx4im@users.noreply.github.com>

* test(browser): update the retained-cleanup CLI test for the completed-capture behavior

When every action completed but cleanup is unconfirmed, the one-shot CLI
now returns the completed capture as Evidence instead of failing with
cleanup_incomplete and exit 1. The retained-cleanup test still asserts the
retry (provider close once, browser close retried, profile removed once)
but now expects the success output: the capture with browser.cleanup
"incomplete", both steps completed, and the unconfirmed-cleanup limitation.

* fix(browser): preserve typed cleanup failure reasons

* test(browser): model capture finalization in session mock

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 19:04:14 +08:00
0053ad589c fix(ghidra): pass inspected JDK to the Windows verifier (#10752)
* fix(ghidra): resolve bare java command against PATH on Windows

The Windows owned-process launcher requires absolute executable paths and
rejects bare names (ERR_REA_WINDOWS_NATIVE, Win32 87). When JAVA_HOME is
unset, ghidraJavaLaunch handed the bare "java.exe" to that launcher, so the
documented remediation ("a 64-bit full JDK 21 or newer on PATH") could never
work on Windows even with Java on PATH.

Resolve the bare command against PATH (Path/PATH, join + existsSync) before
spawning; if no candidate is found, keep the bare name so the existing
probe-failure diagnostics stay unchanged. POSIX behavior is unchanged.

Reproduction: Node 24 / Windows 11 x64, Ghidra 12.1.2, JDK 21 on PATH
(via javapath shim), no JAVA_HOME -> provider unavailable,
java_probe_failure ERR_REA_WINDOWS_NATIVE. Setting JAVA_HOME to an absolute
JDK root makes the provider available, confirming the launch path.

* fix(ghidra): resolve PATH java for inspection and harden the resolver

- resolve java.exe for installation inspection on win32: the provider-
  availability decision comes from the inspection probe, which still sent
  the bare name to the Windows owned-process launcher after the launch-path
  fix (Greptile P1)
- unwrap quoted PATH entries so installer-written directories resolve
  (XiaoBinGan Gap 1)
- throw GhidraAdmissionError java_command_unresolved with the searched
  PATH instead of silently falling back to the bare name on the launch path
  (XiaoBinGan Gap 2); an already-aborted caller keeps its cancellation
- extract the shared resolver into GhidraJavaPathResolution.ts
- add subprocess-free regression tests: inspection through a quoted Path
  entry, bare-fallback parity when java.exe is absent, resolver unit cases,
  and the launch rejection code

* test(ghidra): translate win32 fixture paths for POSIX hosts

The win32 platform option makes appendCallerPath join with backslashes
(win32.join), so the inspection tests' host readText/executable received
backslash-separated paths that only resolve on Windows. Translate the
separator back to the host's before touching the real filesystem; fixture
directories contain no literal backslashes and Windows accepts forward
slashes, so the translation is safe on both (greptile review finding).

* fix(ghidra): parse Windows PATH through the executable search owner

GhidraJavaPathResolution split PATH on every semicolon, so a quoted entry
such as "C:\Tools;Local\jdk\bin" became two candidates and the installation
inspection missed java.exe. The environment variable lookup was also
case-sensitive.

Reuse windowsPathCandidates, which preserves quoted entries, matches
environment names without case, and keeps relative entries out of the
absolute-only selection. The launch diagnostic now reads the same normalized
snapshot. Add a regression test for a quoted entry containing a semicolon.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

---------

Co-authored-by: Z <Z@example.com>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 19:01:13 +08:00
a00511e88e fix(mcp): paginate tools/list under the FastMCP SSE limit (#9142)
* fix(mcp): paginate tools/list under the FastMCP SSE limit

Unsloth's FastMCP client rejects the single tools/list event because the full 241-tool catalog serializes to about 4.2 MB, over its 1 MiB SSE cap, so every refresh fails. The MCP SDK returns the whole catalog with no nextCursor, and the server never handled the cursor at all.

Page oversized listings at the transport seam, per the MCP cursor contract: pages stay under 896 KiB, cursors are bound to the catalog snapshot, and catalogs that fit are returned in one response as before.

* fix(mcp): track pending tools/list requests in one map

pendingToolListCursors already held every tools/list id, including
requests without a cursor. Membership, cancellation, and cleanup now
use that map.

Cursor rejection tests assert JSON-RPC -32602, then a cursorless
listing returns the complete current catalog.

* fix(mcp): count one schema discovery per tools/list pagination

The paged tools/list turns one logical discovery into several wire
requests, which broke the artifact verifier probe's per-request
counting and its duplicate injection assumed the target tool on the
first page. Count one discovery per listTools call and inject the
duplicate only on the page carrying the tool.

* fix(mcp): bind tools/list cursors to full tool definitions

A cursor digest now covers each advertised tool, so a schema change
invalidates it. One tool larger than REA_MCP_TOOLS_LIST_PAGE_BYTES
fails with a resource_constraint error instead of a successful page.

* test(doctor): keep the configuration table within its line limit

The page-budget refusal stays covered by the setting parser tests.

* fix(mcp): honor the tools/list page budget on the stdio path and register the setting

Register REA_MCP_TOOLS_LIST_PAGE_BYTES in the numeric limit registry and
the limit inventory so the numeric limit check passes.

Carry the parsed page budget from AppConfig into DeferredEvidenceMcpServer
so the default stdio startup path honors the setting instead of always
using the 917504-byte default.

Harden the page budget parser tests to surface the parse error instead of
returning early on failure.

* fix(mcp): return a fitting final tools/list page and use the parsed page budget

verifiedPage returns the remaining tools as one final page without a
cursor when they fit, instead of failing a resumed listing whose first
tool plus a cursor exceeds the budget.

parseConfig builds the page budget from parseEnvironment's admitted
number instead of re-parsing the raw environment, and the now-unused
resolveMcpToolsListPageBudget helper is removed.

* fix(mcp): use shared isRecord in tools/list pagination

Static checks flagged the local record predicate in toolListPagination.ts:
import the shared isRecord from src/domain/isRecord.ts instead.

The numeric-limit registry test still expected 15 entries after the
REA_MCP_TOOLS_LIST_PAGE_BYTES entry was added; bump it to 16.

* test(mcp): page tools/list fixtures under explicit small budgets

The compact-only presentation strips field descriptions before advertising, so the 80-tool catalog fits one page and the oversized tool fits too. Set explicit small page budgets against the advertised size. The parseConfig success test now throws the typed error before reading the value, per the test guide.

* test(config): throw typed parse errors in tools/list budget test

Greptile P2 on #9142: the budget test checked the selected parse via
an inline toMatchObject on the Result, hiding the typed error on
failure. Bind both parse results and throw their errors before
asserting values, per the repo test guide.

* fix(mcp): format tools/list pagination test to repo style

oxfmt --check flagged src/server/toolListPagination.test.ts
(the cursor-identity expectation was written expanded; oxfmt
collapses the two-element array onto one line). No behavior change.

* style(mcp): oxfmt the page-budget assertion

The Greptile P2 fix re-wrapped the expect call past oxfmt's width; run
the pinned formatter so Static checks stays green.

* fix(mcp): use the shared sha256Hex helper for the tools/list catalog digest

The architecture guards forbid a second one-shot SHA-256 hex digest;
use the shared helper from src/kernel/sha256Hex instead.

* fix(mcp): build the tools/list page-budget refusal through the shared owner helper

The architecture guard counts hand-built AnalysisResourceConstraintError
constructions; toolsListPageBudgetError() held the only new copy. The
refusal cause is a page budget, not a parse limit, so parseLimitConstraint
does not fit. Add toolsListPageBudgetConstraint() beside it in
parseFailureAnalysisError.ts and build the refusal from the page-budget
facts there; the produced error is unchanged.

Also give the pagination test SDK client the shared schema validator
from createMcpSchemaValidation, released with the client.

* fix(server): adapt instructions call to the predicate API

Main changed serverInstructions to take an advertisesTool predicate
instead of a tool-family set, and RecordedMcpCatalog gained required
toolFamilies and promptRequirements fields. The merge head no longer
typechecked, failing Build package, Documentation and Static checks.
Adapt the call site to main's own adapter shape and add the two empty
fixture fields.

* fix(mcp): restore main's tool-family scope in deferred startup

The merge dropped the family scoping main added to the deferred
startup path. A scoped stdio start advertised every recorded tool and
saved the full catalog identity, so attachRuntime rejected the selected
identity on first use. Restore the toolFamilies option, scoped
capabilities/instructions/identity, and the shared helper through
runDeferred and the deferred constructor.

* fix(mcp): share page limit facts and stream catalog sizing

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 18:54:35 +08:00
RRFZandVincent Koc 9cb0aa328b feat(cli): retain over-budget partial observations from failed CLI runs (#14693)
* feat(cli): retain over-budget partial observations from failed CLI runs

When a failed CLI command carries an over-budget partial observation without
--evidence_output, retain the complete partial Evidence in the private
retained-Evidence cache instead of dropping it to a rerun-only fallback.

- Pass the composed source closure into budgetFailurePartialEvidence so cited
  source records are written into the retained bundle alongside the partial
  observation.
- Report the retained path, byte size, and record_sha256 under
  details.diagnostics.evidence_bundle, set details.partial_observation_delivery
  to retained: "cache-file" with a paging cursor, and keep all failure facts
  (code, message, failure_kind, retryable, remediation, limits, existing
  diagnostics) unchanged.
- Honor --no-retain and REA_CLI_RETAINED_EVIDENCE_BYTES=0, fall back to
  retained: "not-retained" with rerun arguments and redacted retention_failure
  on uncommitted write errors, preserve the original failure and committed
  cache receipt on post-commit staging cleanup failures, and keep cancelled
  failures on the no-publication contract.
- Document the behavior in docs/reference/limits-and-recovery.md and add
  boundary and CLI acceptance tests.

Fixes #14618

* fix(cli): preserve pre-commit cleanup ownership and surviving oversized cache receipts

Address two gaps in the shared retainOverBudgetEvidence path that affected
both successful (deliverRetainedSummary) and failed (budgetFailurePartialEvidence)
CLI retention:

- Preserve pre-commit writer errors whose staging cleanup stayed incomplete
  (including exists failures with unfinished cleanup), reporting cleanup_incomplete
  and remaining resources via projectFailure on successes and via
  refusedPartialPublication (keeping execution_failure and complete inline
  partial_observation) on failures.
- When removing an oversized retained cache bundle fails (fileRemains), carry
  the surviving file metadata through RetentionStop.remainingFile, record the
  complete receipt (path, bytes, record_sha256), and report retained: "cache-file"
  with its paging cursor and retention_failure instead of a not-retained fallback.
- Simplify refusedPartialPublication back to a plain delivery value now that
  retainOverBudgetEvidence tracks the attempted cache path directly.
- Add public CLI tests for both paths (success and failure) using
  evidencePublicationPreload.mjs and update docs/reference/limits-and-recovery.md.

* fix(cli): key retained bundles by complete source closure

* chore(format): format retained evidence publication

* fix(cli): canonicalize retained bundle cache keys

* test(cli): compare retained bundle bytes directly

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 18:50:09 +08:00
Anandu MvandVincent Koc 803b92f794 fix(android): admit DEX-bearing ZIP packages by directory content (#14399)
* fix(android): admit DEX-bearing ZIP packages by directory content

A ZIP root without an .apk suffix was classified as a generic zip, so
inspect_android_package refused extensionless DEX archives. Generic ZIP
roots are now admitted as APKs when the central directory lists a root
AndroidManifest.xml or classes*.dex entry.

* fix(artifacts): bound Android ZIP probing and preserve selected formats

* chore(format): format Android ZIP admission changes

* fix(artifacts): bind ZIP classification to final file identity

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 18:44:09 +08:00
RRFZandVincent Koc 16c972bb91 fix(mcp): share catalog tool search to suggest advertised tools on unknown tool calls (#14305)
Extract ProgressiveToolCatalog's normalized search text construction and
word-match ranking into src/server/toolCatalogSearch.ts so discover_tools and
ErrorEvidenceTransport unknown-tool (-32602) remediation share one owner.

Unknown tool names are split on `_`, `-`, and whitespace and ranked against
currently enabled (advertised) tools only (all-word matches first, falling back
to any-word matches ranked by matched word count), taking up to five names
without edit-distance guessing or leaking disabled/out-of-scope/cold tools.
When discover_tools is advertised (hot/cold), remediation points to
discover_tools instead of tools/list.

Partial fix for Issue 14162 case 1 without changing error codes or schemas.

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 18:37:30 +08:00
记得吃中饭andVincent Koc d27e7284c7 fix(providers): resolve a PATH-only JDK for Windows Ghidra (#14654)
* fix(providers): resolve a PATH-only JDK for Windows Ghidra

Windows Ghidra admission fell back to a bare `java.exe` whenever JAVA_HOME was
unset. The owned-process launcher admits only absolute executable paths, so the
probe never started and the provider stayed `runtime_unavailable` with Win32 87,
even though the JDK on PATH met Ghidra's requirement.

Resolve `java.exe` through the caller's PATH on Windows, skipping relative
entries, and keep the bare command only when no absolute launcher exists. The
JADX provider already resolves the same case this way.

* test(providers): prove a relative PATH entry cannot select Java

* test(ghidra): match Windows launcher paths in negative control

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 18:37:24 +08:00
Pedro CormannandClaude Opus 5.5 abdf383939 fix(javascript): keep Electron options visible past conditional literal spreads (#9510)
* fix(javascript): keep Electron options visible past conditional literal spreads

The static object-literal model treated a spread such as
`...(isMac && { titleBarStyle: "hidden" })` or
`...(isMac ? { frame: false } : {})` as an unknown write, so every earlier
key became dynamic. BrowserWindow webPreferences and the preload association
were lost, and child-process options such as stdio lost their values too.

Expand `&&` and `?:` spreads whose branches are bounded literal copies into
one conditional-keys member. Only the keys a branch may copy stay
unresolved, and a falsy `&&` operand may still copy index keys
(document.all). `||`, `??`, unresolved branches, getters and computed keys
stay unknown, and nesting counts against the existing expression depth
limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): leave spread keys unknown after an unresolved && operand

A falsy `&&` operand is copied itself, and the conditional spread model
assumed it could add only index keys. document.all, the only falsy
object, can also carry expando properties with any key, so
`{ webPreferences, ...(isMac && { title: 1 }) }` reported the earlier
`webPreferences` as explicit while `isMac` was unresolved.

Bound the left operand with the same spread rules as a branch. A
comparison, `!` negation or other primitive result copies no named keys
and keeps earlier options readable; an unresolved operand, such as an
identifier, leaves the spread unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:18:03 +08:00
RRFZ b9a58556f2 fix(artifacts): reject non-object GLB JSON roots and non-array images (#14297)
Stop coercing non-object GLB JSON roots, non-array images members,
non-object buffer entries, and explicit null byteOffset values to
empty defaults in glbLayout. Non-object roots now report
json_status: "invalid" with unknown coverage, and non-array images
or invalid image/bufferView/buffer declarations keep coverage unknown
with explicit limitations.
2026-11-26 18:12:56 +08:00
RRFZ 52e3117256 fix(android-ota): report unknown coverage when OTA payload blob is truncated (#14513) 2026-11-26 18:12:06 +08:00
RRFZ b1907ae591 fix(pe-unwind): mark exception directory coverage partial when trailing bytes exist (#14515) 2026-11-26 18:11:28 +08:00
RRFZ d23c9cc362 fix(elf): bound COPY relocation symbol lookup by dynamic hash symbol count (#14519) 2026-11-26 18:11:15 +08:00
Vincent Koc 0410571266 build(deps): update the pinned npm toolchain to 11.21.3 (#14692) 2026-11-26 18:05:17 +08:00
Vincent Koc 74134bf6fd refactor(metadata): share Maven and NuGet boolean text parsing (#14694) 2026-11-26 18:04:14 +08:00
Vincent Koc 6991413d41 refactor(domain): share required canonical JSON serialization (#14687) 2026-11-26 17:29:05 +08:00
Vincent Koc a8fdc0961b fix(errors): classify failures from the first reported system code (#14686) 2026-11-26 17:28:41 +08:00
Vincent Koc 8d302d2dad fix(ci): include the cache retention helper dependency (#14689) 2026-11-26 09:07:14 +00:00
Vincent Koc 673e85ffdb fix(views): validate retained web rows against their collection (#14690) 2026-11-26 09:04:14 +00:00
Vincent Koc be65e86681 refactor(domain): share occurrence counting across collection comparisons (#14684) 2026-11-26 16:37:46 +08:00