)
() => Effect.void,
);
+export const refuses = (failure: OrchestratorMcpFailure) =>
+ declare(
+ () => Effect.fail(failure),
+ () => Effect.fail(failure),
+ );
+
/** Apply the caller check before local execution or forwarding loses the child identity. */
export const withoutSubagents = (
declaration: Declaration<(params: P) => Effect.Effect>,
diff --git a/apps/server/src/mcp/toolkits/core.test.ts b/apps/server/src/mcp/toolkits/core.test.ts
index 81614e5eb4274..57b1f822cf797 100644
--- a/apps/server/src/mcp/toolkits/core.test.ts
+++ b/apps/server/src/mcp/toolkits/core.test.ts
@@ -9,6 +9,7 @@ import {
CommandId,
EnvironmentId,
NodeId,
+ makeThreadInbox,
OrchestratorMcpThreadReadResult,
ProjectId,
ProviderDriverKind,
@@ -153,21 +154,21 @@ it.effect("an answered question reports already answered instead of not found",
const projection = McpToolAccessTestkit.idleThreadProjection(shell);
return Effect.gen(function* () {
const server = yield* McpServer.McpServer;
- const respond = (id: string) =>
+ const read = (id: string) =>
server
.callTool({
name: "t3_pending_request",
- arguments: { action: "respond", requestId: id, answers: { size: "large" } },
+ arguments: { action: "read", requestId: id },
})
.pipe(
Effect.provideService(McpInvocationContext.McpInvocationContext, scope),
Effect.provideService(McpSchema.McpServerClient, client),
);
- expect(declaredFailure(yield* respond(requestId))).toMatchObject({
+ expect(declaredFailure(yield* read(requestId))).toMatchObject({
code: "invalid_request",
message: "The user-input request was already answered.",
});
- expect(declaredFailure(yield* respond("missing-question"))).toMatchObject({
+ expect(declaredFailure(yield* read("missing-question"))).toMatchObject({
code: "invalid_request",
message: "The pending user-input request was not found.",
});
@@ -226,79 +227,102 @@ it.effect("an answered question reports already answered instead of not found",
);
});
-it.effect("a pending question read keeps option previews", () => {
- const shell = McpToolAccessTestkit.liveThreadShell(threadId);
- const requestId = RuntimeRequestId.make("previewed-question");
- const projection = McpToolAccessTestkit.idleThreadProjection(shell);
- const questions = [
- {
- id: "post",
- header: "Review",
- question: "Post it?",
- options: [{ label: "Post", description: "Publish the draft", preview: "Full proposed text" }],
- },
- ];
- return Effect.gen(function* () {
- const server = yield* McpServer.McpServer;
- const result = yield* server
- .callTool({ name: "t3_pending_request", arguments: { action: "read", requestId } })
- .pipe(
- Effect.provideService(McpInvocationContext.McpInvocationContext, scope),
- Effect.provideService(McpSchema.McpServerClient, client),
- );
- expect(result.structuredContent).toEqual({ requestId, questions });
- }).pipe(
- Effect.provide(
- layerThreadToolkit.pipe(
- Layer.provideMerge(McpHttpServer.layerInProcessMcpServer),
- Layer.provide(NodeCrypto.layer),
- Layer.provide(
- Layer.mock(ThreadManagement.ThreadManagementService)({
- getThreadShell: () => Effect.succeed(shell),
- getProjectThreadRecords: () =>
- Effect.succeed({
- ...projection,
- runtimeRequests: [
- {
- id: requestId,
- nodeId: NodeId.make("root"),
- providerTurnId: null,
- nativeRequestRef: null,
- kind: "user_input",
- status: "pending",
- responseCapability: { type: "message" },
- createdAt: shell.createdAt,
- resolvedAt: null,
- },
- ],
- turnItems: [
- {
- id: TurnItemId.make("previewed-question-item"),
- threadId,
- runId: null,
- nodeId: null,
- providerThreadId: null,
- providerTurnId: null,
- nativeItemRef: null,
- parentItemId: null,
- ordinal: 0,
- status: "running",
- title: null,
- startedAt: shell.createdAt,
- completedAt: null,
- updatedAt: shell.updatedAt,
- type: "user_input_request",
- requestId,
- questions,
- },
- ],
- }),
- }),
+it.effect.each(["shared", "agent-only"] as const)(
+ "a question in a %s thread stays visible after an agent is denied",
+ (audience) => {
+ const shell = {
+ ...McpToolAccessTestkit.liveThreadShell(threadId),
+ inbox: makeThreadInbox({ actor: { kind: "agent", id: "test-agent" }, routing: { audience } }),
+ };
+ const requestId = RuntimeRequestId.make("previewed-question");
+ const projection = McpToolAccessTestkit.idleThreadProjection(shell);
+ const questions = [
+ {
+ id: "post",
+ header: "Review",
+ question: "Post it?",
+ options: [
+ { label: "Post", description: "Publish the draft", preview: "Full proposed text" },
+ ],
+ },
+ ];
+ return Effect.gen(function* () {
+ const server = yield* McpServer.McpServer;
+ const call = (args: Record) =>
+ server
+ .callTool({ name: "t3_pending_request", arguments: args })
+ .pipe(
+ Effect.provideService(McpInvocationContext.McpInvocationContext, scope),
+ Effect.provideService(McpSchema.McpServerClient, client),
+ );
+ const respond = { action: "respond", requestId, answers: { post: "Post" } };
+ for (const target of [{}, { environmentId: "linked-test-environment" }]) {
+ expect(declaredFailure(yield* call({ ...respond, ...target }))).toMatchObject({
+ code: "capability_denied",
+ message: expect.stringContaining("needs a human answer"),
+ });
+ }
+ expect((yield* call({ action: "list" })).structuredContent).toEqual({
+ requestIds: [requestId],
+ });
+ expect((yield* call({ action: "read", requestId })).structuredContent).toEqual({
+ requestId,
+ questions,
+ });
+ }).pipe(
+ Effect.provide(
+ layerThreadToolkit.pipe(
+ Layer.provideMerge(McpHttpServer.layerInProcessMcpServer),
+ Layer.provide(NodeCrypto.layer),
+ Layer.provide(
+ Layer.mock(ThreadManagement.ThreadManagementService)({
+ dispatch: () => Effect.die("An agent's answer must never dispatch or emit events"),
+ getThreadShell: () => Effect.succeed(shell),
+ getProjectThreadRecords: () =>
+ Effect.succeed({
+ ...projection,
+ runtimeRequests: [
+ {
+ id: requestId,
+ nodeId: NodeId.make("root"),
+ providerTurnId: null,
+ nativeRequestRef: null,
+ kind: "user_input",
+ status: "pending",
+ responseCapability: { type: "message" },
+ createdAt: shell.createdAt,
+ resolvedAt: null,
+ },
+ ],
+ turnItems: [
+ {
+ id: TurnItemId.make("previewed-question-item"),
+ threadId,
+ runId: null,
+ nodeId: null,
+ providerThreadId: null,
+ providerTurnId: null,
+ nativeItemRef: null,
+ parentItemId: null,
+ ordinal: 0,
+ status: "running",
+ title: null,
+ startedAt: shell.createdAt,
+ completedAt: null,
+ updatedAt: shell.updatedAt,
+ type: "user_input_request",
+ requestId,
+ questions,
+ },
+ ],
+ }),
+ }),
+ ),
),
),
- ),
- );
-});
+ );
+ },
+);
it("bounds public command rejections and redacts internal dispatch causes", () => {
const command = { commandId: CommandId.make("mcp-core-command"), commandType: "thread.settle" };
diff --git a/apps/server/src/mcp/toolkits/thread/handlers.ts b/apps/server/src/mcp/toolkits/thread/handlers.ts
index c3131813a9a6d..2529bda64fcf7 100644
--- a/apps/server/src/mcp/toolkits/thread/handlers.ts
+++ b/apps/server/src/mcp/toolkits/thread/handlers.ts
@@ -286,26 +286,10 @@ export const layer = McpToolAccess.toLayer(ThreadToolkit, {
return { requestId, questions: item.questions };
}),
),
- writesThread((input) =>
- Effect.gen(function* () {
- const requestId = yield* required(input.requestId, "requestId");
- const answers = yield* required(input.answers, "answers");
- const { threads, projection } = yield* readQuestion({
- threadId: input.threadId,
- requestId,
- });
- const result = yield* threads
- .dispatch({
- type: "runtime-request.respond",
- threadId: projection.thread.id,
- commandId: yield* newCommandId(),
- requestId,
- answers,
- // An agent's answer is an agent's message, never a person's.
- createdBy: "agent",
- })
- .pipe(Effect.mapError(dispatchFailure));
- return { sequence: result.sequence };
+ McpToolAccess.refuses(
+ new OrchestratorMcpFailure({
+ code: "capability_denied",
+ message: "This user-input card needs a human answer. Ask a person to answer it in T3 Code.",
}),
),
),
diff --git a/apps/server/src/mcp/toolkits/thread/tools.ts b/apps/server/src/mcp/toolkits/thread/tools.ts
index b39d46216e4e4..e9f72c6e75a1b 100644
--- a/apps/server/src/mcp/toolkits/thread/tools.ts
+++ b/apps/server/src/mcp/toolkits/thread/tools.ts
@@ -133,7 +133,7 @@ const question = Schema.Struct({
const PendingRequestTool = Tool.make("t3_pending_request", {
...commandTool,
description:
- "User questions only (default: this thread). List IDs, read by `requestId`, respond with `answers`. No permission approvals.",
+ "User questions only (default: this thread). List IDs or read by `requestId`. A person answers these cards in T3 Code.",
parameters: Schema.Struct({
action: Schema.Literals(["list", "read", "respond"]),
environmentId: OrchestratorMcpEnvironmentTarget,
diff --git a/apps/server/src/ws.test.ts b/apps/server/src/ws.test.ts
index 061165895392c..63847a11c0f9a 100644
--- a/apps/server/src/ws.test.ts
+++ b/apps/server/src/ws.test.ts
@@ -30,6 +30,8 @@ import {
ProviderInstanceId,
ProviderThreadId,
RunId,
+ RuntimeRequestId,
+ type OrchestrationV2ServerCommand,
SourceControlRepositoryError,
WS_METHODS,
WsRpcGroup,
@@ -1922,6 +1924,132 @@ it.effect("a missing thread worktree gets its project's skills in the cwd snapsh
),
);
+it.effect("only a human client can answer a user-input card over authenticated RPC", () =>
+ Effect.gen(function* () {
+ const botSession = AuthSessionId.make("question-bot");
+ const humanSession = AuthSessionId.make("question-ui");
+ const threadId = ThreadId.make("question-thread");
+ const questionId = RuntimeRequestId.make("question-card");
+ const approvalId = RuntimeRequestId.make("permission-card");
+ const dispatched: OrchestrationV2ServerCommand[] = [];
+ let enqueued = 0;
+ const sender = (id: AuthSessionId) => ({
+ label: null,
+ founder: null,
+ deviceType: id === botSession ? ("bot" as const) : ("desktop" as const),
+ });
+ const services = Layer.mergeAll(
+ layerUnusedConfigRpcServices,
+ Layer.mock(ProviderRegistry.ProviderRegistry)({}),
+ Layer.mock(UsageLimitSources.UsageLimitSources)({}),
+ Layer.mock(ExternalLauncher.ExternalLauncher)({}),
+ Layer.mock(RemoteOpenTargets.RemoteOpenTargets)({}),
+ Layer.mock(DirectEndpoints.DirectEndpoints)({}),
+ Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({ namedProjectsRoot: "/unused" }),
+ Layer.mock(ScratchThreadPromotion.ScratchThreadPromotion)({}),
+ Layer.mock(ServerEnvironment.ServerEnvironment)({}),
+ Layer.mock(SessionStore.SessionStore)({
+ cookieName: "question-test",
+ legacyCookieName: undefined,
+ senderOf: (id) => Effect.succeedSome(sender(id)),
+ }),
+ Layer.mock(EnvironmentAuth.EnvironmentAuth)({
+ messageSenderOf: (sessionId) =>
+ Effect.succeed({ ...sender(sessionId), sessionId, device: "" }),
+ }),
+ Layer.mock(ServerRuntimeStartup.ServerRuntimeStartup)({
+ enqueueCommand: (effect) =>
+ Effect.sync(() => {
+ enqueued++;
+ }).pipe(Effect.andThen(effect)),
+ }),
+ Layer.mock(Orchestrator.OrchestratorV2)({
+ getThreadRecords: () =>
+ Effect.succeed({
+ runtimeRequests: [
+ { id: questionId, kind: "user_input" },
+ { id: approvalId, kind: "permission" },
+ ],
+ } as never),
+ }),
+ Layer.mock(ThreadManagement.ThreadManagementService)({
+ dispatch: (command) =>
+ Effect.sync(() => {
+ dispatched.push(command);
+ return { sequence: dispatched.length, storedEvents: [], replayed: true };
+ }),
+ }),
+ );
+ const browser = yield* ServerBrowser.ServerBrowser;
+ const connect = (sessionId: AuthSessionId) =>
+ RpcTest.makeClient(WsRpcGroup).pipe(
+ Effect.provide(
+ layerWsRpc(
+ {
+ sessionId,
+ subject: sessionId === botSession ? "cli-issued-session" : "desktop-bootstrap",
+ method: "bearer-access-token",
+ scopes: [AuthOrchestrationOperateScope],
+ },
+ {},
+ browser,
+ () => Effect.void,
+ { secretReferences: true },
+ ).pipe(
+ Layer.provide(services),
+ Layer.merge(RpcAuthorization.layer([AuthOrchestrationOperateScope])),
+ ),
+ ),
+ );
+ const bot = yield* connect(botSession);
+ const human = yield* connect(humanSession);
+ const command = {
+ type: "runtime-request.respond" as const,
+ threadId,
+ requestId: questionId,
+ commandId: CommandId.make("synthetic-question-response"),
+ answers: { color: "green" },
+ createdBy: "user" as const,
+ };
+ const refused = yield* bot[ORCHESTRATION_V2_WS_METHODS.dispatchCommand](command).pipe(
+ Effect.flip,
+ );
+ assert.include(refused.message, "needs a human answer");
+ const dismiss = yield* bot[ORCHESTRATION_V2_WS_METHODS.dispatchCommand]({
+ type: "thread.user-input.dismiss",
+ threadId,
+ requestId: questionId,
+ commandId: CommandId.make("synthetic-question-dismiss"),
+ }).pipe(Effect.flip);
+ assert.include(dismiss.message, "needs a human answer");
+ assert.equal(enqueued, 0);
+ assert.isEmpty(dispatched);
+
+ const accepted = yield* human[ORCHESTRATION_V2_WS_METHODS.dispatchCommand](command);
+ assert.equal(accepted.sequence, 1);
+ const approved = yield* bot[ORCHESTRATION_V2_WS_METHODS.dispatchCommand]({
+ type: "runtime-request.respond",
+ threadId,
+ requestId: approvalId,
+ commandId: CommandId.make("synthetic-permission-response"),
+ decision: "accept",
+ });
+ assert.equal(approved.sequence, 2);
+ assert.deepEqual(
+ dispatched.map((received) => ("sentBy" in received ? received.sentBy?.sessionId : null)),
+ [humanSession, botSession],
+ );
+ }).pipe(
+ Effect.provide(
+ Layer.mergeAll(
+ Layer.fresh(layerConfigSources),
+ Layer.mock(PreviewAutomationBroker.PreviewAutomationBroker)({}),
+ Layer.mock(ServerBrowser.ServerBrowser)({}),
+ ),
+ ),
+ ),
+);
+
it.effect("a git action that fails partway still refreshes the repository status", () =>
Effect.gen(function* () {
const failure = new GitManagerError({ operation: "test", cwd: "/repo", detail: "push failed" });
diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.ts
index 47c07a381b4af..e12eb5bc66320 100644
--- a/apps/server/src/ws.ts
+++ b/apps/server/src/ws.ts
@@ -2078,6 +2078,38 @@ export const layerWsRpc = (
);
const UNENROLLED_SENDER_MESSAGE =
"This client is not enrolled as a founder. Pair it with a founder's pairing code, or have another client assign it in Settings → Connections.";
+ const authorizeUserInput = Effect.fn("ws.authorizeUserInput")(function* (
+ command: OrchestrationV2Command,
+ ) {
+ if (
+ command.type !== "runtime-request.respond" &&
+ command.type !== "thread.user-input.dismiss"
+ )
+ return;
+
+ const reject = (message: string) =>
+ new OrchestrationV2DispatchCommandError({
+ commandId: command.commandId,
+ commandType: command.type,
+ message,
+ detail: message,
+ });
+ const sender = yield* sessions
+ .senderOf(currentSessionId)
+ .pipe(Effect.mapError(() => reject("Could not verify the responding session.")));
+ if (Option.isNone(sender)) return yield* reject("Could not verify the responding session.");
+ if (sender.value.deviceType !== "bot") return;
+
+ if (command.type === "runtime-request.respond") {
+ const { runtimeRequests } = yield* orchestrationEngine
+ .getThreadRecords(command.threadId, ["runtimeRequests"])
+ .pipe(Effect.mapError(() => reject("Could not verify the runtime request.")));
+ const request = runtimeRequests.find(({ id }) => id === command.requestId);
+ if (request === undefined) return yield* reject("The runtime request was not found.");
+ if (request.kind !== "user_input") return;
+ }
+ return yield* reject("This user-input card needs a human answer.");
+ });
const fileUnderCreator = (
command: OrchestrationV2Command,
): Effect.Effect => {
@@ -2110,6 +2142,7 @@ export const layerWsRpc = (
: {}),
}).pipe(
Effect.andThen(() => refusesUnenrolled(command.type)),
+ Effect.tap((refused) => (refused ? Effect.void : authorizeUserInput(command))),
Effect.flatMap((refused) => {
if (refused) {
return Effect.fail(
From 259f2efe863cbb625abba955ab49eeee29ac5bef Mon Sep 17 00:00:00 2001
From: nullStack65 <112618179+nullStack65@users.noreply.github.com>
Date: Mon, 23 Nov 2026 20:14:20 +0000
Subject: [PATCH 2/3] test(server): refresh the MCP tool context budget
Model: codex/gpt-6.2-sol
Task: implementation
Agent: T3 implementation sub-agent
Lane: codex
Harness: t3/codex
Model-family: GPT
Model-generation: 6.2
---
apps/server/src/provider/agentContextBudget.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json
index c2084d57162bb..6e7a9bd30b8f6 100644
--- a/apps/server/src/provider/agentContextBudget.json
+++ b/apps/server/src/provider/agentContextBudget.json
@@ -1,5 +1,5 @@
{
"claudeSystemAppendBytes": 5930,
"codexAdditionalContextBytes": 7324,
- "mcpToolListJsonBytes": 55827
+ "mcpToolListJsonBytes": 55821
}
From 12e58dc3efae7b233439914e1946c5f9e948e894 Mon Sep 17 00:00:00 2001
From: nullStack65 <112618179+nullStack65@users.noreply.github.com>
Date: Mon, 23 Nov 2026 20:52:38 +0000
Subject: [PATCH 3/3] fix(server): limit human-answer guard to MCP
Model: codex/gpt-6.2-sol
Task: publication of CTO-verified MCP-only repair
Agent: T3 implementation sub-agent
Lane: codex
Harness: t3/codex
Model-family: GPT
Model-generation: 6.2
Refs: CLO-995
Repair-Guard: CLO-995/193-F1 attempt 1
---
apps/server/src/ws.test.ts | 128 -------------------------------------
apps/server/src/ws.ts | 33 ----------
2 files changed, 161 deletions(-)
diff --git a/apps/server/src/ws.test.ts b/apps/server/src/ws.test.ts
index 63847a11c0f9a..061165895392c 100644
--- a/apps/server/src/ws.test.ts
+++ b/apps/server/src/ws.test.ts
@@ -30,8 +30,6 @@ import {
ProviderInstanceId,
ProviderThreadId,
RunId,
- RuntimeRequestId,
- type OrchestrationV2ServerCommand,
SourceControlRepositoryError,
WS_METHODS,
WsRpcGroup,
@@ -1924,132 +1922,6 @@ it.effect("a missing thread worktree gets its project's skills in the cwd snapsh
),
);
-it.effect("only a human client can answer a user-input card over authenticated RPC", () =>
- Effect.gen(function* () {
- const botSession = AuthSessionId.make("question-bot");
- const humanSession = AuthSessionId.make("question-ui");
- const threadId = ThreadId.make("question-thread");
- const questionId = RuntimeRequestId.make("question-card");
- const approvalId = RuntimeRequestId.make("permission-card");
- const dispatched: OrchestrationV2ServerCommand[] = [];
- let enqueued = 0;
- const sender = (id: AuthSessionId) => ({
- label: null,
- founder: null,
- deviceType: id === botSession ? ("bot" as const) : ("desktop" as const),
- });
- const services = Layer.mergeAll(
- layerUnusedConfigRpcServices,
- Layer.mock(ProviderRegistry.ProviderRegistry)({}),
- Layer.mock(UsageLimitSources.UsageLimitSources)({}),
- Layer.mock(ExternalLauncher.ExternalLauncher)({}),
- Layer.mock(RemoteOpenTargets.RemoteOpenTargets)({}),
- Layer.mock(DirectEndpoints.DirectEndpoints)({}),
- Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({ namedProjectsRoot: "/unused" }),
- Layer.mock(ScratchThreadPromotion.ScratchThreadPromotion)({}),
- Layer.mock(ServerEnvironment.ServerEnvironment)({}),
- Layer.mock(SessionStore.SessionStore)({
- cookieName: "question-test",
- legacyCookieName: undefined,
- senderOf: (id) => Effect.succeedSome(sender(id)),
- }),
- Layer.mock(EnvironmentAuth.EnvironmentAuth)({
- messageSenderOf: (sessionId) =>
- Effect.succeed({ ...sender(sessionId), sessionId, device: "" }),
- }),
- Layer.mock(ServerRuntimeStartup.ServerRuntimeStartup)({
- enqueueCommand: (effect) =>
- Effect.sync(() => {
- enqueued++;
- }).pipe(Effect.andThen(effect)),
- }),
- Layer.mock(Orchestrator.OrchestratorV2)({
- getThreadRecords: () =>
- Effect.succeed({
- runtimeRequests: [
- { id: questionId, kind: "user_input" },
- { id: approvalId, kind: "permission" },
- ],
- } as never),
- }),
- Layer.mock(ThreadManagement.ThreadManagementService)({
- dispatch: (command) =>
- Effect.sync(() => {
- dispatched.push(command);
- return { sequence: dispatched.length, storedEvents: [], replayed: true };
- }),
- }),
- );
- const browser = yield* ServerBrowser.ServerBrowser;
- const connect = (sessionId: AuthSessionId) =>
- RpcTest.makeClient(WsRpcGroup).pipe(
- Effect.provide(
- layerWsRpc(
- {
- sessionId,
- subject: sessionId === botSession ? "cli-issued-session" : "desktop-bootstrap",
- method: "bearer-access-token",
- scopes: [AuthOrchestrationOperateScope],
- },
- {},
- browser,
- () => Effect.void,
- { secretReferences: true },
- ).pipe(
- Layer.provide(services),
- Layer.merge(RpcAuthorization.layer([AuthOrchestrationOperateScope])),
- ),
- ),
- );
- const bot = yield* connect(botSession);
- const human = yield* connect(humanSession);
- const command = {
- type: "runtime-request.respond" as const,
- threadId,
- requestId: questionId,
- commandId: CommandId.make("synthetic-question-response"),
- answers: { color: "green" },
- createdBy: "user" as const,
- };
- const refused = yield* bot[ORCHESTRATION_V2_WS_METHODS.dispatchCommand](command).pipe(
- Effect.flip,
- );
- assert.include(refused.message, "needs a human answer");
- const dismiss = yield* bot[ORCHESTRATION_V2_WS_METHODS.dispatchCommand]({
- type: "thread.user-input.dismiss",
- threadId,
- requestId: questionId,
- commandId: CommandId.make("synthetic-question-dismiss"),
- }).pipe(Effect.flip);
- assert.include(dismiss.message, "needs a human answer");
- assert.equal(enqueued, 0);
- assert.isEmpty(dispatched);
-
- const accepted = yield* human[ORCHESTRATION_V2_WS_METHODS.dispatchCommand](command);
- assert.equal(accepted.sequence, 1);
- const approved = yield* bot[ORCHESTRATION_V2_WS_METHODS.dispatchCommand]({
- type: "runtime-request.respond",
- threadId,
- requestId: approvalId,
- commandId: CommandId.make("synthetic-permission-response"),
- decision: "accept",
- });
- assert.equal(approved.sequence, 2);
- assert.deepEqual(
- dispatched.map((received) => ("sentBy" in received ? received.sentBy?.sessionId : null)),
- [humanSession, botSession],
- );
- }).pipe(
- Effect.provide(
- Layer.mergeAll(
- Layer.fresh(layerConfigSources),
- Layer.mock(PreviewAutomationBroker.PreviewAutomationBroker)({}),
- Layer.mock(ServerBrowser.ServerBrowser)({}),
- ),
- ),
- ),
-);
-
it.effect("a git action that fails partway still refreshes the repository status", () =>
Effect.gen(function* () {
const failure = new GitManagerError({ operation: "test", cwd: "/repo", detail: "push failed" });
diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.ts
index e12eb5bc66320..47c07a381b4af 100644
--- a/apps/server/src/ws.ts
+++ b/apps/server/src/ws.ts
@@ -2078,38 +2078,6 @@ export const layerWsRpc = (
);
const UNENROLLED_SENDER_MESSAGE =
"This client is not enrolled as a founder. Pair it with a founder's pairing code, or have another client assign it in Settings → Connections.";
- const authorizeUserInput = Effect.fn("ws.authorizeUserInput")(function* (
- command: OrchestrationV2Command,
- ) {
- if (
- command.type !== "runtime-request.respond" &&
- command.type !== "thread.user-input.dismiss"
- )
- return;
-
- const reject = (message: string) =>
- new OrchestrationV2DispatchCommandError({
- commandId: command.commandId,
- commandType: command.type,
- message,
- detail: message,
- });
- const sender = yield* sessions
- .senderOf(currentSessionId)
- .pipe(Effect.mapError(() => reject("Could not verify the responding session.")));
- if (Option.isNone(sender)) return yield* reject("Could not verify the responding session.");
- if (sender.value.deviceType !== "bot") return;
-
- if (command.type === "runtime-request.respond") {
- const { runtimeRequests } = yield* orchestrationEngine
- .getThreadRecords(command.threadId, ["runtimeRequests"])
- .pipe(Effect.mapError(() => reject("Could not verify the runtime request.")));
- const request = runtimeRequests.find(({ id }) => id === command.requestId);
- if (request === undefined) return yield* reject("The runtime request was not found.");
- if (request.kind !== "user_input") return;
- }
- return yield* reject("This user-input card needs a human answer.");
- });
const fileUnderCreator = (
command: OrchestrationV2Command,
): Effect.Effect => {
@@ -2142,7 +2110,6 @@ export const layerWsRpc = (
: {}),
}).pipe(
Effect.andThen(() => refusesUnenrolled(command.type)),
- Effect.tap((refused) => (refused ? Effect.void : authorizeUserInput(command))),
Effect.flatMap((refused) => {
if (refused) {
return Effect.fail(