summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-04-09 15:25:59 -0500
committerGitHub <[email protected]>2026-04-09 15:25:59 -0500
commit7202b3a32541c4eb6b39adcc41d2333deb9cd538 (patch)
tree2e8fef7193ebe9219f82dd2c089a3b0029fa72e5
parent35b44df94ab50bc4e2c4a18f029e0f52c3bf5be7 (diff)
downloadopencode-7202b3a32541c4eb6b39adcc41d2333deb9cd538.tar.gz
opencode-7202b3a32541c4eb6b39adcc41d2333deb9cd538.zip
fix: ensure that openai oauth works for agent create cmd, use temporary hack (#21749)
Co-authored-by: OpeOginni <[email protected]>
-rw-r--r--packages/opencode/src/agent/agent.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/packages/opencode/src/agent/agent.ts b/packages/opencode/src/agent/agent.ts
index 843d65433..2a8bed092 100644
--- a/packages/opencode/src/agent/agent.ts
+++ b/packages/opencode/src/agent/agent.ts
@@ -341,6 +341,10 @@ export namespace Agent {
)
const existing = yield* InstanceState.useEffect(state, (s) => s.list())
+ // TODO: clean this up so provider specific logic doesnt bleed over
+ const authInfo = yield* auth.get(model.providerID).pipe(Effect.orDie)
+ const isOpenaiOauth = model.providerID === "openai" && authInfo?.type === "oauth"
+
const params = {
experimental_telemetry: {
isEnabled: cfg.experimental?.openTelemetry,
@@ -350,12 +354,14 @@ export namespace Agent {
},
temperature: 0.3,
messages: [
- ...system.map(
- (item): ModelMessage => ({
- role: "system",
- content: item,
- }),
- ),
+ ...(isOpenaiOauth
+ ? []
+ : system.map(
+ (item): ModelMessage => ({
+ role: "system",
+ content: item,
+ }),
+ )),
{
role: "user",
content: `Create an agent configuration based on this request: \"${input.description}\".\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${existing.map((i) => i.name).join(", ")}\n Return ONLY the JSON object, no other text, do not wrap in backticks`,
@@ -369,13 +375,12 @@ export namespace Agent {
}),
} satisfies Parameters<typeof generateObject>[0]
- // TODO: clean this up so provider specific logic doesnt bleed over
- const authInfo = yield* auth.get(model.providerID).pipe(Effect.orDie)
- if (model.providerID === "openai" && authInfo?.type === "oauth") {
+ if (isOpenaiOauth) {
return yield* Effect.promise(async () => {
const result = streamObject({
...params,
providerOptions: ProviderTransform.providerOptions(resolved, {
+ instructions: system.join("\n"),
store: false,
}),
onError: () => {},