Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

refactor(coding-agent): remove the test-only daemon-lookup seam from main.ts (#1851)

Sebastian Müllerbcf69db501da
diff --git a/packages/coding-agent/.changes/remove-daemon-lookup-fake.md b/packages/coding-agent/.changes/remove-daemon-lookup-fake.md
new file mode 100644
index 0000000000..789c472947
--- /dev/null
+++ b/packages/coding-agent/.changes/remove-daemon-lookup-fake.md
@@ -0,0 +1 @@
+- Removed the test-only daemon active-session lookup override.
diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts
index 385fde6831..8740776ec5 100644
--- a/packages/coding-agent/src/main.ts
+++ b/packages/coding-agent/src/main.ts
@@ -302,20 +302,17 @@ export function shouldEnsureDaemonBeforeActiveSessionLookup(options: DaemonActiv
);
}
-type ActiveDaemonSessionSummaryLookup = (socketPath: string, selector: string) => Promise<SessionSummary | undefined>;
-
interface ActiveDaemonSessionSummaryLookupOptions {
fallbackOnError?: boolean;
- lookup?: ActiveDaemonSessionSummaryLookup;
}
-export async function findActiveDaemonSessionSummaryForInteractiveStartup(
+async function findActiveDaemonSessionSummaryForInteractiveStartup(
socketPath: string,
selector: string,
options: ActiveDaemonSessionSummaryLookupOptions = {},
): Promise<SessionSummary | undefined> {
try {
- return await (options.lookup ?? findActiveDaemonSessionSummary)(socketPath, selector);
+ return await findActiveDaemonSessionSummary(socketPath, selector);
} catch (error) {
if (options.fallbackOnError === false) {
throw error;
diff --git a/packages/coding-agent/test/main-interactive-routing.test.ts b/packages/coding-agent/test/main-interactive-routing.test.ts
index 727662662f..6c1e4bf3e4 100644
--- a/packages/coding-agent/test/main-interactive-routing.test.ts
+++ b/packages/coding-agent/test/main-interactive-routing.test.ts
@@ -8,7 +8,6 @@ import {
type AppMode,
type DaemonInteractiveSessionManagerDecision,
daemonServerDefaultSessionConfig,
- findActiveDaemonSessionSummaryForInteractiveStartup,
findActiveDaemonSessionSummaryForSessionFile,
type InteractiveDaemonStartupDecision,
isClientOwnedDaemonSession,
@@ -232,48 +231,6 @@ describe("daemon-backed interactive session manager routing", () => {
).toBe(false);
});
- test("falls back to local session lookup when daemon active-session probing fails", async () => {
- await expect(
- findActiveDaemonSessionSummaryForInteractiveStartup("/tmp/prime.sock", "saved-session-id", {
- lookup: async () => {
- throw new Error("Daemon returned an invalid active session summary");
- },
- }),
- ).resolves.toBeUndefined();
- });
-
- test("propagates active-session lookup failures for explicit attach", async () => {
- await expect(
- findActiveDaemonSessionSummaryForInteractiveStartup("/tmp/prime.sock", "active-1", {
- fallbackOnError: false,
- lookup: async () => {
- throw new Error("protocol mismatch");
- },
- }),
- ).rejects.toThrow("protocol mismatch");
- });
-
- test("uses daemon active-session summary when probing succeeds", async () => {
- await expect(
- findActiveDaemonSessionSummaryForInteractiveStartup("/tmp/prime.sock", "active-1", {
- lookup: async () => ({
- id: "active-1",
- activeSessionId: "active-1",
- lifecycle: "draft",
- activity: "idle",
- isSessionActive: false,
- sessionId: "session-1",
- cwd: "/tmp/project",
- isStreaming: false,
- isCompacting: false,
- attachedClients: 0,
- messageCount: 0,
- sessionActions: { queuedCount: 0, steering: [], followUps: [] },
- }),
- }),
- ).resolves.toMatchObject({ activeSessionId: "active-1" });
- });
-
test("uses an ephemeral local session manager for fresh daemon-owned sessions", () => {
expect(shouldUseEphemeralSessionManagerForDaemonInteractive({})).toBe(true);
});