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 — feat(server): agents ask for secrets through request_secret instead of chat by gabrielelpidio · Pull Request #30257 · pingdotgg/t3code

feat(server): agents ask for secrets through request_secret instead of chat #30257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
gabrielelpidio merged 5 commits into t3/secret-request-evals from t3/secret-request-guidance
Nov 4, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat(server): agents ask for secrets through request_secret instead of chat #30257

Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
6a5436d
feat(server): agents ask for secrets through request_secret instead o…
gabrielelpidio Nov 3, 2026
166fe4d
fix(server): keep a pasted secret's file per session and unchanged on…
gabrielelpidio Nov 3, 2026
bcab2e1
test(server): time out the unsaved-note card on a test clock
gabrielelpidio Nov 3, 2026
03afb65
fix(server): let the model choose a card for sudo and OAuth, and keep…
gabrielelpidio Nov 4, 2026
2c52acf
fix(server): shorten delegate_task's secret rule to "No secrets in `t…
gabrielelpidio Nov 4, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

186 changes: 186 additions & 0 deletions 186 apps/server/src/mcp/OrchestratorMcpService.activity.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import {
ProviderInstanceId,
RunId,
ScheduledTaskId,
SECRET_REQUEST_UNSAVED_NOTE,
ThreadId,
TurnItemId,
} from "@t3tools/contracts";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
import * as Layer from "effect/Layer";
import * as Metric from "effect/Metric";
import * as TestClock from "effect/testing/TestClock";
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
import { expect, it } from "vite-plus/test";

Expand Down Expand Up @@ -655,3 +659,185 @@ it("readThread and sendToThread reach threads in other projects", async () => {
expect(stopped.code).toBe("parent_not_active");
}).pipe(Effect.provide(layer), Effect.runPromise);
});

it("requestSecret saves a pasted value to a file without opening a card", async () => {
const projection = {
thread: baseThread({
threadId: parentThreadId,
title: "Parent",
instanceId: parentInstanceId,
model: "gpt-5.4",
}),
runs: [{ ...makeRun({ id: activeRunId, ordinal: 1, status: "running" }), rootNodeId: taskId }],
visibleTurnItems: [],
runtimeRequests: [],
messages: [],
contextTransfers: [],
subagents: [],
updatedAt: now,
} as unknown as OrchestrationV2ThreadProjection;
const dispatched: Array<unknown> = [];
const saved: Array<{
readonly requestNamespace: string;
readonly requestKey: string;
readonly value: string;
}> = [];
const file = "/home/user/.t3/userdata/secrets/files/0123456789abcdef0123456789abcdef";

const layer = layerOrchestratorService.pipe(
Layer.provide(
Layer.mergeAll(
Layer.mock(ThreadManagementService.ThreadManagementService)({
getThreadRecords: (threadId) =>
threadId === parentThreadId
? Effect.succeed(projection)
: Effect.die(`unexpected thread ${threadId}`),
getThreadShell: (threadId) =>
Effect.succeed(
threadId === parentThreadId
? (projection.thread as unknown as OrchestrationV2ThreadShell)
: null,
),
dispatch: (command) => Effect.sync(() => void dispatched.push(command) as never),
} satisfies Partial<ThreadManagementService.ThreadManagementService["Service"]>),
ServerSettings.layerTest(),
Layer.mock(ProviderRegistry.ProviderRegistry)({
getProviders: Effect.succeed([]),
} satisfies Partial<ProviderRegistry.ProviderRegistry["Service"]>),
Layer.mock(ProjectService.ProjectService)({}),
Layer.mock(SecretRequests.SecretRequests)({
savePasted: (input) =>
Effect.sync(() => {
saved.push({
requestNamespace: input.requestNamespace,
requestKey: input.requestKey,
value: input.value,
});
return file;
}),
}),
Layer.mock(RemoteDelegation.RemoteDelegation)({}),
Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
Layer.mock(ProviderAdapterRegistry.ProviderAdapterRegistryV2)({}),
NodeCrypto.layer,
),
),
);
const counted = Metric.snapshot.pipe(
Effect.map((snapshots) => {
const found = snapshots.find(
(snapshot) =>
snapshot.id === "t3_secret_requests_total" &&
snapshot.attributes?.status === "saved_pasted",
);
return found?.type === "Counter" ? Number(found.state.count) : 0;
}),
);

await Effect.gen(function* () {
const service = yield* OrchestratorMcpService.OrchestratorMcpService;
const before = yield* counted;
const result = yield* service.requestSecret(makeScope(), {
label: "Pixel PIN",
reason: "Unlocks the test phone.",
value: "482916",
clientRequestId: "pin-1",
});
expect(result).toEqual({ status: "saved", file });
expect(JSON.stringify(result)).not.toContain("482916");
expect(saved).toEqual([
{
requestNamespace: "provider-session-mcp-orchestrator-detail",
requestKey: "pin-1",
value: "482916",
},
]);
expect(dispatched).toEqual([]);
expect((yield* counted) - before).toBe(1);

const asRef = yield* service
.requestSecret(makeScope(), {
label: "Pixel PIN",
reason: "Unlocks the test phone.",
value: "482916",
delivery: "secretRef",
})
.pipe(Effect.flip);
expect(asRef.code).toBe("invalid_request");
expect(asRef.message).not.toContain("482916");
expect(saved).toHaveLength(1);
expect(dispatched).toEqual([]);
}).pipe(Effect.provide(layer), Effect.runPromise);
});

