Skip to content

🤖 feat: cross-backend evidence for background processes in SSH, Docker, dev container and multi-project workspaces #4889

Open

Description

@ThomasK33

Problem

Split out of #4857, whose MCP server, init hook and one-off command leases landed separately. Two background-process gaps from its comments remain:

  1. Remote background records are invisible to the structural mutation gate. The gate (acquireStructuralMutationGate) sees background processes through host-local spawn records (hasOrphanedRunningBackgroundProcesses, plus bind-mounted devcontainer records). For SSH/Coder and Docker workspaces the records live on the remote host or inside the container, so another backend's background command there does not make rename, remove or a checkout-deleting archive refuse.
  2. No cross-backend name claim outside host-local runtimes. spawnRecordsAreHostLocal classifies MultiProjectRuntime (local multi-project workspaces), SSH/Coder, Docker and devcontainer as non-host, so two backends that start same-named background commands there at the same time can share a spawn directory (🤖 fix: claim background process names across backends #4874 fixed host-local runtimes only).

Proposed fix

  • Have BackgroundProcessManager hold a host-local workspace use lease (WorkspaceUseLeases.hold, a new kind or exec) per workspace while it tracks a running process there, for every runtime.
  • Treat local multi-project records as host-local for the spawn-name claim (or claim names through a host-local lock keyed by workspace).

Not done in #4857's PR because BackgroundProcessManager is being changed concurrently for #4878/#4882; this should land after those.

Refs #4857, #4476


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Activity

  1. linear-code commented on Sep 27, 2026

    @linear-code
  2. ThomasK33 commented on Sep 28, 2026

    @ThomasK33
    MemberAuthor

    Coordinator triage (2026-09-28): parking this in the backlog. Every multi-backend fix today (#4861 #4866 #4874 #4890 #4900 #4904 #4907 #4908 #4915 #4917 #4919 #4921 #4922 #4923 #4929) produced 1–3 new residual issues like this one. Each residual needs two user actions in two apps at once, or new persisted mechanism. We will pick these up when dogfooding of concurrent desktop + xum server use shows one of them actually happens, rather than keep adding mechanism.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

  3. ThomasK33 commented on Oct 2, 2026

    @ThomasK33
    MemberAuthor

    #5464 adds a TLA+ model and a deterministic repro for part of this issue. It does not fix it.

    Reproduced part: on runtimes whose records are not host-local (SSH/Coder, Docker, devcontainer, multi-project), backends share no record-name lock, and the name probe in backgroundProcessManager.ts treats a record that has exit_code as free. So a second backend reinitialises a record directory that the first backend still tracks.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

  4. ThomasK33 commented on Oct 2, 2026

    @ThomasK33
    MemberAuthor

    #5486 (merged as eaead8d) fixes the reproduced part of this issue: on non-host runtimes (SSH/Coder, Docker, devcontainer, multi-project) a second backend no longer reinitialises a background record directory another backend still tracks.

    • Spawn now claims the record name with an atomic mkdir (no -p) on the runtime. Any existing directory, including a settled one with exit_code, counts as taken, so the second backend gets a suffixed name. No new persisted state.
    • Formal model: BgSpawnName.tla gained an AtomicClaim fix probe. MC_name_remote_fixed holds NoReuseWhileTracked and OneProcessPerDir. The faithful MC_name_remote* configs still describe the old code.
    • Repro #4889: … B does not reinitialise the record directory A still tracks is now a plain test, and it fails at its target with the fix reverted.

    Not covered here, so this issue stays open: the broader cross-backend evidence requirements for SSH/Docker/multi-project. Follow-up for the cost this fix adds (remote names reused across sessions grow suffixes): #5485.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $10.41

  5. added
    investigation
    on Oct 9, 2026
  6. ThomasK33 commented on Oct 19, 2026

    @ThomasK33
    MemberAuthor

    Merged into this issue from the backlog triage (2026-10-19): #5485. An agent read every issue in this group and found that one worker can handle them together with this issue, so their open items now live here:

    The merged issues are closed with a pointer back here. Reopen one if it needs its own tracker.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh • Cost: $17.91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backloginvestigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions