Skip to content

Unexpected reconnection using /goal #2260

Closed

Description

@awoodendoor

Client or integration

Codex App

Area

Tools / MCP / web search

Summary

I using /goal command, the output sometimes ends with
stream disconnected before completion: routed provider emitted undeclared client tool "update_plan"; only request-declared tools may be called and stream disconnected before completion: upstream stream ended without a terminal signal ([DONE] or finish_reason) — possible truncation

Reproduction

  1. ocx start
  2. start ChatGPT app
  3. select opencode-go/deepseek-v4-flash
  4. send any message, for the second error, use /goal command

Version

2.26.0

Operating system

macOS 15.7.7

Provider and model

opencode-go/deepseek-v4-flash

Logs or error output

{
  "requestId": "ocx-mt2fd1a3-124",
  "timestamp": 1787285032635,
  "model": "deepseek-v4-flash",
  "provider": "opencode-go",
  "admissionKind": "loopback",
  "inboundProtocol": "responses",
  "conversationId": "393c1bce9269abef61f3dd19cfa00df2",
  "requestedModel": "opencode-go/deepseek-v4-flash",
  "requestedEffort": "high",
  "effectiveEffort": "high",
  "reasoningWireField": "reasoning_effort",
  "reasoningWireValue": "high",
  "modelSupportsServiceTier": false,
  "tierOutcome": {
    "wireKind": null,
    "wireValue": null,
    "fastOutcome": "unknown",
    "confirmation": "unknown"
  },
  "resolvedModel": "deepseek-v4-flash",
  "status": 502,
  "durationMs": 178442,
  "firstOutputMs": 21340,
  "errorCode": "upstream_server_error",
  "terminalStatus": "failed",
  "closeReason": "terminal",
  "upstreamError": "upstream stream ended without a terminal signal ([DONE] or finish_reason) — possible truncation",
  "usageStatus": "unreported",
  "attempts": [
    {
      "ordinal": 1,
      "provider": "opencode-go",
      "model": "deepseek-v4-flash",
      "adapter": "openai-chat",
      "status": 502,
      "durationMs": 178426,
      "sendCount": 1,
      "recoveryKinds": [],
      "usageStatus": "unreported",
      "requestedEffort": "high",
      "effectiveEffort": "high",
      "reasoningWireField": "reasoning_effort",
      "reasoningWireValue": "high",
      "tierOutcome": {
        "wireKind": null,
        "wireValue": null,
        "fastOutcome": "unknown",
        "confirmation": "unknown"
      },
      "firstOutputMs": 21324,
      "errorCode": "upstream_server_error",
      "displayMetrics": {
        "tokPerSecond": {
          "kind": "unavailable",
          "reason": "usage_missing"
        },
        "cost": {
          "kind": "unavailable",
          "reason": "usage_missing"
        }
      }
    }
  ],
  "transportPhase": "terminal_sse",
  "terminalSource": "upstream",
  "routeDecision": {
    "version": 1,
    "decisionId": "823b570d7167",
    "createdAt": 1787285032650,
    "requestedModel": "opencode-go/deepseek-v4-flash",
    "routeKind": "explicit-provider",
    "requirements": [],
    "candidates": [
      {
        "provider": "opencode-go",
        "model": "deepseek-v4-flash",
        "eligible": true,
        "exclusions": []
      }
    ],
    "selected": {
      "candidateIndex": 0,
      "provider": "opencode-go",
      "model": "deepseek-v4-flash",
      "reason": "explicit-provider-namespace"
    }
  },
  "displayMetrics": {
    "tokPerSecond": {
      "kind": "unavailable",
      "reason": "usage_missing"
    },
    "cost": {
      "kind": "unavailable",
      "reason": "combo_attempt_unavailable"
    }
  }
}


