GeezerVison is showing github.com — fix(server): keep branch rename consistent and satisfy knip · pingdotgg/t3code@6a40eb3
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/orchestration-v2/TemporaryBranchRename.ts +24-7Lines changed: 24 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -97,13 +97,30 @@ const make = Effect.gen(function* () { | 97 | 97 | newBranch: generated.branch, | 98 | 98 | ...(settings.branchNamingMode === "custom" ? { exactName: true } : {}), | 99 | 99 | }); | 100 | | - yield* threads.dispatch({ | 101 | | - type: "thread.metadata.update", | 102 | | - commandId: CommandId.make(`${input.commandId}:branch-rename`), | 103 | | - threadId: input.threadId, | 104 | | - branch: renamed.branch, | 105 | | - worktreePath: cwd, | 106 | | - }); | | 100 | + // The update is rejected if the thread moved to another worktree during | | 101 | + // generation. Any failed update puts the old name back, so the thread | | 102 | + // never points at a branch that no longer exists. | | 103 | + yield* threads | | 104 | + .dispatch({ | | 105 | + type: "thread.metadata.update", | | 106 | + commandId: CommandId.make(`${input.commandId}:branch-rename`), | | 107 | + threadId: input.threadId, | | 108 | + branch: renamed.branch, | | 109 | + worktreePath: cwd, | | 110 | + expectedWorktreePath: cwd, | | 111 | + }) | | 112 | + .pipe( | | 113 | + Effect.tapError(() => | | 114 | + git | | 115 | + .renameBranch({ | | 116 | + cwd, | | 117 | + oldBranch: renamed.branch, | | 118 | + newBranch: oldBranch, | | 119 | + exactName: true, | | 120 | + }) | | 121 | + .pipe(Effect.ignore), | | 122 | + ), | | 123 | + ); | 107 | 124 | }).pipe( | 108 | 125 | Effect.catchCause((cause) => | 109 | 126 | Effect.logWarning("Thread worktree branch rename failed", { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/testkit/ProviderTurnStartMemory.fixture.mjs +31-14Lines changed: 31 additions & 14 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,20 +13,35 @@ const [Effect, Layer, FileSystem] = await Promise.all([ | 13 | 13 | load("FileSystem"), | 14 | 14 | ]); | 15 | 15 | const app = (file) => import(NodeURL.pathToFileURL(root + "/apps/server/src/" + file + ".ts")); | 16 | | -const [Start, Projection, Run, Sessions, Policy, Id, Sink, Handoff, Git, Project, Auth] = | 17 | | - await Promise.all([ | 18 | | - app("orchestration-v2/ProviderTurnStartService"), | 19 | | - app("orchestration-v2/ProjectionStore"), | 20 | | - app("orchestration-v2/RunExecutionService"), | 21 | | - app("orchestration-v2/ProviderSessionManager"), | 22 | | - app("orchestration-v2/RuntimePolicy"), | 23 | | - app("orchestration-v2/IdAllocator"), | 24 | | - app("orchestration-v2/EventSink"), | 25 | | - app("orchestration-v2/ContextHandoffService"), | 26 | | - app("git/GitWorkflowService"), | 27 | | - app("project/ProjectService"), | 28 | | - app("provider/Services/ProviderAuthService"), | 29 | | - ]); | | 16 | +const [ | | 17 | + Start, | | 18 | + Projection, | | 19 | + Run, | | 20 | + Sessions, | | 21 | + Policy, | | 22 | + Id, | | 23 | + Sink, | | 24 | + Handoff, | | 25 | + Git, | | 26 | + Project, | | 27 | + Auth, | | 28 | + Settings, | | 29 | + BranchRename, | | 30 | +] = await Promise.all([ | | 31 | + app("orchestration-v2/ProviderTurnStartService"), | | 32 | + app("orchestration-v2/ProjectionStore"), | | 33 | + app("orchestration-v2/RunExecutionService"), | | 34 | + app("orchestration-v2/ProviderSessionManager"), | | 35 | + app("orchestration-v2/RuntimePolicy"), | | 36 | + app("orchestration-v2/IdAllocator"), | | 37 | + app("orchestration-v2/EventSink"), | | 38 | + app("orchestration-v2/ContextHandoffService"), | | 39 | + app("git/GitWorkflowService"), | | 40 | + app("project/ProjectService"), | | 41 | + app("provider/Services/ProviderAuthService"), | | 42 | + app("serverSettings"), | | 43 | + app("orchestration-v2/TemporaryBranchRename"), | | 44 | +]); | 30 | 45 | let current; | 31 | 46 | let fullReads = 0; | 32 | 47 | const liveRuns = []; | @@ -49,6 +64,8 @@ const dependencies = Layer.mergeAll( | 49 | 64 | Layer.mock(Git.GitWorkflowService)({}), | 50 | 65 | Layer.mock(Project.ProjectService)({}), | 51 | 66 | Layer.mock(Auth.ProviderAuthService)({}), | | 67 | + Layer.mock(Settings.ServerSettingsService)({}), | | 68 | + Layer.mock(BranchRename.TemporaryBranchRename)({ rename: () => Effect.void }), | 52 | 69 | Layer.mock(Projection.ProjectionStoreV2)({ | 53 | 70 | getThreadProjection: () => | 54 | 71 | Effect.sync(() => { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/ClaudeModelCatalog.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -215,7 +215,7 @@ export function isClaudeCatalogUltracodeEffort(effort: string | null | undefined | 215 | 215 | return effort === "ultracode"; | 216 | 216 | } | 217 | 217 |
| 218 | | -export function resolveClaudeCatalogContextWindow( | | 218 | +function resolveClaudeCatalogContextWindow( | 219 | 219 | catalog: ClaudeModelCatalog, | 220 | 220 | modelSelection: ModelSelection | undefined, | 221 | 221 | ): string | undefined { | |
|