Skip to content

fix(opencode): emit redaction-safe provider failure envelope before approval settlement #2112

Description

@seonghobae

Problem

Exact-head OpenCode on .github#2106@24bb6591ab7df23558cb793b4af60c567ff9da97 failed after the CodeQL bootstrap itself had converged. Run 34693400612 reached the model call through contextual-orchestrator/orchestrator/free, then published only:

OpenCode provider failure metadata: class=provider-error json-bytes=836 stderr-bytes=0; provider-controlled content suppressed.

The corresponding opencode-review commit status is failure: No validated exact-current-head OpenCode approval was published (model outcome: exhausted).

The current protected-main implementation is scripts/ci/run_opencode_review_model_pool.sh; its failure classifier collapses any non-empty JSON/stderr response into provider-error and emits byte counts only. That preserves redaction, but it discards the bounded machine-readable metadata needed to decide whether the causal owner is queue admission, route exhaustion, HTTP 429/5xx, malformed provider JSON, request size, served-model omission, or another gateway/provider class.

This matters because the same run spent about 486 s establishing sidecar health/provider-route preflight, invoked only the required contextual-orchestrator/orchestrator/free route, then failed roughly five seconds after the request. The current log does not contain enough safe evidence to attribute that five-second failure to the correct owner. It must not be guessed to be the separate 90-second implicit-timeout defect or repaired by source-neutral reruns.

Required repair

At the OpenCode adapter/normalization boundary, parse a bounded failure envelope from the orchestrator response and emit only redaction-safe fields:

  • phase;
  • normalized reason/class;
  • provider identifier when present;
  • HTTP status or exception class when present;
  • request/response duration;
  • served model when present;
  • explicit absence markers for fields the gateway did not return.

Provider-controlled message/body text, prompts, credentials, headers, source contents, and arbitrary nested payloads remain suppressed.

The status/verdict contract remains fail-closed: richer telemetry is diagnostic evidence only and must not turn provider failure into approval, clean review evidence, or a merge bypass.

Test-first acceptance

Add production-shaped fixtures for at least:

  1. HTTP 429 / queue-capacity or rate-limit response;
  2. provider 5xx;
  3. malformed/non-JSON body;
  4. request-too-large / payload admission failure;
  5. model-pool exhaustion or no eligible route;
  6. response with missing served-model metadata;
  7. a response containing secrets/body text proving none of that content reaches stdout/status/annotations.

For each fixture, assert the bounded normalized metadata that is emitted and assert raw provider-controlled content is absent. Preserve the existing single orchestrator/free route, gateway-token boundary, provider/model non-hard-coding, and no caller-side retry or timeout invention.

Exact evidence / non-goals

  • consumer PR: .github#2106@24bb6591ab7df23558cb793b4af60c567ff9da97;
  • OpenCode run: 34693400612;
  • current CodeQL run on that same head: 34692079677, terminal success;
  • current CodeQL dispatch contexts: codeql-dispatch/actions and codeql-dispatch/python, both success;
  • current OpenCode status remains failure solely because no validated exact-head approval was published after model exhaustion.

Do not manually rerun #2106, manufacture a status, expose provider bodies, add provider/model/group fallbacks, enable paid routing, or weaken required review semantics to close this issue. The repair belongs in the central OpenCode adapter/telemetry owner and should be followed by an unchanged-head review replay only after the owner fix is protected/released according to the existing central contract.

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

    area: ci-cdCI, GitHub Actions, checks, release, or supply chainbugSomething isn't workingpriority: highHigh-priority or P1 work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions