The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 22:15 UTC
fix(server): a git action that fails partway refreshes the Git panel (#29651)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Alex Southwell committed
Nov 12, 2026 at 10:04 UTC
b703fdbfdb20607ebe6b3380975b51288306b8e6
2 files changed
+78
-1
apps/server/src/ws.test.ts
+75
@@ -9,6 +9,7 @@ import {
9
AuthSourceControlWriteScope,
10
EnvironmentId,
11
EventId,
12
+ GitManagerError,
13
MessageId,
14
ProjectId,
15
ThreadId,
@@ -1542,6 +1543,80 @@ it.effect("a missing thread worktree gets its project's skills in the cwd snapsh
1543
),
1544
);
1545
1546
+it.effect("a git action that fails partway still refreshes the repository status", () =>
1547
+ Effect.gen(function* () {
1548
+ const failure = new GitManagerError({ operation: "test", cwd: "/repo", detail: "push failed" });
1549
+ const refreshFailure = new GitManagerError({
1550
+ operation: "refresh",
1551
+ cwd: "/repo",
1552
+ detail: "refresh failed",
1553
+ });
1554
+ const refreshed = yield* Deferred.make<string>();
1555
+ const exits = yield* Queue.unbounded<Exit.Exit<unknown, unknown>>();
1556
+ const services = Layer.mergeAll(
1557
+ layerUnusedConfigRpcServices,
1558
+ Layer.mock(GitWorkflowService.GitWorkflowService)({
1559
+ runStackedAction: () => Effect.fail(failure),
1560
+ }),
1561
+ Layer.mock(VcsStatusBroadcaster.VcsStatusBroadcaster)({
1562
+ refreshStatus: (cwd) =>
1563
+ Deferred.succeed(refreshed, cwd).pipe(Effect.andThen(Effect.fail(refreshFailure))),
1564
+ }),
1565
+ Layer.mock(ExternalLauncher.ExternalLauncher)({}),
1566
+ Layer.mock(ProviderRegistry.ProviderRegistry)({}),
1567
+ Layer.mock(UsageLimitSources.UsageLimitSources)({}),
1568
+ Layer.mock(RemoteOpenTargets.RemoteOpenTargets)({}),
1569
+ Layer.mock(DirectEndpoints.DirectEndpoints)({}),
1570
+ Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({ namedProjectsRoot: "/unused" }),
1571
+ Layer.mock(ScratchThreadPromotion.ScratchThreadPromotion)({}),
1572
+ Layer.mock(ServerEnvironment.ServerEnvironment)({}),
1573
+ Layer.mock(EnvironmentAuth.EnvironmentAuth)({}),
1574
+ );
1575
+ const server = yield* RpcServer.makeNoSerialization(WsRpcGroup, {
1576
+ ...WS_RPC_SERVER_OPTIONS,
1577
+ onFromServer: (response) =>
1578
+ response._tag === "Exit" ? Queue.offer(exits, response.exit) : Effect.void,
1579
+ }).pipe(
1580
+ Effect.provide(
1581
+ layerWsRpc(
1582
+ {
1583
+ sessionId: AuthSessionId.make("git-test"),
1584
+ subject: "git-test",
1585
+ method: "browser-session-cookie",
1586
+ scopes: [AuthSourceControlWriteScope],
1587
+ },
1588
+ {},
1589
+ yield* ServerBrowser.ServerBrowser,
1590
+ () => Effect.void,
1591
+ { secretReferences: true },
1592
+ ).pipe(
1593
+ Layer.provide(services),
1594
+ Layer.merge(RpcAuthorization.layer([AuthSourceControlWriteScope])),
1595
+ ),
1596
+ ),
1597
+ );
1598
+ yield* server.write(0, {
1599
+ _tag: "Request",
1600
+ id: RpcMessage.RequestId("git"),
1601
+ tag: WS_METHODS.gitRunStackedAction,
1602
+ payload: { actionId: "action", cwd: "/repo", action: "commit_push" },
1603
+ headers: Headers.empty,
1604
+ });
1605
+ const exit = yield* Queue.take(exits);
1606
+ assert.deepEqual(Exit.isFailure(exit) ? Cause.squash(exit.cause) : exit, failure);
1607
+ assert.equal(yield* Deferred.await(refreshed), "/repo");
1608
+ }).pipe(
1609
+ Effect.provide(
1610
+ Layer.mergeAll(
1611
+ Layer.fresh(layerConfigSources),
1612
+ Layer.mock(PreviewAutomationBroker.PreviewAutomationBroker)({}),
1613
+ Layer.mock(ServerBrowser.ServerBrowser)({}),
1614
+ ),
1615
+ ),
1616
+ Effect.scoped,
1617
+ ),
1618
+);
1619
+
1620
it.effect("a publish whose push fails still refreshes the new remote", () =>
1621
Effect.gen(function* () {
1622
const refreshes = yield* Queue.unbounded<string>();
apps/server/src/ws.ts
+3
-1
@@ -3070,7 +3070,9 @@ export const layerWsRpc = (
3070
})
3071
.pipe(
3072
Effect.matchCauseEffect({
3073
- onFailure: (cause) => Queue.failCause(queue, cause),
3073
+ // Earlier steps (branch, commit) may have landed before the failing one.
3074
+ onFailure: (cause) =>
3075
+ refreshGitStatus(input.cwd).pipe(Effect.andThen(Queue.failCause(queue, cause))),
3076
onSuccess: (result) =>
3077
(input.threadId === undefined
3078
? Effect.void