Commit Graph
507 Commits
Author SHA1 Message Date
dcf7e25d09 perf(process): pool regex workers across match calls (#14114)
* perf(process): pool regex workers across match calls

matchRegexValues spawned a fresh worker_threads Worker per call (~10.5 ms measured, vs ~0.9 ms pooled for a trivial match on 1-5k candidates). Workers are now pooled by heap class (max 4, 10 s idle reap, unref'd while idle): the worker protocol is message-driven, a worker is reused only after a clean matched/invalid-pattern reply, and deadline, abort, error, exit or malformed replies retire it so a stuck pattern can never poison the pool. Queueing for a busy pool counts toward the caller's deadline. Results, heap and deadline errors, and cancellation semantics are unchanged.

Closes #14110. Verified: RegexMatcher + RegexMatcherReply + boundary regexMatcher + HopperRegexSearch + IdaOperationRunner tests (91+15), check:fast, and a 15-call benchmark (10.5 ms -> 0.9 ms per call).

* test(process): use the admitted deadline source spelling in the pool test

* fix(process): enforce queue deadlines, reclaim idle regex workers, and await retirement

Address pooled-worker review findings: the matching deadline now starts before pool acquisition (queue waiters expire and expired jobs are never posted), idle workers of another heap class are reclaimed instead of blocking a changed heap setting, queued worker startup failures reject into the normal Cannot-start path, and non-clean outcomes await worker termination before returning so close() cannot finish while matching work lives. Add RegexMatcherPool.test.ts with a construction-counting fake worker proving reuse across clean calls and termination-before-return plus replacement after a deadline.

* fix(process): allocate regex workers through one capacity path

Acquisition retired an idle worker and spawned directly, bypassing waiter order: retirement served an older waiter into the freed slot and acquisition then spawned a fifth worker. Acquisition now only takes an idle match or enqueues, and serveRegexWaiters owns every spawn/reclaim decision in waiter order. Add a mock-pool regression proving a fifth queued search deadlines at four constructions.

* fix(process): reclaim incompatible regex workers on one path

Keep a stopping worker counted until terminate settles, and let release
ask the shared allocator so a different heap does not wait out the idle
reap. A failed stop stays owned and is recorded beside the match error.

* fix(process): mark background regex-worker stops and release test gates

Typed lint rejects an unmarked beginStopRegexWorker promise, so the
allocator's fire-and-forget stops are explicit. Pool tests release held
workers in finally, including when an assertion fails first.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
2026-11-23 18:19:56 +00:00
morluto 4bbaf17512 refactor: centralize owned finalization and configuration failures (#14071)
* refactor(config): propagate typed configuration failures

* refactor(lifecycle): centralize completion and cancellation

* fix(config): preserve Hermes YAML edit refusal guidance
2026-11-23 13:40:10 +00:00
morluto ac774bcd70 refactor(process): share the abortable command-turn wait between GDB and Rizin (#14042) 2026-11-23 12:09:57 +00:00
Thejesh dc9db1f35a fix(process): find dotted Windows command names on PATH (#13833)
windowsPathCandidates read the suffix of python3.12 or pip3.12 as an
explicit, non-runnable extension and returned no candidates, so REA
reported not_found where libuv and cmd.exe find python3.12.exe.

Treat a suffix as an explicit extension only when it is an image, batch
or PATHEXT extension (or a bare trailing dot); otherwise append PATHEXT
as for a name without a dot, validating PATHEXT the same way.
2026-11-23 02:07:31 +00:00
morluto fe3cb34384 perf(process): bound Linux /proc FD concurrency and reuse relation identities in token sweep (#13780)
* perf(process): bound Linux /proc FD concurrency and reuse relation identities in token sweep

* test(process): cover queued Linux identity reads
2026-11-23 01:18:19 +00:00
morluto 16c827a25f perf(captures/io): stream artifact hashes and preserve bounded export reads (#13755)
* perf(captures/io): stream-hash ArtifactAnalysisResources, zero-copy ZIP stream, bound consent/journal reads

* fix(decompile): stream committed resume journal records

* style: format files with oxfmt

* fix(export): read consent from one stable descriptor

* style(export): format consent file handling
2026-11-23 01:03:30 +00:00
morluto fcc357b936 perf(process): avoid full-chunk Buffer.concat in ProcessOutputTokenScanner (#13727)
* perf(process): avoid full-chunk Buffer.concat in ProcessOutputTokenScanner

* fix(process): preserve token line truncation at chunk boundaries
2026-11-23 00:45:25 +00:00
morluto f92a06226a perf(native/process): avoid symbol BigInt/string allocs and trim process polls (#13720) 2026-11-22 19:22:04 -05:00
morluto ba0645a9a4 test(process): consolidate startup interruption and finalize proofs (#13742) 2026-11-23 00:17:00 +00:00
morluto 588b257e48 refactor(regex): consolidate worker input and deadline proofs (#13732) 2026-11-23 00:11:55 +00:00
morluto 835ed060dd fix(process): retain stdout collection failures through cleanup (#13725) 2026-11-23 00:11:31 +00:00
morluto cf979613a3 perf(workers/browser/cli): buffer JSON writes, wake on signal, optimize queues (#13698)
* perf(workers/browser/cli): buffer JSON writes, wake on signal, optimize queues

* fix(workers): wake on owned memory refusal and bound CLI JSON counting
2026-11-23 00:09:11 +00:00
morluto d7ccd30985 fix(setup): reject impossible Hopper archive lengths before download (#13737) 2026-11-23 00:07:49 +00:00
morluto aab47683f5 test(process): consolidate stream framing and token proofs (#13714) 2026-11-22 23:48:30 +00:00
morluto f404cdefa4 perf(core): hoist stateless decoders/regexes and avoid redundant copies (#13696) 2026-11-22 23:42:41 +00:00
morluto de0b7f6515 test(process): consolidate producer recovery and cleanup evidence (#13694)
* test(process): consolidate producer recovery and cleanup evidence

* test(process): check producer limits without freezing guidance order
2026-11-22 23:27:29 +00:00
morluto b10fde8a28 test(process): consolidate held lease peer and retry proof (#13693) 2026-11-22 23:15:58 +00:00
morluto 3fbfeb9f07 test(process): consolidate owned command finalization proof (#13686) 2026-11-22 23:06:44 +00:00
morluto fbe14d6bd6 perf(process/server/ida): O(1) tail capture, pre-filtered CapabilityInventory, Map process-table joins, and owned IDA JSON validation (#13612)
* perf(process/server/ida): O(1) tail capture, pre-filtered CapabilityInventory, Map process-table joins, and owned IDA JSON validation

* fix(process): detach captured output before mutation

* test(process): exercise late writes before reset
2026-11-22 17:22:18 -05:00
morluto 2c57cf195e perf(search): precompute guidance word sets, skip regex worker on empty candidates, and index Go view lookups (#13610)
* perf(search): precompute guidance word sets, skip regex worker on empty candidates, and index Go view lookups

* test(go): cover filtered index paging across collections
2026-11-22 21:45:47 +00:00
morluto 3a0d9d6874 perf(process/ghidra/hopper): eliminate per-char array allocs, O(P*U) filesystem scans, unbounded wire sizing, and full-binary chunk copies (#13529)
* perf(process/ghidra/hopper): eliminate per-char array allocs, O(P*U) filesystem scans, unbounded wire sizing, and full-binary chunk copies (#13527)

* fix(bridge): distinguish bounded request byte counts
2026-11-22 18:38:41 +00:00
morluto 9a85100b59 perf(process): fix expectedSize EOF probing in readBoundedFileBytes and eliminate 2x buffer copies (#13494)
* perf(process): fix expectedSize EOF probing in readBoundedFileBytes and eliminate 2x buffer copies (#13492)

* fix(setup): bound skill snapshots to the admitted file size
2026-11-22 18:23:12 +00:00
morluto 1482cc87ea perf(process): replace nested-loop joins with Set hash joins in process ownership observation (#13490)
* perf(process): replace nested-loop joins with Set hash joins in process ownership observation (#13488)

* perf(process): merge ownership failures by PID
2026-11-22 13:04:28 -05:00
morluto 48d4b6145a perf(process): transfer chunked string buffers into RegexMatcher worker (#13428)
* perf(process): transfer chunked string buffers into RegexMatcher worker

* test(process): verify 1M RegexMatcher inventory in isolated 16 MiB subprocess
2026-11-22 14:08:26 +00:00
CyberSprout 6a20a88e81 perf(uefi): pool framed LZMA worker and fuse single-pass publication (#13338)
* perf(uefi,firmware): pool framed LZMA worker and fuse single-pass publication

Fixes #13282

* fix(uefi): own worker stdin errors and compose concurrent publication cleanup

* fix(uefi): preserve startup cancellation and timeout classification

* test(uefi): assert startup cancellation and timeout projections

* fix(uefi): retain completed inspection across pooled worker shutdown
2026-11-22 08:06:38 -05:00
morluto 58af29e6b0 perf(io): stream SQLite snapshots, chunk stable artifact reads, and bound procfs and staging-budget I/O (#13360)
* perf(io): stream SQLite snapshots, chunk stable artifact reads, and bound procfs and staging-budget I/O

* fix(firmware/sqlite): restore bounded opendir streaming, settle lstat batches before throw, and test snapshot destination close lifecycle
2026-11-22 08:03:45 -05:00
morluto 3a36311004 fix(process): retain synchronous command launch failures (#13350) 2026-11-22 09:26:24 +00:00
morluto 2f171faa9f perf(search/kuna): optimize regex worker dispatch and Kuna inventory validation (#13320)
perf(search,kuna): optimize RegexMatcher worker dispatch and Kuna inventory validators
2026-11-22 03:46:02 -05:00
morluto b795aee553 perf(process): wake OwnedCommand on output close, lazily materialize diagnostic snapshots, and bound tail copies (#13261)
* perf(process): wake OwnedCommand on output close, lazily materialize diagnostic snapshots, and bound tail copies

* fix(process): capture event-time bytes in diagnostic snapshots and make wrap test independent
2026-11-22 03:15:02 -05:00
morluto 178467f6a7 fix(mcp): settle independent launch preparation owners (#13259) 2026-11-22 01:49:55 +00:00
morluto 75a75a1bd1 fix(process): verify nested worker exit after parent cleanup (#13242) 2026-11-22 00:17:58 +00:00
morluto 60e099848d perf(browser): wake the bundle worker on observed events (#13225) 2026-11-21 22:35:15 +00:00
8d6552e928 feat(config): persist provider settings in a user config file (#3023)
* feat(config): persist provider settings in a user config file

Providers currently rediscover install paths from scratch in every
process, so a path set once (for example GHIDRA_INSTALL_DIR) silently
reverts on the next run. Introduce ~/.config/rea/rea.json as the
user-owned persistence layer and merge it into the environment
snapshot before configuration parsing, keeping env > config file >
auto-detect precedence on both the CLI and MCP entry points.

Add a rea config command (list/get/set/unset) as the write surface,
reporting the effective value and where it came from.

* fix(config): address review findings on persistence safety and CLI surface

- stage config writes beside the file and rename into place so an
  interrupted write cannot leave partial JSON (greptile #4, codex #11)
- convert unreadable config files into configuration errors on the CLI
  seam instead of escaping raw filesystem errors (greptile #5, codex #15)
- keep injected runtimes without a config root isolated from the host
  account's rea.json (codex #18)
- surface the config file error on stderr when doctor falls back to the
  raw environment (greptile #3, codex #16)
- route the config command through logCliCommand and return documents so
  --json stays parseable and failures exit non-zero (greptile #2,
  codex #10)
- reject empty --set values, unknown --set/--unset/--get names, and --get
  combined with mutations (greptile #1/#7, codex #9/#12/#13/#17)
- cover the new behavior in the boundary tests and stop leaking one
  temporary home per run (greptile #8)

* fix(config): validate and back up persisted provider settings

* fix(config): keep saved provider defaults out of client registrations

* fix(config): preserve provider discovery and budgets for saved settings

* fix(config): check only settings needed by the IDA deadline lookup

* fix(config): share effective provider settings and verify config file reads

* fix(doctor): share selected settings with Hopper and ILSpy probes

* fix(config): resolve the destination of first-time saves

* fix(doctor): preserve unresolved provider location inputs

* fix(doctor): honor inherited IDA deadline overrides

* fix(config): show empty environment overrides

* fix(setup): preserve client-selected saved configuration roots

---------

Co-authored-by: Jackzigen <zigenhan@gmail.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-21 22:02:35 +00:00
abba1f43bb fix(setup): register aube's bin shim instead of its versioned store path (#5311)
* fix(setup): register aube's bin shim instead of its versioned store path

mise's npm backend installs with aube, whose bin is a shell shim that runs
the script inside one version's store directory. Setup registered that
versioned script, which the next upgrade removes from under the agents.
Setup now registers the shim when it proves, from the shim's own header,
that it runs this exact entrypoint, and registration identity accepts that
shim as REA's own.

Refs #4847

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

* fix(setup): move aube store registrations to the shim and follow links to it

Status now reports a direct registration as stale when the running
entrypoint has an aube bin shim and the registration is not that shim, so
doctor and setup move registrations written before this fix. A link to a
shim resolves the target from the shim's real directory, as the shim does.
The shim check runs only when the exact-path check does not already own the
command, applies on every platform (the header alone decides), and a failed
close no longer escapes classification. The test now lays out versions the
way mise does, with `latest` as a symlink.

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

* fix(setup): launch managed shims without client PATH dependencies

* fix(setup): bind Node for installed Aube shims without a sidecar

* fix(setup): keep an independent Node fallback for Aube shims

* fix(setup): preserve independent Node aliases across upgrades

* fix(setup): reuse verified Node for host-bound Aube shims

* fix(setup): keep Aube registrations across shim format changes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-21 16:34:38 -05:00
Saim Mehmood ab47c970a7 fix(process): name the fixed finalization delivery grace
An unsettled finalization signal delivery reported a bare millisecond
figure, without saying whether that grace is adjustable. An agent could
infer that raising the caller-selected finalization_ms would extend it.

PROCESS_FINALIZATION_DELIVERY_GRACE_MS is module-private with no runtime
control, and is independent of finalization_ms (the SIGTERM-to-SIGKILL
interval). State both in the reason, keeping the lowercase fragment
register used by the sibling reasons on this field.

Relates to #5910.
2026-11-21 22:29:57 +01:00
Clark de44e5e273 test(process): check SIGHUP limitation through its exported owner constant 2026-11-21 22:29:33 +01:00
Clark 95dfbae68e fix(process): record PTY session-leader SIGHUP limitation in Evidence 2026-11-21 22:29:33 +01:00
gensokyo-devandgensokyo-dev 2d360253dd refactor(process): compose analysis runtime cleanup through the shared owner
ArtifactAnalysisResources built its multi-failure cleanup composite and
bound the parts by hand; providerCleanupErrorFromFailures builds the same
composite with the existing per-part diagnostics.

Refs #11859

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-21 19:34:01 +01:00
df1bd11895 test(process): publish timeout stop signal atomically in ExecFileOutput test (#13151)
The child recorded the received signal with writeFileSync, which creates
an empty file before writing. The test polls for existence and reads the
content while the child is still alive, so it could observe '' instead of
SIGINT (main CI run 44898480483). Write to a sibling file and rename it.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-21 17:55:13 +01:00
morluto d989ff06e8 test(process): bound inherited-pipe fixture lifetime to its workspace (#13030)
test(process): stop inherited-pipe fixtures when their workspace disappears
2026-11-21 07:28:38 +00:00
morluto 86b4360ce2 test(process): consolidate command timeout and output ownership checks (#12905)
* test(process): consolidate command timeout and output ownership checks

* test(process): join inherited-pipe descendant during failed checks

* test(process): cover inherited pipe grace and use project wait deadlines
2026-11-20 19:16:55 +00:00
morluto 9fff01f791 test(process): consolidate local bridge transport and cancellation coverage (#12907)
* test(process): prove local socket handoff with a real exchange

* test(ghidra): consolidate wire admission and cancellation checks
2026-11-20 14:12:32 -05:00
morluto 3a002fb708 test(process): consolidate supervised output closure and cleanup checks (#12906) 2026-11-20 19:03:45 +00:00
morluto 193bc533be test(process): consolidate Darwin helper request and cleanup proof (#12897)
* test(process): consolidate Darwin helper request and cleanup proof

* test(process): preserve native helper argument boundaries in fixture
2026-11-20 17:47:03 +00:00
morluto 56682a75c1 test(windows): consolidate executable lookup and cancellation coverage (#12894)
* test(windows): verify qualified lookup cannot fall back to PATH

* test(ida): join stalled Windows lookup fixtures at close and timeout
2026-11-20 17:45:58 +00:00
morluto 21f8f56dde test(process): consolidate PID authority and native exit settlement coverage (#12895) 2026-11-20 17:36:41 +00:00
morluto afc8c0ae7b test(process): consolidate run-token fallback and native retry coverage (#12892) 2026-11-20 17:28:35 +00:00
morluto cbe3d16e44 test(process): join descriptor inspection and consolidate ownership proof (#12891) 2026-11-20 17:22:18 +00:00
morluto 880e62351e test(process): consolidate process inventory and native row checks (#12889)
* test(process): remove redundant wide-family assertions

* test(process): consolidate process inventory checks
2026-11-20 17:16:38 +00:00
morluto 19f9a01655 test(process): synchronize launcher exit proof and remove duplicate deadline check (#12890) 2026-11-20 17:10:04 +00:00