[GH-ISSUE #5502] [Bug] Cancelled JavaScript analysis can still leave the macOS helper's temporary folder after #1194 #3348

Closed
opened 2026-10-31 00:39:24 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @coygeek on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5502

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

MCP or agent integration

Observed behavior

Cancelling analyze_javascript_application over MCP stdio can leave the macOS ownership-helper build folder after the server exits normally. This is a regression or incomplete fix for #1173, which was closed by #1194. The reproduced baseline includes that fix's merge, cf415619cadcfcb18cda59a54b26c9d164f750a4; ancestry was checked with git merge-base --is-ancestor.

An independent verifier ran three fresh-server sweeps of 15 cancellations each. One sweep left two Swift object files totaling 258,376 bytes inside a rea-process-token-* helper root. It first appeared after the nominal 100 ms cancellation in the second sweep, measured at 100.879916 ms, and survived subsequent requests, normal server exit, and samples 1,000 ms and 2,500 ms after exit. This identifies the observed timing, not a deterministic trigger or the internal interleaving.

The affected server exited with code 0 and empty stderr. binary_session returned cleanup_pending: false before shutdown; no received message reported cleanup_incomplete. Cancelled requests received no reply, which is expected MCP behavior and is not the defect.

Reproduction

The independent verifier executed this fixture and protocol through the built production entry point at the revision below, without source edits, compiler wrappers, fakes, or injected cleanup failures. Run from the built checkout on macOS with Node and the Apple Swift toolchain available. The client below parameterizes local paths and condenses the verifier's output. Each sweep uses a fresh server and isolated home, XDG, working, and temporary directories.

Standalone client and executed cancellation sequence
SCRATCH="$(mktemp -d)"
export SCRATCH
cat > "$SCRATCH/probe.mjs" <<'JS'
import { spawn } from 'node:child_process';
import { mkdirSync, writeFileSync, readdirSync, statSync } from 'node:fs';
import { join, relative } from 'node:path';
const checkout = process.cwd();
const scratch = process.env.SCRATCH;
const label = process.argv[2] ?? 'sweep-1';
const delays = process.argv.slice(3).map(Number);
const base = join(scratch, label);
for (const d of ['app/src','tmp','home','config','data','cache','state','output','database']) mkdirSync(join(base,d), {recursive:true});
writeFileSync(join(base,'app/package.json'), JSON.stringify({name:'demo',version:'1.0.0',main:'src/main.js'}));
for(let i=0;i<60;i++) writeFileSync(join(base,`app/src/mod${i}.js`), Array.from({length:60},(_,j)=>`export function fn${j}(a, b) { return a + b + ${j}; }`).join('\n'));
writeFileSync(join(base,'app/src/main.js'),'import "./mod0.js";\n');
const env = { PATH:process.env.PATH, HOME:join(base,'home'), TMPDIR:join(base,'tmp'), XDG_CONFIG_HOME:join(base,'config'), XDG_DATA_HOME:join(base,'data'), XDG_CACHE_HOME:join(base,'cache'), XDG_STATE_HOME:join(base,'state'), REA_LOG_LEVEL:'error' };
const child = spawn(process.execPath,[join(checkout,'scripts/rea.mjs'),'--mcp'],{cwd:base, env, stdio:['pipe','pipe','pipe']});
let id=0,buffer='',messages=[],stderr=''; const pending=new Map();
child.stderr.setEncoding('utf8').on('data',s=>stderr+=s);
child.stdout.setEncoding('utf8').on('data',s=>{buffer+=s;let index;while((index=buffer.indexOf('\n'))>=0){const line=buffer.slice(0,index).trim();buffer=buffer.slice(index+1);if(!line)continue;const msg=JSON.parse(line);messages.push(msg); const entry=pending.get(msg.id);if(entry){pending.delete(msg.id);entry(msg);}}});
const exit = new Promise(resolve=>child.on('exit',(code,signal)=>resolve({code,signal})));
const send=message=>child.stdin.write(JSON.stringify({jsonrpc:'2.0',...message})+'\n');
const request=(method,params)=>{const requestId=++id;return new Promise(resolve=>{pending.set(requestId,resolve);send({id:requestId,method,params});});};
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
function snapshot(){const roots=readdirSync(join(base,'tmp')).filter(n=>n.startsWith('rea-process-token-'));return roots.map(root=>{const files=[];function walk(p){for(const entry of readdirSync(p,{withFileTypes:true})){const q=join(p,entry.name);if(entry.isDirectory())walk(q);else files.push({path:relative(join(base,'tmp'),q),bytes:statSync(q).size});}}try{walk(join(base,'tmp',root));}catch{} return {root,files,bytes:files.reduce((n,f)=>n+f.bytes,0)};});}
const deadline=setTimeout(()=>{child.kill('SIGTERM');console.error('HARNESS_TIMEOUT',label);},200000);
try {
 const initialized=await request('initialize',{protocolVersion:'2025-06-18',capabilities:{},clientInfo:{name:'cleanup-verifier',version:'1'}});
 send({method:'notifications/initialized',params:{}});
 const catalog=await request('tools/list',{});
 writeFileSync(join(base,'schemas.json'),JSON.stringify(catalog.result.tools.filter(t=>['analyze_javascript_application','binary_session'].includes(t.name)),null,2));
 const results=[];
 if(delays.length===0){const response=await request('tools/call',{name:'analyze_javascript_application',arguments:{input_path:join(base,'app'),...(label==='control-summary'?{detail:'summary'}:{})}}); const result={kind:'uncancelled',response,roots:snapshot()};results.push(result);console.log(JSON.stringify({label,kind:result.kind,isError:response.result?.isError,roots:result.roots}));}
 for(const delay of delays){const requestId=++id; const started=performance.now(); send({id:requestId,method:'tools/call',params:{name:'analyze_javascript_application',arguments:{input_path:join(base,'app'),...(label==='control-summary'?{detail:'summary'}:{})}}});await sleep(delay);send({method:'notifications/cancelled',params:{requestId}});const actualDelay=performance.now()-started;await sleep(1500);const result={delay,actualDelay,requestId,roots:snapshot(),response:messages.find(m=>m.id===requestId)??null};results.push(result);console.log(JSON.stringify({label,...result}));}
 const status=await request('tools/call',{name:'binary_session',arguments:{}});
 const beforeExit=snapshot();
 child.stdin.end(); const exitResult=await exit;await sleep(1000);const afterExit=snapshot();await sleep(1500);const afterSettling=snapshot();
 const report={label,platform:process.platform,arch:process.arch,node:process.version,initialized,results,status,beforeExit,exit:exitResult,afterExit,afterSettling,stderr,messages};
 writeFileSync(join(base,'results.json'),JSON.stringify(report,null,2));
 writeFileSync(join(base,'stderr.log'),stderr);
 console.log(JSON.stringify({label,cleanup_pending:JSON.parse(status.result.content[0].text).result.cleanup_pending,exit:exitResult,afterExit,afterSettling,stderr}));
} finally {clearTimeout(deadline);if(child.exitCode===null && child.signalCode===null)child.kill('SIGTERM');}
JS
node "$SCRATCH/probe.mjs" sweep-1 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300
node "$SCRATCH/probe.mjs" sweep-2 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300
node "$SCRATCH/probe.mjs" sweep-3 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300
node "$SCRATCH/probe.mjs" control-summary

Inspect each run's results.json, especially afterSettling. The client sends tools/call with name: "analyze_javascript_application" and arguments: {input_path: <generated app directory>}, then notifications/cancelled with the matching requestId after each delay of 20, 40, ..., 300 ms. It waits 1,500 ms between requests, queries binary_session, closes stdin, and checks files after exit. One of three sweeps reproduced; a clean sweep does not establish restoration. The fixture and timing sequence have not been minimized.

Expected behavior

Remove REA-owned helper compilation files after their writers stop, including after cancellation and normal server exit. If cleanup cannot complete, retain ownership and report the unresolved resource and recovery action.

This follows AGENTS.md, Architecture and Cleanup, and docs/tool-design.md:71, Own the lifecycle, which explicitly covers temporary files and one-shot commands and requires the final departing startup caller to await owned cleanup. Reusing a compiled helper while its server is alive is expected. The documented scope of binary_session.cleanup_pending in docs/mcp-contracts.md:496 is narrower than all process-global helper files; its false value is context, not the sole basis for this expectation.

Impact and scope

Observed impact is bounded temporary-storage residue, P3: one retained root across 45 cancellations in three fresh servers, containing 258,376 bytes. These sample counts do not estimate a general failure rate. No analysis corruption, session failure, material disk pressure, or security boundary violation was observed. Linux and Windows were not tested.

The independent verifier confirmed manual removal of the specifically attributed root after its server exited. Use an isolated per-run temporary directory to establish ownership; do not glob-delete shared temporary files.

REA version

rea-agents 6.7.0; source baseline 074768901f3cdc8205b61773fb1faf6f6c7b3ca8, using the supplied prebuilt runtime. The server reported 6.7.0; build_commit was null, so revision identity comes from the checked checkout and supplied build, not a runtime commit receipt.

Runtime and platform

Node v26.12.0; macOS 27.0.1 arm64; Apple Swift 6.4, swiftlang-6.4.0.34.1 clang-2100.3.34.1; swift-driver 1.168.6; default Apple compiler selection. Hopper and Ghidra were not used.

Target and artifact context

Generated local JavaScript application: 60 modules with 60 exports each plus one entry file, 61 JavaScript files total. No target execution or external service calls were used in the reproduction.

Interface

MCP

Earliest failure stage

Cleanup, cancellation, or lifecycle

Relevant output or evidence

Independent production MCP replay and post-exit filesystem inspection recorded:

sweep-1: 15 cancellations; no helper root after exit; cleanup_pending=false; exit=0
sweep-2: 15 cancellations; one helper root after exit; cleanup_pending=false; exit=0
sweep-3: 15 cancellations; no helper root after exit; cleanup_pending=false; exit=0
sweep-2 remaining files, unchanged at both post-exit samples:
  ProcessRunTokenReader-1.o       207792 bytes
  ProcessRunTokenReaderMain-1.o    50584 bytes
  total                          258376 bytes

The leftover contained no reader executable. The uncancelled summary control returned isError: false and removed its helper directory at exit. A separate uncancelled full-output control completed analysis but returned the documented transport resource_constraint because the response exceeded the stdio budget; it also removed its helper directory. That second control establishes cleanup, not a successful analysis response.

Source references at the baseline: src/javascript/analysis/JavaScriptAnalysisWorker.ts:187 calls ownership preparation; src/process/ProcessOwnershipObservation.ts:966 reaches the Darwin reader; src/process/DarwinProcessRunTokenReader.ts:475 allocates the root, :504 compiles, :425 cleans the root, and :422 supplies exit cleanup. src/server/EvidenceMcpServer.ts:227 explains suppression of cancelled replies.

Typed outcome or recovery expected

After cancellation and final server exit, no abandoned helper folder should remain. If owned cleanup fails, report an unresolved cleanup owner and recovery guidance, consistent with cleanup_incomplete in docs/mcp-contracts.md:617. Preserve normal cancellation responsiveness and reply suppression.

Analysis or suspected cause

Source-derived context: #1194 changed Swift compilation to use stopSignal: "SIGINT" and redirect compiler TMPDIR into the owned helper root. Those settings are present in the reproduced baseline. The new leftover is inside that redirected root, rather than the sibling compiler temporary directory described in #1173. The earlier change therefore does not eliminate this observed MCP cancellation path.

NOT_ENOUGH_INFO: the exact writer/cleanup ordering and reason the root survives have not been instrumented. The source references establish ownership and reachability, not a proven race or root cause.

Additional context

Prepared with AI assistance and independently reproduced by a separate verifier. Related fixed report: #1173; merged fix: #1194. This new report records continued residue on a baseline that contains that merge; it does not reopen the old issue.

Current origin/main was checked at c374c2fe7290b914d73d9e27af38b498753ec593. No later change was found in the Darwin reader, ownership preparation, or ExecFileOutput; the later JavaScript worker and MCP changes address failure ordering and oversized-error projection. No plausible later fix was identified. This submission check inspected changes; it did not rerun the native sweeps on that newer revision.

NOT_ENOUGH_INFO: a last known good version and the first commit introducing this remaining path have not been established. For verification of a future fix, repeat the fresh-server sweeps and successful summary control, inspect through server exit, and exercise the actual failing preparation/finalization ordering once identified. A clean timing sweep alone is insufficient proof for an intermittent defect.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5502 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area MCP or agent integration ### Observed behavior Cancelling `analyze_javascript_application` over MCP stdio can leave the macOS ownership-helper build folder after the server exits normally. This is a regression or incomplete fix for #1173, which was closed by #1194. The reproduced baseline includes that fix's merge, `cf415619cadcfcb18cda59a54b26c9d164f750a4`; ancestry was checked with `git merge-base --is-ancestor`. An independent verifier ran three fresh-server sweeps of 15 cancellations each. One sweep left two Swift object files totaling 258,376 bytes inside a `rea-process-token-*` helper root. It first appeared after the nominal 100 ms cancellation in the second sweep, measured at 100.879916 ms, and survived subsequent requests, normal server exit, and samples 1,000 ms and 2,500 ms after exit. This identifies the observed timing, not a deterministic trigger or the internal interleaving. The affected server exited with code 0 and empty stderr. `binary_session` returned `cleanup_pending: false` before shutdown; no received message reported `cleanup_incomplete`. Cancelled requests received no reply, which is expected MCP behavior and is not the defect. ### Reproduction The independent verifier executed this fixture and protocol through the built production entry point at the revision below, without source edits, compiler wrappers, fakes, or injected cleanup failures. Run from the built checkout on macOS with Node and the Apple Swift toolchain available. The client below parameterizes local paths and condenses the verifier's output. Each sweep uses a fresh server and isolated home, XDG, working, and temporary directories. <details> <summary>Standalone client and executed cancellation sequence</summary> ```sh SCRATCH="$(mktemp -d)" export SCRATCH cat > "$SCRATCH/probe.mjs" <<'JS' import { spawn } from 'node:child_process'; import { mkdirSync, writeFileSync, readdirSync, statSync } from 'node:fs'; import { join, relative } from 'node:path'; const checkout = process.cwd(); const scratch = process.env.SCRATCH; const label = process.argv[2] ?? 'sweep-1'; const delays = process.argv.slice(3).map(Number); const base = join(scratch, label); for (const d of ['app/src','tmp','home','config','data','cache','state','output','database']) mkdirSync(join(base,d), {recursive:true}); writeFileSync(join(base,'app/package.json'), JSON.stringify({name:'demo',version:'1.0.0',main:'src/main.js'})); for(let i=0;i<60;i++) writeFileSync(join(base,`app/src/mod${i}.js`), Array.from({length:60},(_,j)=>`export function fn${j}(a, b) { return a + b + ${j}; }`).join('\n')); writeFileSync(join(base,'app/src/main.js'),'import "./mod0.js";\n'); const env = { PATH:process.env.PATH, HOME:join(base,'home'), TMPDIR:join(base,'tmp'), XDG_CONFIG_HOME:join(base,'config'), XDG_DATA_HOME:join(base,'data'), XDG_CACHE_HOME:join(base,'cache'), XDG_STATE_HOME:join(base,'state'), REA_LOG_LEVEL:'error' }; const child = spawn(process.execPath,[join(checkout,'scripts/rea.mjs'),'--mcp'],{cwd:base, env, stdio:['pipe','pipe','pipe']}); let id=0,buffer='',messages=[],stderr=''; const pending=new Map(); child.stderr.setEncoding('utf8').on('data',s=>stderr+=s); child.stdout.setEncoding('utf8').on('data',s=>{buffer+=s;let index;while((index=buffer.indexOf('\n'))>=0){const line=buffer.slice(0,index).trim();buffer=buffer.slice(index+1);if(!line)continue;const msg=JSON.parse(line);messages.push(msg); const entry=pending.get(msg.id);if(entry){pending.delete(msg.id);entry(msg);}}}); const exit = new Promise(resolve=>child.on('exit',(code,signal)=>resolve({code,signal}))); const send=message=>child.stdin.write(JSON.stringify({jsonrpc:'2.0',...message})+'\n'); const request=(method,params)=>{const requestId=++id;return new Promise(resolve=>{pending.set(requestId,resolve);send({id:requestId,method,params});});}; const sleep=ms=>new Promise(r=>setTimeout(r,ms)); function snapshot(){const roots=readdirSync(join(base,'tmp')).filter(n=>n.startsWith('rea-process-token-'));return roots.map(root=>{const files=[];function walk(p){for(const entry of readdirSync(p,{withFileTypes:true})){const q=join(p,entry.name);if(entry.isDirectory())walk(q);else files.push({path:relative(join(base,'tmp'),q),bytes:statSync(q).size});}}try{walk(join(base,'tmp',root));}catch{} return {root,files,bytes:files.reduce((n,f)=>n+f.bytes,0)};});} const deadline=setTimeout(()=>{child.kill('SIGTERM');console.error('HARNESS_TIMEOUT',label);},200000); try { const initialized=await request('initialize',{protocolVersion:'2025-06-18',capabilities:{},clientInfo:{name:'cleanup-verifier',version:'1'}}); send({method:'notifications/initialized',params:{}}); const catalog=await request('tools/list',{}); writeFileSync(join(base,'schemas.json'),JSON.stringify(catalog.result.tools.filter(t=>['analyze_javascript_application','binary_session'].includes(t.name)),null,2)); const results=[]; if(delays.length===0){const response=await request('tools/call',{name:'analyze_javascript_application',arguments:{input_path:join(base,'app'),...(label==='control-summary'?{detail:'summary'}:{})}}); const result={kind:'uncancelled',response,roots:snapshot()};results.push(result);console.log(JSON.stringify({label,kind:result.kind,isError:response.result?.isError,roots:result.roots}));} for(const delay of delays){const requestId=++id; const started=performance.now(); send({id:requestId,method:'tools/call',params:{name:'analyze_javascript_application',arguments:{input_path:join(base,'app'),...(label==='control-summary'?{detail:'summary'}:{})}}});await sleep(delay);send({method:'notifications/cancelled',params:{requestId}});const actualDelay=performance.now()-started;await sleep(1500);const result={delay,actualDelay,requestId,roots:snapshot(),response:messages.find(m=>m.id===requestId)??null};results.push(result);console.log(JSON.stringify({label,...result}));} const status=await request('tools/call',{name:'binary_session',arguments:{}}); const beforeExit=snapshot(); child.stdin.end(); const exitResult=await exit;await sleep(1000);const afterExit=snapshot();await sleep(1500);const afterSettling=snapshot(); const report={label,platform:process.platform,arch:process.arch,node:process.version,initialized,results,status,beforeExit,exit:exitResult,afterExit,afterSettling,stderr,messages}; writeFileSync(join(base,'results.json'),JSON.stringify(report,null,2)); writeFileSync(join(base,'stderr.log'),stderr); console.log(JSON.stringify({label,cleanup_pending:JSON.parse(status.result.content[0].text).result.cleanup_pending,exit:exitResult,afterExit,afterSettling,stderr})); } finally {clearTimeout(deadline);if(child.exitCode===null && child.signalCode===null)child.kill('SIGTERM');} JS ``` ```sh node "$SCRATCH/probe.mjs" sweep-1 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 node "$SCRATCH/probe.mjs" sweep-2 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 node "$SCRATCH/probe.mjs" sweep-3 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 node "$SCRATCH/probe.mjs" control-summary ``` </details> Inspect each run's `results.json`, especially `afterSettling`. The client sends `tools/call` with `name: "analyze_javascript_application"` and `arguments: {input_path: <generated app directory>}`, then `notifications/cancelled` with the matching `requestId` after each delay of 20, 40, ..., 300 ms. It waits 1,500 ms between requests, queries `binary_session`, closes stdin, and checks files after exit. One of three sweeps reproduced; a clean sweep does not establish restoration. The fixture and timing sequence have not been minimized. ### Expected behavior Remove REA-owned helper compilation files after their writers stop, including after cancellation and normal server exit. If cleanup cannot complete, retain ownership and report the unresolved resource and recovery action. This follows `AGENTS.md`, Architecture and Cleanup, and `docs/tool-design.md:71`, Own the lifecycle, which explicitly covers temporary files and one-shot commands and requires the final departing startup caller to await owned cleanup. Reusing a compiled helper while its server is alive is expected. The documented scope of `binary_session.cleanup_pending` in `docs/mcp-contracts.md:496` is narrower than all process-global helper files; its false value is context, not the sole basis for this expectation. ### Impact and scope Observed impact is bounded temporary-storage residue, P3: one retained root across 45 cancellations in three fresh servers, containing 258,376 bytes. These sample counts do not estimate a general failure rate. No analysis corruption, session failure, material disk pressure, or security boundary violation was observed. Linux and Windows were not tested. The independent verifier confirmed manual removal of the specifically attributed root after its server exited. Use an isolated per-run temporary directory to establish ownership; do not glob-delete shared temporary files. ### REA version `rea-agents` 6.7.0; source baseline `074768901f3cdc8205b61773fb1faf6f6c7b3ca8`, using the supplied prebuilt runtime. The server reported 6.7.0; `build_commit` was null, so revision identity comes from the checked checkout and supplied build, not a runtime commit receipt. ### Runtime and platform Node v26.12.0; macOS 27.0.1 arm64; Apple Swift 6.4, swiftlang-6.4.0.34.1 clang-2100.3.34.1; swift-driver 1.168.6; default Apple compiler selection. Hopper and Ghidra were not used. ### Target and artifact context Generated local JavaScript application: 60 modules with 60 exports each plus one entry file, 61 JavaScript files total. No target execution or external service calls were used in the reproduction. ### Interface MCP ### Earliest failure stage Cleanup, cancellation, or lifecycle ### Relevant output or evidence Independent production MCP replay and post-exit filesystem inspection recorded: ```text sweep-1: 15 cancellations; no helper root after exit; cleanup_pending=false; exit=0 sweep-2: 15 cancellations; one helper root after exit; cleanup_pending=false; exit=0 sweep-3: 15 cancellations; no helper root after exit; cleanup_pending=false; exit=0 sweep-2 remaining files, unchanged at both post-exit samples: ProcessRunTokenReader-1.o 207792 bytes ProcessRunTokenReaderMain-1.o 50584 bytes total 258376 bytes ``` The leftover contained no reader executable. The uncancelled summary control returned `isError: false` and removed its helper directory at exit. A separate uncancelled full-output control completed analysis but returned the documented transport `resource_constraint` because the response exceeded the stdio budget; it also removed its helper directory. That second control establishes cleanup, not a successful analysis response. Source references at the baseline: `src/javascript/analysis/JavaScriptAnalysisWorker.ts:187` calls ownership preparation; `src/process/ProcessOwnershipObservation.ts:966` reaches the Darwin reader; `src/process/DarwinProcessRunTokenReader.ts:475` allocates the root, `:504` compiles, `:425` cleans the root, and `:422` supplies exit cleanup. `src/server/EvidenceMcpServer.ts:227` explains suppression of cancelled replies. ### Typed outcome or recovery expected After cancellation and final server exit, no abandoned helper folder should remain. If owned cleanup fails, report an unresolved cleanup owner and recovery guidance, consistent with `cleanup_incomplete` in `docs/mcp-contracts.md:617`. Preserve normal cancellation responsiveness and reply suppression. ### Analysis or suspected cause Source-derived context: #1194 changed Swift compilation to use `stopSignal: "SIGINT"` and redirect compiler `TMPDIR` into the owned helper root. Those settings are present in the reproduced baseline. The new leftover is inside that redirected root, rather than the sibling compiler temporary directory described in #1173. The earlier change therefore does not eliminate this observed MCP cancellation path. NOT_ENOUGH_INFO: the exact writer/cleanup ordering and reason the root survives have not been instrumented. The source references establish ownership and reachability, not a proven race or root cause. ### Additional context Prepared with AI assistance and independently reproduced by a separate verifier. Related fixed report: #1173; merged fix: #1194. This new report records continued residue on a baseline that contains that merge; it does not reopen the old issue. Current `origin/main` was checked at `c374c2fe7290b914d73d9e27af38b498753ec593`. No later change was found in the Darwin reader, ownership preparation, or `ExecFileOutput`; the later JavaScript worker and MCP changes address failure ordering and oversized-error projection. No plausible later fix was identified. This submission check inspected changes; it did not rerun the native sweeps on that newer revision. NOT_ENOUGH_INFO: a last known good version and the first commit introducing this remaining path have not been established. For verification of a future fix, repeat the fresh-server sweeps and successful summary control, inspect through server exit, and exercise the actual failing preparation/finalization ordering once identified. A clean timing sweep alone is insufficient proof for an intermittent defect.
Author
Owner

@matbrgz commented on GitHub (Oct 20, 2026):

Cross-referencing with canonical issue #4686 () and sibling #5480. All address lifecycle leaks where cancelled or faulted worker routines leave orphaned temporary staging directories. Cataloged in consolidation tracker #4330.

<!-- gh-comment-id:6292621267 --> @matbrgz commented on GitHub (Oct 20, 2026): Cross-referencing with canonical issue #4686 () and sibling #5480. All address lifecycle leaks where cancelled or faulted worker routines leave orphaned temporary staging directories. Cataloged in consolidation tracker #4330.
Author
Owner

@coygeek commented on GitHub (Oct 24, 2026):

There is meaningful cleanup progress, but the remaining status is a verification gap, not a newly reproduced leak on current main. The compiler path keeps compiler temporaries beneath the helper root, uses SIGINT, and retains a cleanup owner when removal fails. The last-waiter path now waits for compilation/finalization after the final interested caller cancels.

The relevant regression coverage is narrower than the native incident: the temporary-object fixture uses a simulated compiler whose SIGINT handler explicitly kills its detached writer, while the cleanup-failure controls inject root-removal failure and verify retained ownership/retry. Those assertions do not establish restoration of the reported Apple Swift/MCP ordering. The reader itself notes that closed inherited compiler pipes do not prove completion of children that did not inherit them.

Closure needs current-revision evidence for the original contract: on macOS with Apple Swift and a freshly built runtime, replay the supplied fresh-server MCP cancellation sweeps and successful summary control, inspect isolated helper roots through normal server exit and the post-exit settling samples, and record compiler/runtime versions. If timing remains intermittent, identify the writer/finalization ordering and cover that ordering directly; a clean sweep alone is insufficient. Keep shared compilation working for surviving callers and retain/report any genuinely failed cleanup owner. Expanding binary_session.cleanup_pending is not itself required to prove root removal.

I have not rerun the native sweeps.

<!-- gh-comment-id:6380895341 --> @coygeek commented on GitHub (Oct 24, 2026): There is meaningful cleanup progress, but the remaining status is a verification gap, not a newly reproduced leak on current main. The [compiler path](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/process/DarwinProcessRunTokenReader.ts#L494-L549) keeps compiler temporaries beneath the helper root, uses `SIGINT`, and retains a cleanup owner when removal fails. The [last-waiter path](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/process/DarwinProcessRunTokenReader.ts#L599-L628) now waits for compilation/finalization after the final interested caller cancels. The relevant regression coverage is narrower than the native incident: the [temporary-object fixture](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/tests/boundary/process/darwinProcessRunTokenReader.test.ts#L737-L810) uses a simulated compiler whose SIGINT handler explicitly kills its detached writer, while the [cleanup-failure controls](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/tests/process-global/darwinCompilerCleanup.test.ts#L170-L196) inject root-removal failure and verify retained ownership/retry. Those assertions do not establish restoration of the reported Apple Swift/MCP ordering. The reader itself notes that closed inherited compiler pipes do not prove completion of children that did not inherit them. Closure needs current-revision evidence for the original contract: on macOS with Apple Swift and a freshly built runtime, replay the supplied fresh-server MCP cancellation sweeps and successful summary control, inspect isolated helper roots through normal server exit and the post-exit settling samples, and record compiler/runtime versions. If timing remains intermittent, identify the writer/finalization ordering and cover that ordering directly; a clean sweep alone is insufficient. Keep shared compilation working for surviving callers and retain/report any genuinely failed cleanup owner. Expanding `binary_session.cleanup_pending` is not itself required to prove root removal. I have not rerun the native sweeps.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3348
No description provided.