You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reliability: android reaper meta key, evidence-walk cost, atomic writes #46
From the 2026-07-19 complementary swarm review (read-only, orthogonal to #44).
P0 — reliability
Android session create/destroy never sets REAPER_CLEANUP_PENDING_META_KEY (packages/android/src/session.ts:106-119,137-153), unlike desktop/browser. A leaked emulator can become permanently untracked by the reaper. Fix: set/clear the pending-cleanup meta key with the same protocol the other runtimes use.
P1 — performance & reliability
appendAction does a full recursive readdir+lstat walk of the run directory on every evidence action (packages/core/src/evidence.ts:925-957,1069). Cache or incrementally track size instead of rescanning.
MCP run-log resource reads entire log file into memory with no size cap (packages/mcp-server/src/resources.ts:589 — screenshots are guarded at :528, logs are not), then 9 regex redactSecrets passes. Add the same size guard as screenshots + stream/tail semantics.
Browser supervisor child-shim buffers Chrome stderr unbounded when no \n arrives (packages/browser/src/supervisor.ts). Bound the buffer.
P1 — simplify
Atomic write (tmp + rename + counter) hand-rolled 5× (core/session.ts:87-122, run.ts:61-92, config.ts:105-125, evidence.ts:66,744-751,1244-1251); 3 copies leak the tmp file on rename failure. Correct impl exists at agent-installers/src/atomicFile.ts. Hoist writeFileAtomic into core and use everywhere (do NOT touch evidence.ts's concurrency-critical claim/lock paths beyond the two safe call sites).
Validation
bun test per touched package; typecheck; verify reaper picks up an artificially leaked android session.
P0: packages/android/src/session.ts create/destroy now set/clear REAPER_CLEANUP_PENDING_META_KEY with the same protocol as desktop-linux/browser. Added packages/android/test/reaper.test.ts proving a leaked android session (failed destroy) stays reaper-trackable and gets reaped.
P1 perf: appendAction no longer full-walks the run dir per action — cached artifact byte total, invalidated via a cheap entry-name snapshot (immune to journal-lock/truncation-sentinel churn); journal's own size read live off the open handle. Orphaned on-disk artifacts still counted (existing cumulative-bytes tests pass unchanged, plus a new cache-hit test).
P1 perf: MCP run-log resource now caps memory with tail semantics (mirrors the screenshot guard), instead of reading the whole file before redaction.
P1 perf: browser supervisor child-shim stderr buffer bounded to last 64KB.
P1 simplify: hoisted writeFileAtomic into packages/core/src/paths.ts; used in core/session.ts, run.ts, config.ts (fixes the tmp-file leak on rename failure in all three), agent-installers' call sites, and the two safe evidence.ts call sites — claim/lock code paths in evidence.ts untouched otherwise.
Validation: tsc --noEmit clean, full vitest run — 78 files / 950 passed, 2 skipped. No sudo usage introduced; no overlap with #44.
Activity
ElbertePlinio commentedon Jul 19, 2026
Opened #47 implementing all checklist items:
packages/android/src/session.tscreate/destroy now set/clearREAPER_CLEANUP_PENDING_META_KEYwith the same protocol as desktop-linux/browser. Addedpackages/android/test/reaper.test.tsproving a leaked android session (failed destroy) stays reaper-trackable and gets reaped.appendActionno longer full-walks the run dir per action — cached artifact byte total, invalidated via a cheap entry-name snapshot (immune to journal-lock/truncation-sentinel churn); journal's own size read live off the open handle. Orphaned on-disk artifacts still counted (existing cumulative-bytes tests pass unchanged, plus a new cache-hit test).run-logresource now caps memory with tail semantics (mirrors the screenshot guard), instead of reading the whole file before redaction.writeFileAtomicintopackages/core/src/paths.ts; used incore/session.ts,run.ts,config.ts(fixes the tmp-file leak on rename failure in all three), agent-installers' call sites, and the two safeevidence.tscall sites — claim/lock code paths in evidence.ts untouched otherwise.Validation:
tsc --noEmitclean, fullvitest run— 78 files / 950 passed, 2 skipped. No sudo usage introduced; no overlap with #44.fix: reaper meta key for android, evidence-walk cost, atomic writes (#46