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 — fix(opencode): skip the auth check in the OpenCode 2 diagnostic · Brandon168/paseo@69e04a8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/server/src/server/agent/providers
    • opencode-agent.ts
    • opencode
      • runtime-client.test.ts
      • runtime-client.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/server/src/server/agent/providers/opencode-agent.ts‎

Copy file name to clipboardExpand all lines: packages/server/src/server/agent/providers/opencode-agent.ts
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,18 +1807,22 @@ export class OpenCodeAgentClient implements AgentClient {
18071807
await this.serverManager.shutdown();
18081808
}
18091809

1810-
async getDiagnostic(): Promise<{ diagnostic: string }> {
1810+
async getDiagnostic(options: { checkAuth?: boolean } = {}): Promise<{ diagnostic: string }> {
18111811
try {
18121812
const launch = await resolveProviderLaunch({
18131813
commandConfig: this.runtimeSettings?.command,
18141814
defaultBinary: "opencode",
18151815
});
18161816
const availability = await checkProviderLaunchAvailable(launch);
18171817

1818-
let authValue = "Not checked";
1819-
const authCommand = availability.available
1820-
? (availability.resolvedPath ?? launch.command)
1821-
: null;
1818+
let authValue =
1819+
options.checkAuth === false
1820+
? "Not checked (on OpenCode 2, `opencode auth list` starts its background service)"
1821+
: "Not checked";
1822+
const authCommand =
1823+
availability.available && options.checkAuth !== false
1824+
? (availability.resolvedPath ?? launch.command)
1825+
: null;
18221826
if (authCommand) {
18231827
try {
18241828
const { stdout, stderr } = await execCommand(
Collapse file

‎packages/server/src/server/agent/providers/opencode/runtime-client.test.ts‎

Copy file name to clipboardExpand all lines: packages/server/src/server/agent/providers/opencode/runtime-client.test.ts
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,41 @@ test("keeps native Paseo tools available when an external server is configured",
352352
await local.shutdown();
353353
}
354354
});
355+
356+
// `opencode auth list` on OpenCode 2 starts the background `opencode serve --service`, which
357+
// resumes every running session and gives live chats a second runner (anomalyco/opencode#51213).
358+
test.each([
359+
["opencode v2.3.2", false],
360+
["1.14.46", true],
361+
])("runs the auth check in the diagnostic only on OpenCode 1 (%s)", async (version, runsAuth) => {
362+
const { mkdtemp, writeFile, rm, access } = await import("node:fs/promises");
363+
const { tmpdir } = await import("node:os");
364+
const { join } = await import("node:path");
365+
const { OpenCodeRuntimeClient } = await import("./runtime-client.js");
366+
const { createTestLogger } = await import("../../../../test-utils/test-logger.js");
367+
const root = await mkdtemp(join(tmpdir(), "opencode-diagnostic-auth-"));
368+
const script = join(root, "opencode.cjs");
369+
const marker = join(root, "auth-ran");
370+
await writeFile(
371+
script,
372+
`const fs = require("node:fs");
373+
if (process.argv.includes("auth")) { fs.writeFileSync(${JSON.stringify(marker)}, ""); console.log("none"); }
374+
else console.log(${JSON.stringify(version)});`,
375+
);
376+
const client = new OpenCodeRuntimeClient(createTestLogger(), {
377+
command: { mode: "replace", argv: [process.execPath, script] },
378+
env: { XDG_STATE_HOME: root },
379+
});
380+
try {
381+
const { diagnostic } = await client.getDiagnostic();
382+
const ran = await access(marker).then(
383+
() => true,
384+
() => false,
385+
);
386+
expect(ran).toBe(runsAuth);
387+
if (!runsAuth) expect(diagnostic).toContain("starts its background service");
388+
} finally {
389+
await client.shutdown();
390+
await rm(root, { recursive: true, force: true });
391+
}
392+
});
Collapse file

‎packages/server/src/server/agent/providers/opencode/runtime-client.ts‎

Copy file name to clipboardExpand all lines: packages/server/src/server/agent/providers/opencode/runtime-client.ts
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ export class OpenCodeRuntimeClient implements AgentClient {
135135
const selection = await this.selectService();
136136
if (selection.kind !== "owned")
137137
return { diagnostic: `OpenCode server: ${selection.server.url}` };
138-
return this.legacy.getDiagnostic();
138+
// OpenCode 2 CLI commands such as `opencode auth list` start the background
139+
// `opencode serve --service` when none is running. A starting service resumes every
140+
// session marked running, so a chat that is live on Paseo's own helper server gets a
141+
// second runner (anomalyco/opencode#51213). Only OpenCode 1 gets the auth check.
142+
const client = await this.client().catch(() => undefined);
143+
return this.legacy.getDiagnostic({ checkAuth: client === this.legacy });
139144
}
140145
async createSession(
141146
config: AgentSessionConfig,

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.