Skip to content

unreadable_encrypted_agent_task intermittently fails routed V2 subagent dispatch (strict recovery envelope; no retry during chatgpt.com 5xx windows) #3661

Description

@Hu9956

Bounded failure reasons landed; recovery gaps remain open

#3794 (eff908e0fb) exposes bounded recovery refusal reasons. MESSAGE support was already present. Multipart reconstruction and more precise failure attribution remain outside this delivery; an unavailable result does not prove an upstream attempt.

Verified against dev 5759d9ea2f1e7281cdc01eb9628f2e0a123fb59c. Original report by @Hu9956. The attribution record was added in #3811.

Client or integration

Codex App (ChatGPT.app bundled codex 0.153.1); same behavior verified via Codex CLI codex exec.

Area

Proxy and routing

Summary

Native ChatGPT main models dispatching V2 subagents to routed providers intermittently fail with 400 unreadable_encrypted_agent_task ("Routed V2 worker task is encrypted for the native ChatGPT backend and cannot be read by the selected provider"). Most dispatches succeed (recovery works), but two failure classes appear in long-running sessions:

  1. Delayed 400 (~5 s): recovery attempted, decode round-trip to the native backend fails. These cluster immediately after 502s from the native backend on the parent session — recovery inherits the same instability and is a single attempt with no retry.
  2. Instant 400 (10–21 ms): envelope not parseable, recovery never attempted. The 2.42.0 envelope contract in src/server/responses/agent-task-recovery.ts requires exactly one encrypted_content part, exactly one Fernet token, a plaintext Message Type: NEW_TASK header, and matching author/recipient. Anything else (e.g. MESSAGE-type follow-ups, token-split ciphertext) fails closed.

Expected: either these dispatches recover (like the majority do), or the error distinguishes "transient native-backend failure, retry plausible" from "unrecoverable payload shape".

Related: #3568 covers the MESSAGE-type follow-up half. This report adds field evidence plus two gaps that PR does not appear to address: (a) multi-part / token-split NEW_TASK envelopes are unrecoverable (encryptedPartCount !== 1 || ciphertextCount !== 1 → null), and (b) no resilience/retry when chatgpt.com is returning 5xx.

Reproduction

  1. Configure a native ChatGPT main model (gpt-5.6-luna, gpt-6-astra) with routed subagents (opencode-go/omen-alpha, volcengine-coding-plan/glm-5.3-flash, volcengine-coding-plan/deepseek-v4-flash-ga-260731).
  2. multi_agent_v2 ON, multi_agent_mode: v2, agentTaskRecovery: {"enabled": true}.
  3. Run a multi-agent session for 20+ minutes (parent spawns workers, sends follow-ups).
  4. Observe: most dispatches 200; intermittently 400 unreadable_encrypted_agent_task — either after ~5 s (decode attempt failed) or instantly (envelope unparseable). Instant failures repeat identically on retry of the same dispatch.

Observed frequency: ~6 400s out of ~190 requests across 3 sessions (~25 minutes).

Version

2.42.0

Operating system

macOS 26.0 (Apple Silicon)

Provider and model

Main (native): openai/gpt-5.6-luna, openai/gpt-6-astra (ChatGPT account, forward). Subagents (routed): opencode-go/omen-alpha, volcengine-coding-plan/glm-5.3-flash, volcengine-coding-plan/deepseek-v4-flash-ga-260731.

Logs or error output

# Class A: delayed 400 after native-backend 502 (recovery attempted, failed)
20:36:49  502  10105ms  openai/gpt-6-astra
20:36:54  400   5014ms  volcengine-coding-plan/deepseek-v4-flash-ga-260731
          requestId ocx-e0b1cc267c7d7d00237a9b51be4a62db

20:49:34  502  17125ms  openai/gpt-6-astra
20:49:34  400     12ms  volcengine-coding-plan/deepseek-v4-flash-ga-260731
          requestId ocx-5f0d7dc5b04c8a921909628e969b6b1e

# Class B: instant 400 (envelope not parseable)
20:41:54  400  14ms  opencode-go/omen-alpha  requestId ocx-9fa0c50024d78d36a4909b7c42c2d295
20:47:01  400  21ms  opencode-go/omen-alpha  requestId ocx-937dc1543871b4698efecddb542c39a7

Error body: {"error":{"message":"Routed V2 worker task is encrypted for the native ChatGPT
backend and cannot be read by the selected provider. Use plaintext V2 agent-message
delivery or select a native ChatGPT model.","type":"invalid_request_error",
"code":"unreadable_encrypted_agent_task"}}

Redacted configuration

{
  "multiAgentV2": { "enabled": true, "multiAgentMode": "v2", "keepNativeChatgptOnV1": false },
  "agentTaskRecovery": { "enabled": true },
  "providers": {
    "openai": { "adapter": "openai-responses", "authMode": "forward" },
    "opencode-go": { "adapter": "openai-chat", "authMode": "key", "apiKey": "sk-****" },
    "volcengine-coding-plan": { "adapter": "openai-chat", "authMode": "key", "apiKey": "****" }
  }
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

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

    bugSomething isn't workingplatformOS/service/tray/ACL (Windows-heavy, not Windows-only)proxyHTTP proxy, routing, reverse-proxy / management auth

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions