Skip to content

Switching a thread's provider leaves the previous OpenCode session's background work running #30430

Open

Description

@royalaid

What happened. A thread ran on OpenCode, then the user switched it to Codex. The earlier OpenCode session (ses_…) kept running native background tools in the pooled OpenCode server after the switch. It went on writing files and launched two jobs against the same disposable database at the same time as the new Codex coordinator. The new provider's delegate_task calls failed with parent_not_active.

Expected. A provider switch leaves one active execution owner. Detaching the old provider stops its conversation and the background work under it, or at least reports that the work is still running.

Cause, from a local patch we did not ship. Explicit detach only interrupts turns still marked running. A turn that has completed but still has nested background tools is left alone, and the native unload keeps conversations that have background work. Telling explicit detach apart from idle eviction fixes it. On detach, fence new turns and wake delivery, stop the conversation and its known descendants, and unload the bindings once the native stops succeed. A failed stop keeps the attachment so it can be retried. A regression test (a completed parent with a nested background tool) failed before the change and passed after it.

Environment. macOS (Apple silicon), T3 Code with Codex and OpenCode providers, 2 Nov 2026.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions