Skip to content

factory: the vendored opencode action's version step uses an unauthenticated curl, which fails or hangs and takes down every agent run #870

Closed

Description

@LSantha

factory: the vendored opencode action's version step fetches the latest release with an unauthenticated curl, which fails or hangs and takes down every agent run


Summary

Every opencode.yml (and triage.yml, wiki-update.yml) run executes a step inside the vendored action anomalyco/opencode/github@latest whose id is run_agent.version:

VERSION=$(curl -sf https://api.github.com/repos/anomalyco/opencode/releases/latest | ...)

The curl carries no Authorization header. Unauthenticated requests to api.github.com are rate-limited per IP, and GitHub-hosted runners share NAT IPs, so from a busy runner the limit is regularly exhausted. -f turns the 403 into exit code 1, the step fails, the agent step is skipped (outcome=skipped) and the whole run concludes failure with nothing done. On other runs the same curl appears to hang indefinitely, producing a run that sits in_progress for 45+ minutes with no output.


Evidence

Run 42396752964 (17:31:44Z, the first /oc review on PR #869):

17:33:45.16 [start-action display=Get opencode version; id=run_agent.version]
17:33:45.16   VERSION=$(curl -sf https://api.github.com/repos/anomalyco/opencode/releases/latest ...)
17:33:45.29 ##[error]Process completed with exit code 1.
17:33:45.29 [end-action id=run_agent.version; outcome=failure; conclusion=failure; duration_ms=138]
17:33:45.29 [start-action display=Run opencode; id=run_agent.run_opencode]
17:33:45.29 [end-action id=run_agent.run_opencode; outcome=skipped; conclusion=skipped; duration_ms=0]
17:33:45.38 Post-step ... Decision: agent/failed (run concluded: failure)

duration_ms=138 - a fast refusal, not a network stall. The agent never started; the post-step applied agent/failed to ticket #869's PR.

The same class took down four further runs that evening (17:28, 17:31, and four at 18:24), which sat in_progress for 40-45 minutes with no comment posted - and each had to be cancelled by hand before the loop could continue.


Why it matters

  1. One unauthenticated HTTPS call from a vendored action is a single point of failure for the entire agentic pipeline. It is invisible: the failure surfaces as agent/failed on a ticket that was never attempted, which reads as an agent failure rather than infrastructure.
  2. The 45-minute wedges cost real wall-clock time and manual cancellation every time, and they mask genuine agent work (a maintainer cannot distinguish a wedged run from a busy one without reading logs that do not exist for in-progress runs).
  3. Versions are fetched at all only because the workflows reference @latest.

What to look at

  • .github/workflows/opencode.yml, triage.yml, wiki-update.yml - the anomalyco/opencode/github@latest step. Options, cheapest first:
    1. Pin each to a release tag (e.g. @v2.2.6) or a commit SHA. If the action honours an explicit version input, the pre-step curl disappears; if it still resolves latest internally, at least a pinned ref removes surprise upgrades. Check the action's own metadata for a version input first.
    2. If the curl cannot be avoided, give the run's steps a timeout (timeout-minutes on the step) so a hang fails fast instead of wedging, and export GITHUB_TOKEN in the step env (many such actions fall back to it when present).
  • Whatever is chosen, add a check that a failed agent step is distinguishable from infrastructure: the run name or an env marker that names run_agent.version as the cause would stop the agent/failed misattribution.

Acceptance criteria

  • With the chosen pin/token/timeout in place, an opencode.yml run whose run_agent.version step would have failed now either runs the agent or fails fast (minutes, not 45) with a name that points at the version step, not at the agent.
  • A test or a documented manual check verifies the agent step still runs end to end after the change (one /oc review round trip on any ticket).
  • triage.yml and wiki-update.yml are updated the same way; a grep for @latest over .github/workflows/*.yml returns nothing new.

Correction (later the same evening): only half of this is proven

A mitigation commit (workflows: bound the vendored opencode step ...) added timeout-minutes: 5 to the Run opencode step in all three workflows, on the theory that the version curl was hanging and wedging runs. Its first run disproved the wedge half:

42407186680  19:40:34  [start-action display=Get opencode version; id=run_agent.version]
42407186680  19:40:34  [end-action   id=run_agent.version; outcome=success; duration_ms=239]
42407186680  19:40:36  [start-action display=Run opencode; id=run_agent.run_opencode]
42407186680  19:45:46  ##[error]The action has timed out.
42407186680  19:45:46  [end-action   id=run_agent.run_opencode; outcome=failure; duration_ms=310648]

The version curl succeeded in 239ms, and the five minutes were spent by the agent itself, which my cap then killed. The cap was applied to the whole Run opencode step - version fetch and agent work - not to the fetch, so it aborts legitimate tickets. It has been reverted (a142246c15).

What remains proven: the curl fails fast sometimes (run 42396752964, 138ms, exit 1, agent step skipped) - that is the #870 defect and the -f/unauthenticated diagnosis stands.

What is NOT proven: that the same curl caused the 40-45 minute in_progress wedges. Those runs never produced a readable log, and the observed symptom matches the documented opencode client wedge (AGENTS.md: "75+ minutes of silence after ~11 minutes of work, every nudge blocked"), whose instrument is the watchdog's WATCHDOG_RUN_STALE_MIN rule - not a step timeout. Anyone re-diagnosing this should start from a wedged run's log, not from the one fast failure.


Second correction: the wedge is the AGENT step, and this is now proven, not inferred

Step-level state for every run cancelled during the outage (the jobs API keeps step conclusions after cancellation; the log blob is deleted, so this is the only surviving evidence):

run 42396708704  #869 review  17:31:16 -> cancelled 18:23:52   steps 1-11 success, 12 "Run opencode" cancelled
run 42396955223  #869 review  17:34:11 -> cancelled 18:23:50   steps 1-11 success, 12 "Run opencode" cancelled
run 42396466453  #868 DEV     17:28:21 -> cancelled 18:23:54   steps 1-11 success, 12 "Run opencode" cancelled
run 42404202466  #868 DEV     19:02:02 -> cancelled 20:32:18   steps 1-11 success, 12 "Run opencode" cancelled
run 42414325324  #869 review  21:07:22 -> cancelled 21:45:53   steps 1-11 success, 12 "Run opencode" cancelled
run 42414337985  #866 DEV     21:07:32 -> cancelled 21:45:56   steps 1-11 success, 12 "Run opencode" cancelled
run 42415342242  #869 review  21:19:58 -> cancelled 21:45:55   steps 1-11 success, 12 "Run opencode" cancelled
run 42415540057  #869 review  21:22:18 -> cancelled 21:45:55   steps 1-11 success, 12 "Run opencode" cancelled

Steps 1-11 (checkout, dedupe guard, model selection, JDK 8, QEMU, ISO build) succeeded in every case, so the version pre-step is reached and passed - consistent with the one readable failure log where it succeeded in 239 ms. The wedge is always inside step 12, the agent itself: 23 to 90 minutes of no output, and not one of the eight produced a comment, a verdict or a PR.

So the defect is the documented client wedge in AGENTS.md ("the opencode client can wedge with status stuck at in_progress... 75+ minutes of silence"), and the instrument that already exists for it is the watchdog's WATCHDOG_RUN_STALE_MIN cancellation - which never fired tonight because WATCHDOG_DRY_RUN is still 1 in the scheduled sweeps. Two actions follow from that, neither of which is a workflow change:

  1. Turn the watchdog's cancellation on for the scheduled sweeps (flip the default to 0, or set the secret), since eight hand-cancelled runs is exactly the evidence the dry-run period was meant to gather.
  2. Keep the title/accent of this ticket on the fast-fail half (the unauthenticated curl in run 42396752964, 138 ms, exit 1), which is real and separate: a hung agent vs. a refused version fetch need different fixes and only the second is fixed by pinning or authenticating the fetch.

FINAL: root cause is the inference account's quota, and it is not a repo defect

Run 42407186680 is the only run tonight whose log survived, and its agent step (step 12) contains the answer verbatim:

19:40:37  opencode session ses_e487909a1ffeJTzOSFynuY3HqA  (projectID 84b9a6a02..., v1.19.5)
19:40:38  INFO stream { providerID: "opencode", modelID: "gpt-5.4-nano", agent: "title", small: true }
19:40:38  INFO llm runtime selected { llm.provider: "opencode", llm.model: "gpt-5.4-nano" }
19:40:38  ERROR stream error { url: "https://opencode.ai/inference/openai/v1/responses",
                               statusCode: 402, isRetryable: false,
                               responseBody: {"error":{"type":"invalid_request_error",
                                             "message":"Insufficient account funds"}} }
          AI_APICallError: Insufficient account funds
          AI_APICallError: Free usage limit reached. Free models work in OpenCode
                           (https://opencode.ai); subscribe to OpenCode Go to keep going:
                           https://opencode.ai/go     isRetryable: true
          <no further output for the remaining 5m10s of the step>

So the wedge is not the version curl, and not the documented client bug: the opencode.ai inference account is out of funds/quota. The first call the agent makes (the tiny gpt-5.4-nano title model) is refused with 402 Insufficient account funds, and a second refusal is explicitly isRetryable: true - so the client retries forever, produces no output, and never exits. That is the exact signature of all eight cancelled runs: setup steps 1-11 green, step 12 silent until cancellation, zero comments.

Nothing in this repository can fix it. Two routes, both outside today's scope:

  1. Account side (immediate): top up / subscribe on opencode.ai (the "OpenCode Go" link above). Every pending run then proceeds normally - the rest of the pipeline is healthy (CI, reviews, my validation all ran fine tonight).
  2. Repo side (a decision, not a fix): re-route the three roles in .github/scripts/model-config.js from the opencode/ gateway to OpenRouter, whose key the workflow already exports as OPENROUTER_API_KEY. Checked and this is NOT a prefix swap: crouton-alpha-free, inkling-2-small-free and deepseek-v4.1-flash-free do not exist on OpenRouter, so the map would need real model IDs (and OpenRouter's own credit/free-tier limits). That is a model-selection decision for the maintainer, not a bug fix.

Retained from earlier corrections, still true: the unauthenticated version curl in the vendored action fails fast sometimes (run 42396752964, 138 ms, exit 1) - a separate, real defect worth pinning/authenticating - and my timeout-minutes: 5 mitigation was wrong and is reverted (a142246c15).


Investigation update (2026-11-21)

Re-checked against current master 066f0d0d89. The issue is still valid; no part of it has been fixed. New evidence and one correction to the original proposal:

  1. Still unpinned, all three workflows. grep -rn "@latest" .github/workflows/*.yml returns:
    opencode.yml:160, triage.yml:70, wiki-update.yml:81 - all uses: anomalyco/opencode/github@latest. @latest currently resolves to v1.19.6, published 2026-11-17: the action upgraded itself four days ago without any change on our side.

  2. Reproduced in a real run. wiki-update run 39366214347 (2026-10-20) failed at run_agent.version:
    VERSION=$(curl -sf https://api.github.com/repos/anomalyco/opencode/releases/latest ...) -> ##[error]Process completed with exit code 1. in duration_ms=81, then run_opencode and every following step outcome=skipped. The agent never ran.

  3. Correction to mitigation Fix typo: 'recieve' should be 'receive' in AbstractPointerDriver.java #2 in the original report: exporting GITHUB_TOKEN does not help. That run's env dump shows the step already had GITHUB_TOKEN, OPENCODE_API_KEY and OPENROUTER_API_KEY exported, and the curl still failed in 81 ms. curl does not read GITHUB_TOKEN; the header would have to be passed explicitly. Only pinning the ref (or giving the action an explicit version input, if it has one) removes the call, or a step-level timeout bounds it.

  4. The wedge half is real and costs the full job timeout. wiki-update runs 39120356848 (2026-10-18) and 35506663371 (2026-09-20) each sat ~30 minutes before being cancelled by hand; the job timeout-minutes is 60 (wiki-update) and 90 (opencode, triage).

  5. Why it survived this long: it is intermittent. Last 40 runs each: opencode.yml 9 success / 0 failure, triage.yml 1 success / 0 failure, wiki-update.yml 13 success / 1 failure / 2 cancelled. The IP rate limit bites unpredictably, so the next occurrence is a lottery, not a matter of if.

  6. Adjacent defect, NOT part of this ticket: wiki-update.yml:87-88 hardcodes model: opencode/deepseek-v4.1-flash-free / variant: high and bypasses .github/scripts/model-config.js (that model is quota-exhausted today). File separately; do not fold it into this fix.

Revised acceptance criteria

  • anomalyco/opencode/github pinned to an explicit tag or SHA in opencode.yml, triage.yml and wiki-update.yml; grep -r "@latest" .github/workflows/*.yml returns nothing.
  • A version-step failure can no longer masquerade as an agent failure: a step-level timeout-minutes on the agent step and/or a signal that names run_agent.version, so a hang fails in minutes rather than at the job timeout.
  • A test (or documented manual check) proves the agent step still runs end to end after the change; the repo already has the pattern for this in .github/scripts/tests/ wiring tests.
  • The three workflows stay consistent with each other.

Triage Addendum (auto, 2026-11-21)

  • Area / Kind: area/build + kind/bug
  • Blast radius: L2 (CI config only: three workflow files + one wiring test; no JNode source, boot path, or public API)
  • Expected scope: Pin anomalyco/opencode/github@latest to one explicit tag/SHA in opencode.yml (~160), triage.yml (~72) and wiki-update.yml (~81); add a step-level timeout-minutes on the run_agent step calibrated below each job timeout (the reverted 5-minute cap killed a legitimate 5m10s run); add node:test coverage in .github/scripts/tests/ (extend model-config-wiring.test.js or a sibling) asserting the same pin in all three and no @latest. No-go: unrelated workflow reformatting, the hardcoded wiki-update.yml model (separate ticket), JNode sources/ASM/public API.
  • Test path: node --test .github/scripts/tests/*.test.js (per .github/AGENTS.md:308), then one /oc review round trip on any ticket to prove the agent step still runs end to end.
  • Merge signal: human-review (bug; CI workflow change, small scope, test path exists)
  • Gaps: non-blocking: calibrate the timeout per job (5m proved too low); check whether the pinned action exposes a version input that removes the internal curl; the 402/quota wedge is operational, not repo-fixable, so this ticket stays on the fast-fail/pin half. Out of scope: hardcoded model in wiki-update.yml.
  • Full report: ## Triage comment below.

✅ Ticket Runner Status

Field Value
Phase DONE
Turn 2/7
Retries 0/3
PR #981
Review in progress no
Started 2026-11-21T08:52:14.410Z

Activity

  1. added
    kind/bug
    area/build
    on Nov 7, 2026
  2. LSantha commented on Nov 7, 2026

    @LSantha
    OwnerAuthor

    /oc triage issue #870

    Triage run ONLY. Load the jnode-triage-issue skill and obey it. Output is exactly one ## Triage comment plus kind/area label edits. FORBIDDEN in this run: git checkout -b, git push, gh pr create, any branch, any PR.

  3. added
    agent/failed
    on Nov 7, 2026
  4. removed
    agent/failed
    on Nov 21, 2026
  5. LSantha commented on Nov 21, 2026

    @LSantha
    OwnerAuthor

    /run

    Fix the version-step single point of failure described in this issue (see the "Investigation update (2026-11-21)" section in the body for the reproduction).

    Required outcome:

    1. Pin anomalyco/opencode/github to an explicit tag or SHA in .github/workflows/opencode.yml, .github/workflows/triage.yml and .github/workflows/wiki-update.yml. After the change grep -rn "@latest" .github/workflows/*.yml must return nothing. All three must use the same pin.
    2. Make a version-step failure impossible to confuse with an agent failure. Give the agent step a step-level timeout-minutes so a hang fails in minutes rather than at the job timeout, and/or make the failure name run_agent.version. Do NOT attempt to fix it by exporting GITHUB_TOKEN: a real run (39366214347) had that env var already exported and the curl still exited 1 in 81 ms.
    3. Cover the change with the repo's node:test suite in .github/scripts/tests/ - follow the existing wiring-test pattern that pins workflow clauses. Include a check that the three workflows stay consistent with each other.

    Out of scope: the hardcoded model in wiki-update.yml (that is a separate ticket). Keep the change minimal and consistent with the existing style of these files; do not reformat unrelated workflow steps.

  6. LSantha commented on Nov 21, 2026

    @LSantha
    OwnerAuthor

    /oc triage issue #870

    Triage run ONLY. Load the jnode-triage-issue skill and obey it. Output is exactly one ## Triage comment plus kind/area label edits. FORBIDDEN in this run: git checkout -b, git push, gh pr create, any branch, any PR.

    The previous triage run on 2026-11-07 produced no report (the agent run failed). The issue body now carries an "Investigation update (2026-11-21)" section with the reproduction; confirm kind/bug and area/build, and note that the adjacent wiki-update.yml hardcoded-model defect is explicitly out of scope here.

  7. LSantha commented on Nov 21, 2026

    @LSantha
    OwnerAuthor

    Triage

    • Area: area/build (CI workflow config: .github/workflows/opencode.yml:160, triage.yml:72, wiki-update.yml:81)
    • Kind: kind/bug
    • Repro: run_agent.version curl (api.github.com/repos/anomalyco/opencode/releases/latest, unauthenticated, curl -sf) exits 1 in 81-138 ms, run_opencode skipped: run 39366214347 / 42396752964; expected agent run, actual agent/failed with no work attempted
    • Blast radius: L2 (CI config only: three workflow files + one wiring test; no JNode source, boot path, or public API)
    • Expected scope: ~4 files, small diff: pin all three anomalyco/opencode/github@latest uses to the same explicit tag/SHA; add a step-level timeout-minutes on run_agent calibrated below each job timeout (5m was reverted after killing a legitimate 5m10s run); extend node:test wiring coverage for the pin and three-workflow consistency. No-go: unrelated step reformatting, the hardcoded wiki-update.yml model, JNode sources/ASM/public API.
    • Test path: node --test .github/scripts/tests/*.test.js; then one /oc review round trip to prove the agent step still runs end to end.
    • Merge signal: human-review (bug; small CI workflow change with a working test path)
    • Gaps: none blocking. Non-blocking: calibrate the timeout per job; check whether the pinned action exposes a version input that removes the internal curl; the 402/quota wedge is operational, not repo-fixable, so this ticket stays on the fast-fail/pin half. Out of scope: wiki-update.yml hardcoded model.
    • Suggested next: fix
    • Split proposal: none - focused
    • Labels applied: kind/bug, area/build (both confirmed; no changes)

    github run

  8. LSantha commented on Nov 21, 2026

    @LSantha
    OwnerAuthor

    /oc Please proceed with this task.

  9. LSantha commented on Nov 21, 2026

    @LSantha
    OwnerAuthor

    Created PR #981

    github run

  10. added
    agent/done
    on Nov 21, 2026
  11. added 2 commits that reference this issue on Nov 21, 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

    agent/donearea/buildkind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions