Repository navigation
Description
Summary
Every bash tool invocation's spawned process tree is torn down the moment the top-level process exits — including descendants that deliberately try to detach via setsid/disown. This appears fully intentional (there's even a comment in process-ledger.ts acknowledging the setsid-escape case), and it's a reasonable default for safety/resource hygiene. But there's currently no supported way for an agent to say "actually, let this one keep running past this tool call, and let me check on it later" — which real workloads (long downloads, model training, genome index builds, anything multi-hour) genuinely need.
What I found (traced through the source)
backend/cli/src/tool/bash.tsspawns every command withdetached: trueon Linux.- On exit (success or failure — not just timeout/abort),
CommandRuntime's registeredcomplete()callback inbackend/cli/src/science/command/registry.tscallsCredentialProcessLedger.complete(). groupMembers()inbackend/cli/src/credentials/process-ledger.tswalks the full descendant tree by PPID, not just process-group membership:const descendants = new Set([entry.pid]) let changed = true while (changed) { changed = false for (const row of rows) { if (descendants.has(row.pid) || !descendants.has(row.ppid)) continue descendants.add(row.pid) selected.set(row.pid, row.pgid === entry.pid) changed = true } }
- A
setsid'd child changes its session/process-group ID but not its PPID, so it's still discovered here (withgroupBound: false).signalMember()'s guard only skips members whose group changed while stillgroupBound— a non-group-bound member goes straight toSIGKILL.
So this isn't a bug in the traditional sense — it's a deliberate, well-engineered containment guarantee. But it means there's no way to intentionally opt out of it for a specific command.
Concrete case where this bites
Running a real bioinformatics pipeline (downloading ~18 SRA runs via fasterq-dump, building STAR genome indexes) through the agent — every one of these is naturally a multi-minute-to-hour job. The agent correctly discovered it cannot background any of this across tool calls (confirmed via the mechanism above), and had to fall back to running everything synchronously inside single long-timeout bash calls, using --cache-dir for resumability when a call's timeout is hit mid-job. That works, but it's a workaround for a missing capability, not a good long-term story for any workload with real long-running jobs.
Proposed direction
A first-class, supervised background-task primitive on the bash tool — something like Claude Code's own run_in_background parameter: a command that's explicitly registered as intentionally long-lived, tracked (so list/status tooling still knows about it and it's still subject to session/project cleanup on teardown), but not torn down just because the tool call that launched it returned. The agent could then poll/check on it in later tool calls instead of needing to keep a single bash call open for the entire job duration.
Happy to discuss the design here before attempting anything — flagging per CONTRIBUTING.md's guidance that this looks like a core-behavior change, not a small bug fix. Glad to help however's useful (more repro detail, testing a prototype, etc.).
Activity
satya-arjunan commentedon Aug 31, 2026
Correction/update: after filing this, I found that
compute_job(thestartaction, withtarget: {"kind":"local"}) already provides exactly this — a detached job dispatch that survives independent of any single bash tool call, checkable later viastatus/wait/logs/artifacts.ComputeCapabilities.describe()marks thelocaltarget asavailable: trueunconditionally, no Modal/SSH setup required, and it's permitted by default for at least theresearchagent.So the premise above was incomplete — there is a supported way to do this, I just hadn't found it yet. Sorry for the noise on that front.
I think there's still a real, smaller gap worth keeping this issue open for: nothing in the bash tool's own description points toward
compute_jobfor long-running work, so an agent hitting a multi-minute-plus job has no signal to reach for it instead of shell-level backgrounding (nohup/setsid/disown), which — as traced above — gets reliably torn down. A one-line pointer in the bash tool's description (something like "for work that should outlive this call, use compute_job instead") would probably close most of the gap without any behavior change.Happy to help test/verify that framing, or close this out if you'd rather track it differently.
satya-arjunan commentedon Aug 31, 2026
Follow-up: tested this empirically (isolated project, nothing to do with the original repro) rather than just reading the source. Had an agent, via
compute_job:sleep 90 && echo JOB_COMPLETE > marker.txtstatusimmediately —runningat t≈0swait~30s, then checkstatusagain — stillrunningat t≈60s, with nothing in between keeping it alive except its own schedulewaituntil terminal —succeeded,exit_code: 0, completed at t≈91s (matchessleep 90)marker.txtfrom the job's working directory — present, exact expected contents (JOB_COMPLETE\n)So: confirmed, not just architecturally plausible — the job ran on its own clock across multiple separate tool calls with zero keep-alive from the calling agent. This matches the
FileLease/disk-backed job-tracking design injobs.ts, distinct from the bash tool's in-memoryCommandRuntimeledger that tears down on tool-call exit.Given that, I'd frame the actionable ask here as purely the documentation/discoverability nudge from my earlier comment (a line in the bash tool's description pointing toward
compute_jobfor anything long-running) rather than any new capability — the capability itself already works exactly as intended.