{
  "requestId": "ocx-mt2epm8k-11a",
  "timestamp": 1787283940052,
  "model": "deepseek-v4-flash",
  "provider": "opencode-go",
  "admissionKind": "loopback",
  "inboundProtocol": "responses",
  "conversationId": "393c1bce9269abef61f3dd19cfa00df2",
  "requestedModel": "opencode-go/deepseek-v4-flash",
  "requestedEffort": "high",
  "effectiveEffort": "high",
  "reasoningWireField": "reasoning_effort",
  "reasoningWireValue": "high",
  "modelSupportsServiceTier": false,
  "tierOutcome": {
    "wireKind": null,
    "wireValue": null,
    "fastOutcome": "unknown",
    "confirmation": "unknown"
  },
  "resolvedModel": "deepseek-v4-flash",
  "status": 502,
  "durationMs": 163873,
  "firstOutputMs": 2296,
  "errorCode": "upstream_server_error",
  "terminalStatus": "failed",
  "closeReason": "terminal",
  "upstreamError": "routed provider emitted undeclared client tool \"update_plan\"; only request-declared tools may be called",
  "usageStatus": "unreported",
  "attempts": [
    {
      "ordinal": 1,
      "provider": "opencode-go",
      "model": "deepseek-v4-flash",
      "adapter": "openai-chat",
      "status": 502,
      "durationMs": 163857,
      "sendCount": 1,
      "recoveryKinds": [],
      "usageStatus": "unreported",
      "requestedEffort": "high",
      "effectiveEffort": "high",
      "reasoningWireField": "reasoning_effort",
      "reasoningWireValue": "high",
      "tierOutcome": {
        "wireKind": null,
        "wireValue": null,
        "fastOutcome": "unknown",
        "confirmation": "unknown"
      },
      "firstOutputMs": 2280,
      "errorCode": "upstream_server_error",
      "displayMetrics": {
        "tokPerSecond": {
          "kind": "unavailable",
          "reason": "usage_missing"
        },
        "cost": {
          "kind": "unavailable",
          "reason": "usage_missing"
        }
      }
    }
  ],
  "transportPhase": "terminal_sse",
  "terminalSource": "upstream",
  "routeDecision": {
    "version": 1,
    "decisionId": "76324fa5a846",
    "createdAt": 1787283940065,
    "requestedModel": "opencode-go/deepseek-v4-flash",
    "routeKind": "explicit-provider",
    "requirements": [],
    "candidates": [
      {
        "provider": "opencode-go",
        "model": "deepseek-v4-flash",
        "eligible": true,
        "exclusions": []
      }
    ],
    "selected": {
      "candidateIndex": 0,
      "provider": "opencode-go",
      "model": "deepseek-v4-flash",
      "reason": "explicit-provider-namespace"
    }
  },
  "displayMetrics": {
    "tokPerSecond": {
      "kind": "unavailable",
      "reason": "usage_missing"
    },
    "cost": {
      "kind": "unavailable",
      "reason": "combo_attempt_unavailable"
    }
  }
}

Screenshots and supporting files

No response

Redacted configuration

config.toml
model_provider = "custom"
openai_base_url = ""
model_catalog_json = "~/.codex/opencodex-catalog.json"
model = "opencode-go/deepseek-v4-flash"
model_reasoning_effort = "high"

[model_providers.custom]
name = "custom"
base_url = "http://localhost:10100/v1"

Checks

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

Activity

  1. added
    bug
    on Aug 21, 2026
  2. added
    streaming
    tools
    on Aug 21, 2026
  3. Ingwannu commented on Aug 21, 2026

    @Ingwannu
    Owner

    I checked this against current dev. The report contains two separate failures, and I do not want to weaken the undeclared-tool guard to hide either one.

    1. routed provider emitted undeclared client tool "update_plan" is the intentional fail-closed boundary. For a routed provider, OCX may relay only client tools authorized by that turn's request/tool-choice. Executing or replaying an undeclared update_plan call would be incorrect and unsafe. The current guard and bridge regressions pass (93 focused tests).
    2. upstream stream ended without a terminal signal is emitted by the OpenAI-compatible Chat adapter when opencode-go closes after partial output without [DONE] or a terminal finish_reason. That is a distinct provider/stream-contract failure; inventing a successful terminal response could commit truncated tool state.

    What is still unknown is why deepseek-v4-flash produced update_plan: either the Codex /goal turn did not authorize it, or the adapter/provider omitted or ignored an authorized declaration. The request log does not include the redacted outbound tool catalog, so the supplied logs cannot distinguish those cases.

    Please retest on the current stable release, 2.28.0, and attach:

    • the new request-log entry for the failing turn;
    • whether an ordinary non-/goal turn with the same model succeeds;
    • a privacy-redacted capture containing only tool_choice and the tool names/types sent upstream (no prompts, arguments, tokens, headers, account IDs, or URLs containing credentials).

    I am marking this needs-info and keeping it open. If update_plan is present and authorized in that outbound catalog but OCX still rejects the returned call, that is an OCX catalog/alias bug and I will add the focused /goal regression. If it is absent, the guard is behaving correctly and the remaining fix belongs in provider compatibility/guidance rather than execution authorization.

  4. added
    needs-info
    on Aug 21, 2026
  5. lidge-jun commented on Aug 21, 2026

    @lidge-jun
    Owner

    Both symptoms addressed on dev (will ship in 2.28.0), via #2271:\n\n1. The undeclared update_plan drop was fixed earlier by the Codex 0.147 functions-namespace flattening (5f2b939) and is now locked by a real-server regression: update_plan stays declared through the Responses->Chat translation on the opencode-go lane.\n2. The terminal-signal drop reproduced on current dev: opencode-go can close the stream after a complete tool-call delta without finish_reason or [DONE]. The chat adapter now accepts that EOF for opencode-go only when every pending call carries a name and complete JSON-object arguments — genuinely truncated calls still fail loudly.\n\nIf you still see either error on 2.28.0+, please attach the Logs & Debug entry for the failing request.

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

    bugneeds-infostreamingtools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions