From 0a3b5e6529d3529dac17f40fb735d724c8a3f95b Mon Sep 17 00:00:00 2001 From: Prateek Date: Thu, 19 Feb 2026 15:10:02 +0530 Subject: [PATCH] fix: remove dead code, duplicate tests, and hardcoded ports - Use config.port instead of hardcoded 3000 in orchestrator prompt - Remove 2 duplicate null-activity tests (identical to existing test) - Assert on URL path not port in session table tests (port is config concern) Co-Authored-By: Claude Sonnet 4.6 --- .../cli/__tests__/commands/session.test.ts | 4 +- .../cli/__tests__/commands/status.test.ts | 45 ------------------- packages/core/src/orchestrator-prompt.ts | 4 +- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/packages/cli/__tests__/commands/session.test.ts b/packages/cli/__tests__/commands/session.test.ts index 3d5bd44a7..72db6ac7e 100644 --- a/packages/cli/__tests__/commands/session.test.ts +++ b/packages/cli/__tests__/commands/session.test.ts @@ -499,7 +499,7 @@ describe("session table", () => { expect(output).toContain("app-1"); expect(output).toContain("working"); expect(output).toContain("active"); - expect(output).toContain("http://localhost:3000/sessions/app-1"); + expect(output).toContain("/sessions/app-1"); }); it("shows PR, CI, and bugbot data from SCM", async () => { @@ -575,7 +575,7 @@ describe("session table", () => { expect(parsed[0].activity).toBe("idle"); expect(parsed[0].ci).toBe("-"); expect(parsed[0].bugbot).toBe(0); - expect(parsed[0].sessionUrl).toBe("http://localhost:3000/sessions/app-1"); + expect(parsed[0].sessionUrl).toContain("/sessions/app-1"); expect(parsed[0].prUrl).toBe(""); }); diff --git a/packages/cli/__tests__/commands/status.test.ts b/packages/cli/__tests__/commands/status.test.ts index ffd1e9ff2..8a21afcdc 100644 --- a/packages/cli/__tests__/commands/status.test.ts +++ b/packages/cli/__tests__/commands/status.test.ts @@ -615,51 +615,6 @@ describe("status command", () => { expect(parsed[0].activity).toBeNull(); }); - it("shows null activity when session activity is null", async () => { - writeFileSync( - join(sessionsDir, "app-1"), - "worktree=/tmp/wt\nbranch=feat/err\nstatus=working\n", - ); - - mockTmux.mockImplementation(async (...args: string[]) => { - if (args[0] === "list-sessions") return "app-1"; - if (args[0] === "display-message") return String(Math.floor(Date.now() / 1000)); - return null; - }); - mockGit.mockResolvedValue("feat/err"); - - // Session has activity: null (default from buildSessionsFromDir) - await program.parseAsync(["node", "test", "status", "--json"]); - - const jsonCalls = consoleSpy.mock.calls.map((c) => c[0]).join(""); - const parsed = JSON.parse(jsonCalls); - expect(parsed[0].activity).toBeNull(); - }); - - it("shows null activity when session activity is explicitly null", async () => { - writeFileSync( - join(sessionsDir, "app-1"), - "worktree=/tmp/wt\nbranch=feat/null\nstatus=working\n", - ); - - mockSessionManager.list.mockImplementation(async () => { - return buildSessionsFromDir(sessionsDirRef.current, "my-app", null); - }); - - mockTmux.mockImplementation(async (...args: string[]) => { - if (args[0] === "list-sessions") return "app-1"; - if (args[0] === "display-message") return String(Math.floor(Date.now() / 1000)); - return null; - }); - mockGit.mockResolvedValue("feat/null"); - - await program.parseAsync(["node", "test", "status", "--json"]); - - const jsonCalls = consoleSpy.mock.calls.map((c) => c[0]).join(""); - const parsed = JSON.parse(jsonCalls); - expect(parsed[0].activity).toBeNull(); - }); - it("shows exited activity from session manager", async () => { writeFileSync( join(sessionsDir, "app-1"), diff --git a/packages/core/src/orchestrator-prompt.ts b/packages/core/src/orchestrator-prompt.ts index 61f5c0694..af42466fc 100644 --- a/packages/core/src/orchestrator-prompt.ts +++ b/packages/core/src/orchestrator-prompt.ts @@ -76,7 +76,7 @@ ao open ${projectId} | \`ao session kill \` | Kill a specific session | | \`ao session cleanup [-p project]\` | Kill completed/merged sessions | | \`ao send \` | Send a message to a running session | -| \`ao dashboard\` | Start the web dashboard (http://localhost:${config.port ?? 3000}) | +| \`ao dashboard\` | Start the web dashboard (http://localhost:${config.port}) | | \`ao open \` | Open all project sessions in terminal tabs | | \`ao session table [-p project]\` | Print structured table of all sessions (deterministic, machine-readable) | | \`ao session table --json [-p project]\` | Same as above but JSON output |`); @@ -215,7 +215,7 @@ When an agent needs human judgment: 8. **Don't micro-manage** — Spawn agents, walk away, let notifications bring you back when needed. -9. **You are running in a terminal — do NOT use markdown links like \`[text](url)\`.** URLs must be printed as plain text so they are clickable in the terminal. Example: \`http://localhost:3000/sessions/ao-1\` not \`[ao-1](http://localhost:3000/sessions/ao-1)\``); +9. **You are running in a terminal — do NOT use markdown links like \`[text](url)\`.** URLs must be printed as plain text so they are clickable in the terminal. Example: \`http://localhost:${config.port}/sessions/ao-1\` not \`[ao-1](http://localhost:${config.port}/sessions/ao-1)\``); // Project-specific rules (if any) if (project.orchestratorRules) {