it("requestSecret returns the unsaved note for a declined, cancelled or timed-out card", async () => {
const outcomes = ["declined", "cancelled", "pending"] as const;
const results = await Effect.forEach(outcomes, (outcome) => {
const dispatched: Array<{ readonly type: string; readonly turnItemId?: string }> = [];
const projection = () => {
const card = dispatched.find((command) => command.type === "secret_request.record");
return {
thread: baseThread({
threadId: parentThreadId,
title: "Parent",
instanceId: parentInstanceId,
model: "gpt-5.4",
}),
runs: [
{ ...makeRun({ id: activeRunId, ordinal: 1, status: "running" }), rootNodeId: taskId },
],
visibleTurnItems: [],
turnItems:
card === undefined
? []
: [{ type: "secret_request", id: card.turnItemId, secretStatus: outcome }],
runtimeRequests: [],
messages: [],
contextTransfers: [],
subagents: [],
updatedAt: now,
} as unknown as OrchestrationV2ThreadProjection;
};
const layer = layerOrchestratorService.pipe(
Layer.provide(
Layer.mergeAll(
Layer.mock(ThreadManagementService.ThreadManagementService)({
getThreadRecords: () => Effect.sync(projection),
getThreadShell: () =>
Effect.sync(() => projection().thread as unknown as OrchestrationV2ThreadShell),
dispatch: (command) => Effect.sync(() => void dispatched.push(command) as never),
} satisfies Partial<ThreadManagementService.ThreadManagementService["Service"]>),
ServerSettings.layerTest(),
Layer.mock(ProviderRegistry.ProviderRegistry)({
getProviders: Effect.succeed([]),
} satisfies Partial<ProviderRegistry.ProviderRegistry["Service"]>),
Layer.mock(ProjectService.ProjectService)({}),
Layer.mock(SecretRequests.SecretRequests)({}),
Layer.mock(RemoteDelegation.RemoteDelegation)({}),
Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
Layer.mock(ProviderAdapterRegistry.ProviderAdapterRegistryV2)({}),
NodeCrypto.layer,
),
),
);
return Effect.gen(function* () {
const service = yield* OrchestratorMcpService.OrchestratorMcpService;
const request = yield* service
.requestSecret(makeScope(), {
label: "Staging password",
reason: "Signs in the QA account.",
delivery: "file",
timeoutMs: 1_000,
})
.pipe(Effect.forkChild({ startImmediately: true }));
yield* TestClock.adjust("2 seconds");
return yield* Fiber.join(request);
}).pipe(Effect.provide(Layer.merge(layer, TestClock.layer())));
}).pipe(Effect.runPromise);

expect(results).toEqual([
{ status: "declined", note: SECRET_REQUEST_UNSAVED_NOTE.declined },
{ status: "cancelled", note: SECRET_REQUEST_UNSAVED_NOTE.cancelled },
{ status: "timed_out", note: SECRET_REQUEST_UNSAVED_NOTE.timed_out },
]);
});
23 changes: 22 additions & 1 deletion 23 apps/server/src/mcp/OrchestratorMcpService.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import {
ThreadId,
isOrchestrationV2WorkActive,
resolveProjectProviderInstanceEnabled,
SECRET_REQUEST_UNSAVED_NOTE,
} from "@t3tools/contracts";
import { getProviderOptionCurrentValue } from "@t3tools/shared/model";
import { runRanAfter } from "@t3tools/shared/orchestrationV2ThreadError";
Expand Down Expand Up @@ -2135,6 +2136,26 @@ const make = Effect.gen(function* () {
"Asking for a secret requires an active run owned by this MCP provider session.",
);
}
// A secret the user already pasted needs no card: it goes straight to a file.
if (input.value !== undefined) {
if (input.delivery === "secretRef") {
return yield* failure(
"invalid_request",
'A pasted `value` is saved as a file. Leave out `delivery: "secretRef"`.',
);
}
const file = yield* secretRequests
.savePasted({
threadId,
requestNamespace: scope.requestNamespace,
requestKey: yield* requestKey(input.clientRequestId),
value: input.value,
})
.pipe(Effect.mapError((error) => failure("orchestration_error", error.message)));
yield* Effect.annotateCurrentSpan({ "secret_request.status": "saved_pasted" });
yield* Metrics.increment(Metrics.secretRequestsTotal, { status: "saved_pasted" });
return { status: "saved" as const, file };
}
const runId = run.id;
const nodeId = run.rootNodeId;
const key = yield* requestKey(input.clientRequestId);
Expand Down Expand Up @@ -2235,7 +2256,7 @@ const make = Effect.gen(function* () {
);
yield* Effect.annotateCurrentSpan({ "secret_request.status": status });
yield* Metrics.increment(Metrics.secretRequestsTotal, { status });
if (status !== "saved") return { status };
if (status !== "saved") return { status, note: SECRET_REQUEST_UNSAVED_NOTE[status] };
if (input.delivery === "file") {
const file = yield* secretRequests
.saveToFile({ threadId, turnItemId })
Expand Down
8 changes: 5 additions & 3 deletions 8 apps/server/src/mcp/toolkits/orchestrator/tools.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const OrchestratorCapabilitiesTool = Tool.make("orchestrator_capabilities", {

const DelegateTaskTool = Tool.make("delegate_task", {
description:
"Start one child agent with only `task`. No parent history. Separate checkout or PR per child: `isolation:'worktree'`. Keep `taskId` for `task_status` and `task_cancel`.",
"Start one child agent with only `task`. No parent history. Separate checkout or PR per child: `isolation:'worktree'`. Keep `taskId` for `task_status` and `task_cancel`. No secrets in `task` or temp files: `request_secret` `value`.",
Comment thread
gabrielelpidio marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

parameters: OrchestratorMcpDelegateTaskInput,
success: OrchestratorMcpDelegateTaskResult,
failure: OrchestratorMcpFailure,
Expand Down Expand Up @@ -197,15 +197,17 @@ const DeleteScheduledTaskTool = Tool.make("delete_scheduled_task", {

const RequestSecretTool = Tool.make("request_secret", {
description:
'Ask the user to enter a secret in a private card and wait. You never see the value. Returns a one-use `secretRef` for a tool that accepts it, or with `delivery: "file"` a private file path to read inside a shell command. Asked how to provide a secret: call this now, do not explain instead.',
'Ask for a secret in a private card and wait; open it, don\'t offer it. Returns a one-use `secretRef`, or with `delivery: "file"` a file to read only in its command, e.g. `adb pair <ip:port> "$(cat <file>)"`. Asked how to give one: call now. Pasted secret for child or script: `value`. Not one from an old thread.',
Comment thread
gabrielelpidio marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

parameters: OrchestratorMcpRequestSecretInput,
success: OrchestratorMcpRequestSecretResult,
failure: OrchestratorMcpFailure,
failureMode: "return",
dependencies,
})
.annotate(Tool.Title, "Request a secret from the user")
.annotate(Tool.Destructive, false);
.annotate(Tool.Destructive, false)
// Claude Code defers MCP tools behind ToolSearch; agents that never load this one ask in chat.
.annotate(Tool.Meta, { "anthropic/alwaysLoad": true });

const CreateThreadsTool = Tool.make("create_threads", {
description:
Expand Down
25 changes: 17 additions & 8 deletions 25 apps/server/src/provider/AgentContextBudget.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ const codexAdditionalContext = () =>
.map((entry) => entry.value)
.join("");

const layerAdvertisedTools = McpHttpServer.layerTools.pipe(
Layer.provideMerge(McpHttpServer.layerInProcessMcpServer),
Layer.provide(toolHandlerServices),
);

// Claude Code loads these tools up front instead of behind ToolSearch, outside this budget.
it.effect("only request_secret asks Claude Code to load it up front", () =>
Effect.gen(function* () {
const mcp = yield* McpServer.McpServer;
const alwaysLoad = mcp.tools
.filter(({ tool }) => tool._meta?.["anthropic/alwaysLoad"] !== undefined)
.map(({ tool }) => [tool.name, tool._meta]);
expect(alwaysLoad).toEqual([["request_secret", { "anthropic/alwaysLoad": true }]]);
}).pipe(Effect.provide(layerAdvertisedTools)),
);

// CI rejects a PR that raises any value above main's agentContextBudget.json, so growth
// needs the agent-context-increase label. Lower the values when the text shrinks.
it.effect("agent context matches the committed budget", () =>
Expand All @@ -130,12 +146,5 @@ it.effect("agent context matches the committed budget", () =>
measured,
"Set agentContextBudget.json to the measured values. Before you cut text to fit, run the evals that cover it (evals/README.md).",
).toEqual(budget);
}).pipe(
Effect.provide(
McpHttpServer.layerTools.pipe(
Layer.provideMerge(McpHttpServer.layerInProcessMcpServer),
Layer.provide(toolHandlerServices),
),
),
),
}).pipe(Effect.provide(layerAdvertisedTools)),
);
4 changes: 2 additions & 2 deletions 4 apps/server/src/provider/agentContextBudget.json
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"claudeSystemAppendBytes": 5153,
"codexAdditionalContextBytes": 6883,
"claudeSystemAppendBytes": 5133,
"codexAdditionalContextBytes": 6863,
"mcpToolListJsonBytes": 47538
}
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402809 — 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.