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 — chore: use paid zen model in e2e · Pablo-GNU/opencode@85c1692

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • test.yml
  • packages
    • app/e2e
      • fixtures.ts
    • opencode/script
      • seed-e2e.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/test.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/test.yml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ jobs:
100100
run: bun --cwd packages/app test:e2e:local
101101
env:
102102
CI: true
103+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
104+
OPENCODE_E2E_MODEL: opencode/claude-haiku-4-5
105+
OPENCODE_E2E_REQUIRE_PAID: "true"
103106
timeout-minutes: 30
104107

105108
- name: Upload Playwright artifacts
Collapse file

‎packages/app/e2e/fixtures.ts‎

Copy file name to clipboardExpand all lines: packages/app/e2e/fixtures.ts
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ import { createSdk, dirSlug, getWorktree, sessionPath } from "./utils"
1515

1616
export const settingsKey = "settings.v3"
1717

18+
const seedModel = (() => {
19+
const [providerID = "opencode", modelID = "big-pickle"] = (
20+
process.env.OPENCODE_E2E_MODEL ?? "opencode/big-pickle"
21+
).split("/")
22+
return {
23+
providerID: providerID || "opencode",
24+
modelID: modelID || "big-pickle",
25+
}
26+
})()
27+
1828
type TestFixtures = {
1929
sdk: ReturnType<typeof createSdk>
2030
gotoSession: (sessionID?: string) => Promise<void>
@@ -125,7 +135,7 @@ export const test = base.extend<TestFixtures, WorkerFixtures>({
125135

126136
async function seedStorage(page: Page, input: { directory: string; extra?: string[] }) {
127137
await seedProjects(page, input)
128-
await page.addInitScript(() => {
138+
await page.addInitScript((model: { providerID: string; modelID: string }) => {
129139
const win = window as E2EWindow
130140
win.__opencode_e2e = {
131141
...win.__opencode_e2e,
@@ -143,12 +153,12 @@ async function seedStorage(page: Page, input: { directory: string; extra?: strin
143153
localStorage.setItem(
144154
"opencode.global.dat:model",
145155
JSON.stringify({
146-
recent: [{ providerID: "opencode", modelID: "big-pickle" }],
156+
recent: [model],
147157
user: [],
148158
variant: {},
149159
}),
150160
)
151-
})
161+
}, seedModel)
152162
}
153163

154164
export { expect }
Collapse file

‎packages/opencode/script/seed-e2e.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/script/seed-e2e.ts
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const dir = process.env.OPENCODE_E2E_PROJECT_DIR ?? process.cwd()
22
const title = process.env.OPENCODE_E2E_SESSION_TITLE ?? "E2E Session"
33
const text = process.env.OPENCODE_E2E_MESSAGE ?? "Seeded for UI e2e"
44
const model = process.env.OPENCODE_E2E_MODEL ?? "opencode/gpt-5-nano"
5+
const requirePaid = process.env.OPENCODE_E2E_REQUIRE_PAID === "true"
56
const parts = model.split("/")
67
const providerID = parts[0] ?? "opencode"
78
const modelID = parts[1] ?? "gpt-5-nano"
@@ -11,6 +12,7 @@ const seed = async () => {
1112
const { Instance } = await import("../src/project/instance")
1213
const { InstanceBootstrap } = await import("../src/project/bootstrap")
1314
const { Config } = await import("../src/config/config")
15+
const { Provider } = await import("../src/provider/provider")
1416
const { Session } = await import("../src/session")
1517
const { MessageID, PartID } = await import("../src/session/schema")
1618
const { Project } = await import("../src/project/project")
@@ -25,6 +27,19 @@ const seed = async () => {
2527
await Config.waitForDependencies()
2628
await ToolRegistry.ids()
2729

30+
if (requirePaid && providerID === "opencode" && !process.env.OPENCODE_API_KEY) {
31+
throw new Error("OPENCODE_API_KEY is required when OPENCODE_E2E_REQUIRE_PAID=true")
32+
}
33+
34+
const info = await Provider.getModel(ProviderID.make(providerID), ModelID.make(modelID))
35+
if (requirePaid) {
36+
const paid =
37+
info.cost.input > 0 || info.cost.output > 0 || info.cost.cache.read > 0 || info.cost.cache.write > 0
38+
if (!paid) {
39+
throw new Error(`OPENCODE_E2E_MODEL must resolve to a paid model: ${providerID}/${modelID}`)
40+
}
41+
}
42+
2843
const session = await Session.create({ title })
2944
const messageID = MessageID.ascending()
3045
const partID = PartID.ascending()

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.