Skip to content

Reliability: android reaper meta key, evidence-walk cost, atomic writes #46

Description

@ElbertePlinio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions