Skip to content

Codex: steering after a sub-agent resume targets the wrong turn id #5672

Closed

Description

@Waseemilyas

Summary

Steering a running Codex thread that has used sub-agents can target the wrong turn. After a sub-agent (child) is resumed, its turn start is treated as a root-turn lifecycle event and replaces the stored root turn id, so a later steer is sent to a stale/incorrect turn id instead of the running one.

Versions and environment

  • bb 0.46.0, Codex provider, local host
  • Code inspected at base commit 98ea40bb

Steps to reproduce

Unverified as a live deterministic repro (needs a Codex thread that spawns then resumes a sub-agent). Closest faithful repro is a translator unit test in plugins/provider-codex/src/translator.test.ts:

  1. Root turn starts; a sub-agent is spawned (spawn activity); child turn 1 starts and completes.
  2. Child turn 2 starts on the same agent thread (resume) before its follow-up activity event arrives.
  3. Follow-up activity arrives, then child turn 2 completes.

Expected vs actual

  • Expected: child turn 2 is linked to its parent tool call and never treated as the root turn; steering targets the running root turn.
  • Actual (live): in thread thr_sntrwk26wn a steer was delivered to Codex turn 01a142a5… while the running turn was 01a14239…, and the send failed.

Evidence

Cause (my reading): in translator.ts the parent-tool-call mapping for a turn start is looked up only via delegationParentToolCallIdsByProviderThreadId; a resumed child that is already tracked (findTrackedSubAgentByAgentThreadId) but not yet in that map falls through and is handled as a root turn. Also beginCodexTrackedSubAgent does not re-point existing turn-to-call mappings when the same agent thread gets a new activity id.

Fix with regression test: commit 7b2fd41.

What you ruled out

Suggested priority and effort

Medium; steering is rejected or lost on affected threads, workaround is to wait for the turn to finish. Effort likely Low.

A fix is available in #5646 (closed automatically by the new-contributor bot); happy for maintainers to take it or use it as reference.

AGENT GENERATED

Activity

  1. added theissue type on Oct 17, 2026
  2. added
    providers
    provider-codex
    confirmed-repro
    on Oct 17, 2026
  3. bb-slop-cop commented on Oct 17, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Low. Added providers and provider-codex; no existing classifications were replaced.
    • Report: https://get-bb.github.io/reports/issues/5672.html — REPRODUCED, high root-cause confidence. Applied confirmed-repro.
    • Root cause: completion clears transient delegation links; an early resumed-child start ignores retained child identity. Later activity also fails to rebind that turn to its replacement delegation.
    • Evidence: a newly authored translator/assembler regression fails on trusted main in two clean checkouts; the activity-before-start control passes. Both cases pass after the fix. Exact production-thread timing was not replayed.
    • Fix: Keep resumed Codex child lifecycles nested #5675 — ready for review, not merged; 78 changed text lines across two files. All 371 provider tests, lint, typecheck, and git diff --check pass.
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

    confirmed-reproprovider-codexproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions