Skip to content

Fix OpenCode free-tier one-shots with temporary sessions - #710

Open
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1792365413-or549-opencode-sessions
Open

devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1792365413-or549-opencode-sessions

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #702
Fixes OR-549.

Summary

  • Run shared V2 one-shots through temporary sessions so free-tier models can generate titles, starter prompts, skill screening and compaction summaries. Preserve sessionless compatibility only when older servers lack the session routes.
  • Preserve provider/session error explanations and clean up known sessions after success, failure or generation timeout, with a separate two-second cleanup deadline.
  • Continue @cpa01cmz-beep’s Run OpenCode one-shots through a session so free-tier models work #703 from exact head 70511760093de1b8456f00b9c4bd10ca1474daec, preserving the original commit and author. Original PR remains open.

Merge policy: preserve imported contributor history with a merge commit; do not squash or rebase. No merge authorized.

Test plan

  • Reproduced on unmodified main 6285fee7 on Ubuntu 22.04.5 x86_64 with genuine OpenCode v2.0.32 and opencode/nemotron-3.5-super-vl-free: live dashboard chat succeeds, skill-import screening returns the reported 503.
  • Latest head 915071862de0748ecfdd74699da74969847397ea: 15 focused V2 tests; full Rust suite (1113 unit and 18 integration tests passed, 3 ignored); formatting, all-target clippy with warnings denied, and style lint. Full-suite execution isolates test Git configuration from VM identity/URL rewriting without changing commit configuration.
  • Independent fresh-context scope review: YES. Greptile: 5/5, no findings. CI: 8 passed, 0 failed, 9 skipped on latest head.
  • Rebuilt latest head and repeated real-agent Linux workflow in a fresh dev-slot: exact-model CLI preflight and live dashboard reply, then official skill-creator installation and Skills Refresh while recording. A fresh screening decision completed during recording; no 503 or screening error in fresh backend log.
  • Freshly fetched main is an ancestor; PR is conflict-free. Original contributor head and author remain preserved.

The skill received a legitimate false/excluded classification, not an accepted import. The persisted decision matched its genuine metadata digest. Older-server fallback, timeout/error cleanup and other one-shot callers are covered by regression tests/code review, not independent live UI runs.

Recordings

Bug reproduction on main — Linux

Bug reproduction on main

Post-fix functionality — Linux

Post-fix real OpenCode skill screening

Human review

Yes. The shared harness serves several background operations and retains older-server fallbacks; Daniel Kim has the closest surrounding implementation history. Leave open for review and explicit merge approval.

Automation improvements

  • OpenCode was initially absent: add optional runtime instructions for official @opencode/cli@2.0.32 installation and exact-model live preflight for OpenCode issues. Blueprint write permission was unavailable, so this remains a recommendation.

Link to Devin session: https://app.devin.ai/sessions/c58486dd1dfe40bcaf8c08954ccdcfc3
Open in Devin Desktop: https://app.devin.ai/desktop/session/c58486dd1dfe40bcaf8c08954ccdcfc3?variant=devin

cpa01cmz-beep and others added 2 commits October 18, 2026 06:09
OpenCode's free tier refuses the sessionless generate route
(`/api/experimental/generate`) with "free tier can only be used from within
OpenCode" — a policy on that endpoint, enforced by the provider gateway, not by
the model, the database, or the client. The session-scoped route
(`/api/session/{id}/generate`) returns the same `/data/text` shape and is
allowed, so one-shots now create a throwaway session, generate on it, and
delete it. Servers that predate the session route keep using the sessionless
one.

This fixes titles, starter prompts, skill-import screening, and compaction
summaries for anyone whose chat model is a free-tier OpenCode model.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous error-reporting issue is fixed.

Summary

Runs V2 one-shot requests through temporary sessions so free-tier models can answer.

  • OpenCode V2 one-shots generate text through temporary sessions.

The previous finding is fixed. No new issues were found. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[One-shot request] --> B[Create temporary session]
  B -->|Created| C[Generate through session]
  B -->|Route missing| D[Use sessionless route]
  C -->|Route missing| D
  C -->|Reply or error| E[Attempt cleanup]
  D --> E
  B -->|Other error| F[Return error explanation]
  E --> G[Return reply or error]
Loading

Reviews (2) · Last reviewed commit: "Preserve OpenCode session creation error..." · Reviewed by Greptile

Comment thread src/local/harness/opencode_v2.rs Outdated
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai Please review latest head 915071862de0748ecfdd74699da74969847397ea. Session creation now uses the shared response decoder to preserve server error explanations, with a regression test for non-404 creation failures.

@devin-ai-integration devin-ai-integration Bot added the awaiting review Devin bugfix PR is open and needs human review before merge label Oct 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review Devin bugfix PR is open and needs human review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode free-tier models are rejected for orx one-shot tasks

2 participants