GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OpenAI cyber_policy refusals are classified as UnknownProvider instead of ContentPolicy · Issue #64843 · anomalyco/opencode

OpenAI cyber_policy refusals are classified as UnknownProvider instead of ContentPolicy #64843

New issue
Copy link
New issue
Copy link
Closed
#64844
Closed
OpenAI cyber_policy refusals are classified as UnknownProvider instead of ContentPolicy#64843
#64844
Copy link
Labels
area/providersProviders and model listsplatform/linuxLinuxstatus/repro-simulatedReproduced with a simulated model or mocktype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@lu-zero
lu-zero
opened on Nov 19, 2026
Issue body actions

Description

OpenAI's cybersecurity safeguard rejects a turn with the error code cyber_policy, either as an HTTP 400 or as an error frame in the middle of a Responses stream. classifyProviderFailure does not know that code and the message does not match CONTENT_POLICY_TEXT, so the failure becomes UnknownProvider (provider.unknown) instead of ContentPolicy (provider.content-filter).

Clients that react to content-policy failures (for example by switching to another model) cannot tell this refusal apart from a transient unknown error, and the session retry policy treats it as retry-eligible even though retrying the same model gets the same refusal.

OpenCode version

2.3.2

Steps to reproduce

  1. Run a session on an OpenAI Responses model (seen with gpt-6.1-sol) with a prompt that trips the cyber safeguard.
  2. The stream carries {"type":"error","code":"cyber_policy","message":"This content was flagged for possible cybersecurity risk. ..."}.
  3. The session fails with provider.unknown and message cyber_policy: This content was flagged for possible cybersecurity risk. ..., not provider.content-filter.

Operating System

Linux (sandboxed server, opencode serve --stdio)

Activity

  1. opencodejr
    added
    area/providersProviders and model lists
    platform/linuxLinux
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 19, 2026
  2. opencodejr commented on Nov 19, 2026

    @opencodejr
    opencodejrBot
    on Nov 19, 2026
    Contributor
    More actions

    Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.

    Thanks for the precise report. I reproduced this on 2.3.2, using a local mock of the OpenAI Responses endpoint because I have no OpenAI credentials. The mock sends response.created and then an error frame with code: "cyber_policy".

    opencode run --format json -m openai/gpt-5 reported the failure as provider.unknown and retried it about 10 times before failing with the same provider.unknown error, instead of provider.content-filter. The behaviour is the same on the latest dev (d33b578).

    One detail: when I sent the same code as an HTTP 400, it was reported as provider.invalid-request and not retried. That is still not a content-filter error, but provider.unknown and the retry loop only showed up for the mid-stream error frame.

    The script below reproduces it. Your PR #64844 addresses this.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Reproduces #64843: an OpenAI Responses stream `error` frame with code `cyber_policy`
    # is classified as provider.unknown (and retried) instead of provider.content-filter.
    # Needs bun and `opencode` on PATH (bun add -g @opencode/[email protected]).
    # Set OC_DEV=/path/to/checkout to run the CLI from source instead.
    set -euo pipefail
    DIR=$(mktemp -d); cd "$DIR"
    cat > mock.ts <<'TS'
    const msg = "This content was flagged for possible cybersecurity risk. If this seems wrong, try rephrasing your request."
    Bun.serve({ port: 4555, fetch(req) {
      if (!new URL(req.url).pathname.endsWith("/responses")) return new Response("not found", { status: 404 })
      const frames = [
        { type: "response.created", sequence_number: 0, response: { id: "resp_1", object: "response", status: "in_progress", model: "gpt-5", output: [] } },
        { type: "error", sequence_number: 1, code: "cyber_policy", message: msg, param: null },
      ]
      return new Response(frames.map((f) => `event: ${f.type}\ndata: ${JSON.stringify(f)}\n\n`).join(""), { headers: { "content-type": "text/event-stream" } })
    } })
    TS
    bun mock.ts & MOCK=$!; trap 'kill $MOCK' EXIT; sleep 1
    mkdir proj && cd proj && git init -q
    echo '{ "providers": { "openai": { "settings": { "baseURL": "http://127.0.0.1:4555/v1" } } } }' > opencode.jsonc
    export OPENAI_API_KEY=sk-test
    if [ -n "${OC_DEV:-}" ]; then
      # From source, --standalone cannot spawn its child server, so start one with `serve`.
      OC=(bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js" "$OC_DEV/packages/cli/src/index.ts")
      "${OC[@]}" serve --port 4778 > ../serve.log 2>&1 & SRV=$!; trap 'kill $MOCK $SRV' EXIT
      until grep -q "server password" ../serve.log 2>/dev/null; do sleep 1; done
      export OPENCODE_PASSWORD=$(awk '/server password/ {print $3}' ../serve.log)
      TARGET=(--server http://127.0.0.1:4778)
    else OC=(opencode); TARGET=(--standalone); fi
    "${OC[@]}" --version
    # Stop after the first error/retry event: on the affected version the run keeps retrying for ~90s.
    timeout 120 "${OC[@]}" run "${TARGET[@]}" --format json -m openai/gpt-5 "hello" 2>&1 \
      | grep -m1 -E '"type":"(retry|error)"' | grep -o '"error":{"type":"[^"]*"' || true
    # Affected: "error":{"type":"provider.unknown"   Expected: "error":{"type":"provider.content-filter"

    Run it: bash repro.sh

  3. opencodejr
    added
    status/repro-simulatedReproduced with a simulated model or mock
    on Nov 19, 2026
  4. neriousy
    closed this as completedin #64844on Nov 19, 2026
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

    area/providersProviders and model listsplatform/linuxLinuxstatus/repro-simulatedReproduced with a simulated model or mocktype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.