Skip to content

Commit 5a5ad5f

Browse files
committed
feat(browser): restore full eval recipe
1 parent 95c9f1c commit 5a5ad5f

4 files changed

Lines changed: 34 additions & 14 deletions

File tree

‎packages/opencode/src/provider/transform.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ export function options(input: {
12481248
!input.model.api.id.includes("-chat") &&
12491249
input.model.providerID !== "azure"
12501250
) {
1251-
result["textVerbosity"] = "low"
1251+
result["textVerbosity"] = input.model.api.id.includes("gpt-5.5") ? "medium" : "low"
12521252
}
12531253

12541254
if (input.model.providerID.startsWith("opencode")) {

‎packages/opencode/src/session/prompt/gpt.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ Do not stop after a plan, progress update, partial result, or first blocker. Bef
1313
the task field by field and resolve omissions or evidence/result mismatches when possible. Save requested deliverables
1414
in the user's required location.
1515

16-
Your final response must contain every requested value or an explicit, evidence-backed limitation. Do not ask the user
17-
questions when a deterministic attempt is possible.
16+
Your final response must start with `FINAL ANSWER:` and contain every requested value or an explicit, evidence-backed
17+
limitation. Do not ask the user questions when a deterministic attempt is possible.

‎packages/opencode/src/tool/browser-execute.ts‎

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import { Effect, Schema } from "effect"
77
import { BrowserExecute } from "@browser-use/bcode-browser/browser-execute"
88
import { Global } from "@opencode-ai/core/global"
99
import { InstanceState } from "@/effect/instance-state"
10+
import { Truncate } from "./truncate"
1011
import * as Tool from "./tool"
1112
import DESCRIPTION from "./browser-execute.txt"
1213

1314
const MAX_METADATA_LENGTH = 30_000
15+
const MAX_CONTEXT_BYTES = 8 * 1024
16+
const MAX_CONTEXT_LINES = 400
1417
const preview = (text: string) =>
1518
text.length <= MAX_METADATA_LENGTH ? text : "...\n\n" + text.slice(-MAX_METADATA_LENGTH)
1619

@@ -24,6 +27,7 @@ export const BrowserExecuteTool = Tool.define(
2427
"browser_execute",
2528
Effect.gen(function* () {
2629
const impl = yield* BrowserExecute.make(Global.Path.data)
30+
const truncate = yield* Truncate.Service
2731
return {
2832
// Substitute the resolved skills path so `{{SKILLS_DIR}}` references in
2933
// the description point at a concrete location. Workspace is
@@ -66,18 +70,28 @@ export const BrowserExecuteTool = Tool.define(
6670
mime: s.mime,
6771
url: `data:${s.mime};base64,${s.base64}`,
6872
}))
73+
const fullOutput = [
74+
result.output.trimEnd(),
75+
result.result === "null" ? "" : `=> ${result.result}`,
76+
attachments.length > 0
77+
? `(${attachments.length} screenshot${attachments.length === 1 ? "" : "s"} attached)`
78+
: "",
79+
]
80+
.filter(Boolean)
81+
.join("\n\n")
82+
const contextualOutput = yield* truncate.output(fullOutput, {
83+
maxBytes: MAX_CONTEXT_BYTES,
84+
maxLines: MAX_CONTEXT_LINES,
85+
})
6986
return {
7087
title: "browser_execute",
71-
output: [
72-
result.output.trimEnd(),
73-
result.result === "null" ? "" : `=> ${result.result}`,
74-
attachments.length > 0
75-
? `(${attachments.length} screenshot${attachments.length === 1 ? "" : "s"} attached)`
76-
: "",
77-
]
78-
.filter(Boolean)
79-
.join("\n\n"),
80-
metadata: { result: result.result, output: preview(result.output) },
88+
output: contextualOutput.content,
89+
metadata: {
90+
result: result.result,
91+
output: preview(result.output),
92+
truncated: contextualOutput.truncated,
93+
...(contextualOutput.truncated && { outputPath: contextualOutput.outputPath }),
94+
},
8195
attachments,
8296
}
8397
}).pipe(Effect.orDie),

‎packages/opencode/test/provider/transform.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ describe("ProviderTransform.options - gpt-5 textVerbosity", () => {
399399
expect(result.include).toEqual(["reasoning.encrypted_content"])
400400
})
401401

402+
test("gpt-5.5 should have textVerbosity set to medium", () => {
403+
const model = createGpt5Model("gpt-5.5")
404+
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
405+
expect(result.textVerbosity).toBe("medium")
406+
})
407+
402408
test("Bedrock Mantle gpt-5.5 uses OpenAI Responses defaults", () => {
403409
const model = {
404410
...createGpt5Model("openai.gpt-5.5"),
@@ -415,7 +421,7 @@ describe("ProviderTransform.options - gpt-5 textVerbosity", () => {
415421
expect(result.reasoningEffort).toBe("medium")
416422
expect(result.reasoningSummary).toBe("auto")
417423
expect(result.include).toEqual(["reasoning.encrypted_content"])
418-
expect(result.textVerbosity).toBe("low")
424+
expect(result.textVerbosity).toBe("medium")
419425
})
420426

421427
test("openai-compatible gpt-5 models omit Responses-only reasoningSummary", () => {

0 commit comments

Comments
 (0)