GeezerVison is showing github.com — fix(web): restore fork features lost in the #415 upstream sync (#458) · adampeterhiggins/t3code@5843b00
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/mcp/toolkits/core.test.ts +38Lines changed: 38 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,6 +58,21 @@ import * as McpToolAccessTestkit from "../McpToolAccess.testkit.ts"; | 58 | 58 | import { dispatchFailure } from "../threadAccess.ts"; | 59 | 59 | import * as EnvironmentHandlers from "./environment/handlers.ts"; | 60 | 60 | import * as AttachmentHandlers from "./attachment/handlers.ts"; | | 61 | +import { ApprovalToolkit } from "./approval/tools.ts"; | | 62 | +import { AttachmentToolkit } from "./attachment/tools.ts"; | | 63 | +import { DeviceToolkit } from "./device/tools.ts"; | | 64 | +import { EnvironmentToolkit } from "./environment/tools.ts"; | | 65 | +import { HtmlToolkit } from "./html/tools.ts"; | | 66 | +import { IssueLinksToolkit } from "./issueLinks/tools.ts"; | | 67 | +import { MessageDraftsToolkit } from "./messageDrafts/tools.ts"; | | 68 | +import { OrchestratorToolkit } from "./orchestrator/tools.ts"; | | 69 | +import { PreviewToolkit } from "./preview/tools.ts"; | | 70 | +import { PreviewControlsToolkit } from "./previewControls/tools.ts"; | | 71 | +import { ProjectToolkit } from "./project/tools.ts"; | | 72 | +import { PullRequestsToolkit } from "./pullRequests/tools.ts"; | | 73 | +import { ThreadToolkit } from "./thread/tools.ts"; | | 74 | +import { ThreadDeleteToolkit } from "./threadDelete/tools.ts"; | | 75 | +import { WorktreeToolkit } from "./worktree/tools.ts"; | 61 | 76 |
| 62 | 77 | const layerOrchestratorToolkit = McpHttpServer.layerOrchestratorToolkit.pipe( | 63 | 78 | Layer.provide(Layer.mock(ThreadLaunchService.ThreadLaunchService)({})), | @@ -95,6 +110,29 @@ const layerThreadToolkitWith = ( | 95 | 110 | ); | 96 | 111 | const layerThreadToolkit = layerThreadToolkitWith(layerThreadMoveServices); | 97 | 112 |
| | 113 | +// All toolkits share one MCP server, so a duplicate name silently shadows a tool. | | 114 | +it("publishes unique tool names across every toolkit", () => { | | 115 | + const names = [ | | 116 | + ApprovalToolkit, | | 117 | + AttachmentToolkit, | | 118 | + DeviceToolkit, | | 119 | + EnvironmentToolkit, | | 120 | + HtmlToolkit, | | 121 | + IssueLinksToolkit, | | 122 | + MessageDraftsToolkit, | | 123 | + OrchestratorToolkit, | | 124 | + PreviewToolkit, | | 125 | + PreviewControlsToolkit, | | 126 | + ProjectToolkit, | | 127 | + PullRequestsToolkit, | | 128 | + ThreadToolkit, | | 129 | + ThreadDeleteToolkit, | | 130 | + WorktreeToolkit, | | 131 | + ].flatMap((toolkit) => Object.values(toolkit.tools).map((tool) => tool.name)); | | 132 | + expect(names.filter((name, index) => names.indexOf(name) !== index)).toEqual([]); | | 133 | + expect(names).toEqual(expect.arrayContaining(["link_linear_issue", "t3_draft_create"])); | | 134 | +}); | | 135 | + | 98 | 136 | const threadId = ThreadId.make("mcp-core-thread"); | 99 | 137 | const scope: McpInvocationContext.McpInvocationScope = { | 100 | 138 | environmentId: EnvironmentId.make("mcp-core-environment"), | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts +51Lines changed: 51 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4224,6 +4224,57 @@ describe("ClaudeAdapterV2 background wake turns", () => { | 4224 | 4224 | ), | 4225 | 4225 | ); | 4226 | 4226 |
| | 4227 | + it.effect("keeps usage warnings and provisioned overage silent", () => | | 4228 | + Effect.gen(function* () { | | 4229 | + const harness = yield* makeWakeHarness; | | 4230 | + const now = yield* DateTime.now; | | 4231 | + yield* harness.runtime.startTurn( | | 4232 | + makeClaudeTestTurnInput({ | | 4233 | + threadId: harness.threadId, | | 4234 | + providerThread: harness.providerThread, | | 4235 | + now, | | 4236 | + attemptId: RunAttemptId.make("attempt-claude-overage"), | | 4237 | + text: "Continue.", | | 4238 | + attachments: [], | | 4239 | + }), | | 4240 | + ); | | 4241 | + for (const rate_limit_info of [ | | 4242 | + { status: "allowed_warning" }, | | 4243 | + { status: "rejected", overageStatus: "allowed" }, | | 4244 | + { status: "rejected", overageStatus: "allowed_warning" }, | | 4245 | + { status: "rejected", isUsingOverage: true }, | | 4246 | + { status: "rejected", overageInUse: true }, | | 4247 | + ]) { | | 4248 | + yield* Queue.offer( | | 4249 | + harness.sdkMessages, | | 4250 | + claudeSdkFrame({ | | 4251 | + type: "rate_limit_event", | | 4252 | + rate_limit_info, | | 4253 | + session_id: WAKE_NATIVE_SESSION, | | 4254 | + uuid: "00000000-0000-4000-8000-000000000604", | | 4255 | + }), | | 4256 | + ); | | 4257 | + } | | 4258 | + yield* Queue.offer( | | 4259 | + harness.sdkMessages, | | 4260 | + makeResultFrame({ | | 4261 | + uuid: "00000000-0000-4000-8000-000000000605", | | 4262 | + result: "Done.", | | 4263 | + }), | | 4264 | + ); | | 4265 | + yield* Queue.take(harness.terminalReceipts); | | 4266 | + assert.isFalse( | | 4267 | + harness.events.some( | | 4268 | + (event) => event.type === "turn_item.updated" && event.turnItem.type === "system_notice", | | 4269 | + ), | | 4270 | + ); | | 4271 | + }).pipe( | | 4272 | + Effect.provide( | | 4273 | + Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer), | | 4274 | + ), | | 4275 | + ), | | 4276 | + ); | | 4277 | + | 4227 | 4278 | it.effect("keeps a later future-window event-supplied Claude reset over the embedded reset", () => | 4228 | 4279 | Effect.gen(function* () { | 4229 | 4280 | const harness = yield* makeWakeHarness; | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts +25Lines changed: 25 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1028,6 +1028,31 @@ effectIt.effect("does not mistake a failed state read for a superseded run", () | 1028 | 1028 | }), | 1029 | 1029 | ); | 1030 | 1030 |
| | 1031 | +effectIt.effect("resumes an imported native session on its first T3 turn", () => | | 1032 | + Effect.gen(function* () { | | 1033 | + const firstTurnFor = (marked: boolean) => | | 1034 | + Effect.gen(function* () { | | 1035 | + const harness = makeLocalCommandHarness({ | | 1036 | + text: "Continue", | | 1037 | + existingClaudeSession: { marked }, | | 1038 | + }); | | 1039 | + yield* harness.start; | | 1040 | + expect(harness.startRootRun).toHaveBeenCalledOnce(); | | 1041 | + return harness.startRootRun.mock.calls[0]![0]; | | 1042 | + }); | | 1043 | + | | 1044 | + // Claude creates the session on a first turn without prior native turns, | | 1045 | + // which the CLI rejects for an imported session id that already exists. | | 1046 | + const imported = yield* firstTurnFor(true); | | 1047 | + expect(imported.providerTurnOrdinal).toBe(1); | | 1048 | + expect(imported.nativeThreadHasTurns).toBe(true); | | 1049 | + | | 1050 | + const unmarked = yield* firstTurnFor(false); | | 1051 | + expect(unmarked.providerTurnOrdinal).toBe(1); | | 1052 | + expect(unmarked.nativeThreadHasTurns).toBe(false); | | 1053 | + }), | | 1054 | +); | | 1055 | + | 1031 | 1056 | effectIt.effect( | 1032 | 1057 | "signs out the existing native provider before opening the newly selected provider", | 1033 | 1058 | () => | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/project/AgentSessionScanner.test.ts +49Lines changed: 49 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1156,6 +1156,55 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => { | 1156 | 1156 | }), | 1157 | 1157 | ); | 1158 | 1158 |
| | 1159 | + it.effect("imports sessions started in a subfolder unless a nested project owns it", () => | | 1160 | + Effect.gen(function* () { | | 1161 | + const fileSystem = yield* FileSystem.FileSystem; | | 1162 | + const path = yield* Path.Path; | | 1163 | + const nowMs = Date.parse("2026-08-24T12:00:00.000Z"); | | 1164 | + yield* TestClock.setTime(nowMs); | | 1165 | + const claudeHomePath = yield* makeTempDir("t3code-claude-home-"); | | 1166 | + const codexHomePath = yield* makeTempDir("t3code-codex-home-"); | | 1167 | + const workspace = yield* makeTempDir("t3code-workspace-"); | | 1168 | + const subfolder = path.join(workspace, "functions", "billing"); | | 1169 | + const nestedProject = path.join(workspace, "nested"); | | 1170 | + yield* fileSystem.makeDirectory(subfolder, { recursive: true }); | | 1171 | + yield* fileSystem.makeDirectory(path.join(nestedProject, "src"), { recursive: true }); | | 1172 | + | | 1173 | + const writeSession = (cwd: string, sessionId: string, ageMs: number) => | | 1174 | + writeTranscript({ | | 1175 | + filePath: path.join(claudeHomePath, "projects", `-${sessionId}`, `${sessionId}.jsonl`), | | 1176 | + contents: `${JSON.stringify({ | | 1177 | + type: "user", | | 1178 | + cwd, | | 1179 | + sessionId, | | 1180 | + timestamp: "2026-08-23T12:00:00.000Z", | | 1181 | + message: { role: "user", content: "Fix the project" }, | | 1182 | + })}\n`, | | 1183 | + mtimeMs: nowMs - ageMs, | | 1184 | + }); | | 1185 | + yield* writeSession(workspace, "at-root", 1_000); | | 1186 | + yield* writeSession(subfolder, "in-subfolder", 2_000); | | 1187 | + yield* writeSession(path.join(subfolder, "deleted"), "in-deleted-folder", 3_000); | | 1188 | + yield* writeSession(path.join(nestedProject, "src"), "in-nested-project", 4_000); | | 1189 | + yield* writeSession(path.dirname(workspace), "above-root", 5_000); | | 1190 | + | | 1191 | + const sessionIds = (workspaceRoot: string) => | | 1192 | + runRecentThreads({ | | 1193 | + claudeHomePath, | | 1194 | + codexHomePath, | | 1195 | + workspaceRoot, | | 1196 | + importedWorkspaceRoots: [workspace, nestedProject], | | 1197 | + }).pipe(Effect.map((threads) => threads.map((thread) => thread.providerSessionId))); | | 1198 | + | | 1199 | + expect(yield* sessionIds(workspace)).toEqual([ | | 1200 | + "at-root", | | 1201 | + "in-subfolder", | | 1202 | + "in-deleted-folder", | | 1203 | + ]); | | 1204 | + expect(yield* sessionIds(nestedProject)).toEqual(["in-nested-project"]); | | 1205 | + }), | | 1206 | + ); | | 1207 | + | 1159 | 1208 | it.effect("keeps the provider instance that owns a custom session home", () => | 1160 | 1209 | Effect.gen(function* () { | 1161 | 1210 | const path = yield* Path.Path; | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/ChatMarkdown.permissions.browser.test.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -189,7 +189,7 @@ it("removes host actions after revocation while keeping file preview and copying | 189 | 189 | using _setup = setup(); | 190 | 190 | await using screen = await renderMarkdown("[Readme](docs/readme.md)"); | 191 | 191 | await screen.openContextMenu(); | 192 | | - expect(offeredActions()).toEqual(["open", "reveal", "copy-relative", "copy-full"]); | | 192 | + expect(offeredActions()).toEqual(["open", "open-with", "reveal", "copy-relative", "copy-full"]); | 193 | 193 | await setAllowed(false); | 194 | 194 | state.choose.mockResolvedValue("copy-full"); | 195 | 195 | await screen.openContextMenu(); | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/ChatMarkdown.tsx +49-3Lines changed: 49 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,6 +38,9 @@ import { | 38 | 38 | import { | 39 | 39 | AssetWorkspaceAssetNotFoundError, | 40 | 40 | AuthPreviewOperateScope, | | 41 | + DEFAULT_SERVER_SETTINGS, | | 42 | + EDITORS, | | 43 | + resolveFileOpenTarget, | 41 | 44 | type EditorId, | 42 | 45 | type EnvironmentId, | 43 | 46 | type ServerConfig, | @@ -426,10 +429,23 @@ type MarkdownServerConfigFields = ReturnType<typeof markdownServerConfigFields>; | 426 | 429 |
| 427 | 430 | /** The server config fields markdown reads. */ | 428 | 431 | function markdownServerConfigFields(config: ServerConfig | null) { | | 432 | + const settings = config?.settings ?? DEFAULT_SERVER_SETTINGS; | | 433 | + const availableEditors = config?.availableEditors ?? NO_MARKDOWN_EDITORS; | 429 | 434 | return { | 430 | 435 | pullRequestsEnabled: config?.environment.capabilities.pullRequests === true, | 431 | 436 | threadPullRequestsEnabled: config?.environment.capabilities.threadPullRequests === true, | 432 | | - availableEditors: config?.availableEditors ?? NO_MARKDOWN_EDITORS, | | 437 | + availableEditors, | | 438 | + // Fork: file links follow Settings → Open in (default target, extension rules, custom apps). | | 439 | + fileOpenSettings: { | | 440 | + fileOpenDefault: settings.fileOpenDefault, | | 441 | + fileOpenRules: settings.fileOpenRules, | | 442 | + }, | | 443 | + openWithEditors: [ | | 444 | + ...EDITORS.filter( | | 445 | + (editor) => editor.id !== "file-manager" && availableEditors.includes(editor.id), | | 446 | + ), | | 447 | + ...settings.customEditors, | | 448 | + ].map(({ id, label }) => ({ id, label })), | 433 | 449 | revealInFileManagerLabel: | 434 | 450 | config?.shellRevealInFileManager === true && config.availableEditors.includes("file-manager") | 435 | 451 | ? config.shellRevealInFileManagerKind === undefined | @@ -448,7 +464,18 @@ function markdownServerConfigFieldsEqual( | 448 | 464 | previous.threadPullRequestsEnabled === next.threadPullRequestsEnabled && | 449 | 465 | previous.revealInFileManagerLabel === next.revealInFileManagerLabel && | 450 | 466 | previous.availableEditors.length === next.availableEditors.length && | 451 | | - previous.availableEditors.every((editor, index) => editor === next.availableEditors[index]) | | 467 | + previous.availableEditors.every((editor, index) => editor === next.availableEditors[index]) && | | 468 | + previous.fileOpenSettings.fileOpenDefault === next.fileOpenSettings.fileOpenDefault && | | 469 | + previous.fileOpenSettings.fileOpenRules.length === next.fileOpenSettings.fileOpenRules.length && | | 470 | + previous.fileOpenSettings.fileOpenRules.every((rule, index) => { | | 471 | + const nextRule = next.fileOpenSettings.fileOpenRules[index]; | | 472 | + return rule.extension === nextRule?.extension && rule.target === nextRule.target; | | 473 | + }) && | | 474 | + previous.openWithEditors.length === next.openWithEditors.length && | | 475 | + previous.openWithEditors.every((editor, index) => { | | 476 | + const nextEditor = next.openWithEditors[index]; | | 477 | + return editor.id === nextEditor?.id && editor.label === nextEditor.label; | | 478 | + }) | 452 | 479 | ); | 453 | 480 | } | 454 | 481 |
| @@ -609,11 +636,17 @@ function useChatMarkdownState({ | 609 | 636 | pullRequestsEnabled, | 610 | 637 | threadPullRequestsEnabled, | 611 | 638 | availableEditors, | | 639 | + fileOpenSettings, | | 640 | + openWithEditors, | 612 | 641 | revealInFileManagerLabel, | 613 | 642 | } = useAtomValue(markdownServerConfigFieldsAtom(environmentId)); | 614 | 643 | const projects = useProjects(); | 615 | 644 | const [preferredEditor] = usePreferredEditor(availableEditors); | 616 | | - const preferredEditorMenuLabel = openInEditorMenuLabel(preferredEditor); | | 645 | + const customEditorLabel = openWithEditors.find((editor) => editor.id === preferredEditor)?.label; | | 646 | + const preferredEditorMenuLabel = | | 647 | + customEditorLabel !== undefined && !EDITORS.some((editor) => editor.id === preferredEditor) | | 648 | + ? `Open in ${customEditorLabel}` | | 649 | + : openInEditorMenuLabel(preferredEditor); | 617 | 650 | const openInPreferredEditor = useOpenInPreferredEditor(environmentId, availableEditors); | 618 | 651 | const openInEditor = useAtomCommand(shellEnvironment.openInEditor, { | 619 | 652 | reportFailure: false, | @@ -856,6 +889,7 @@ function useChatMarkdownState({ | 856 | 889 | fileLinkMeta.workspaceRelativePath ?? | 857 | 890 | (!canPreviewMedia && isHostPath(fileLinkMeta.filePath) ? fileLinkMeta.filePath : null); | 858 | 891 |
| | 892 | + const fileOpenTarget = resolveFileOpenTarget(fileLinkMeta.filePath, fileOpenSettings); | 859 | 893 | return ( | 860 | 894 | <MarkdownFileLink | 861 | 895 | environmentId={environmentId} | @@ -881,6 +915,18 @@ function useChatMarkdownState({ | 881 | 915 | ? async () => | 882 | 916 | openInPreferredEditor( | 883 | 917 | markdownFileEditorTarget(fileLinkMeta, await resolveHostPath()), | | 918 | + fileOpenTarget === "t3" ? undefined : fileOpenTarget, | | 919 | + ) | | 920 | + : undefined | | 921 | + } | | 922 | + openExternally={fileOpenTarget !== "t3"} | | 923 | + openWithEditors={openWithEditors} | | 924 | + onOpenWith={ | | 925 | + canUseShellActions | | 926 | + ? async (editor: EditorId) => | | 927 | + openInPreferredEditor( | | 928 | + markdownFileEditorTarget(fileLinkMeta, await resolveHostPath()), | | 929 | + editor, | 884 | 930 | ) | 885 | 931 | : undefined | 886 | 932 | } | |
|