Skip to content

opencode config guard: fail CI when a metered/PAYG provider (cloudflare-*) is a route target or default without an explicit exception #2288

Closed

Description

@dezren39

Problem

The fleet's standing rule is plan quotas only, never PAYG — but nothing enforces it at the config layer. In October 2026 that gap cost real money: OpenCode sessions burned 4,114,515 Workers AI neurons (~$44.95 estimated) because a metered provider was selectable as a session model and sat in route fallbacks. The providers are disabled now; this issue makes the mistake structurally hard to repeat.

Verified facts (Workers AI cost investigation, 2026-10-29)

  • 99.2% of the burn was one model — @cf/deepseek-ai/deepseek-v4-pro-0813 — via the cloudflare-gateway provider in the laptop's OpenCode config, in a two-day burst Oct 24–25 (sessions under ~/work/id-train/).
  • Mechanism: every agent turn re-sent a ~200–500k-token context and Workers AI bills full input per call (336M cache-read tokens billed, not free).
  • Workers AI is PAYG beyond 10k free neurons/day — there is no plan allowance to burn against, so it should never have been a workhorse/route target.
  • Current state: cloudflare-gateway, cloudflare-workers-ai, and cloudflare-ai-gateway are all in disabled_providers; usage has been zero since Oct 25.

Ask

Add a config-level guard on the canonical pool config (this repo's .opencode/opencode.jsonc, the config-canonical source) so a PAYG/metered provider cannot silently become a route target or default again:

  • Maintain an explicit metered-provider designation (the cloudflare-* providers, plus any provider whose billing is per-call metered rather than a plan allowance).
  • A schema/CI check that fails when a metered provider appears in route targets, fallbacks, or session defaults — unless the config carries an explicit, visible exception marker at that spot (so any future exception is a deliberate, reviewable act, not an accident).
  • Document the exception mechanism in ci-policy.md or in the config itself.

Acceptance criteria

  • The check fails on a fixture config naming cloudflare-gateway as a route fallback without an exception marker.
  • The check passes on the current canonical config (Cloudflare providers disabled, no metered route targets).
  • A fixture with a properly marked exception passes, and the marker format is documented in ci-policy.md or the config.
  • The check runs in CI on changes to .opencode/opencode.jsonc.

Related: the companion collector alert issue (neurons/day threshold in pm-stack/cloudflare-export/) covers detection; this one covers prevention.

Activity

  1. added
    kind/ciCI/CD pipelines, workflows, and build automation
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/queue-workerFiled or worked by the queue/worker pilot
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  3. added
    priority/highImportant and time-sensitive
    queue/queuedHas a queued task in the Supabase agent queue
    area/ciCI/CD pipelines, workflows, and build automation (area)
    effort/mMedium: expected under 1 day of work
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  6. 99 remaining items

  7. added and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  8. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — holder: repo-worker-code (OpenChamber scheduled lane), at=2026-11-02T14:59:18Z. event: parked; task: 5235; queue: repo-health-code-pilot. PR #4165 remains OPEN, non-draft, Drew-authored/assigned and bound to this task. Prior note says CI + fresh Codex disposition are pending. Hard stop: no PR contents/checks/reviews/branch/worktree/source inspection or edits, no competing PR. Resume after owner release/PR resolution and revalidate all state.

  9. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 2, 2026
  10. added a commit that references this issue on Nov 2, 2026
  11. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked_up
    task: 5235 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane)
    state: claimed; resumed from prior verification that canonical PR #4165 binds this task
    next: Revalidate #2288 and #4165 metadata only. The PR, branch, worktree, and source are untouched under the Drew-owned hard stop.

  12. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: done
    task: 5235 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane)
    state: done (already_done)
    evidence: Fresh gh metadata confirmed #2288 CLOSED and canonical PR #4165 MERGED. Queue task completed with outcome=already_done. PR contents, branch, worktree, and source were not inspected or touched.
    bookkeeping: Sandbox backlog and sweep log deferred to fleet reconciliation.

  13. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/ciCI/CD pipelines, workflows, and build automation (area)effort/mMedium: expected under 1 day of workkind/ciCI/CD pipelines, workflows, and build automationpriority/highImportant and time-sensitivesource/queue-workerFiled or worked by the queue/worker pilottask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions