[codex] feat(web): show git progress in the commit button (#4963)

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex authored and GitHub committed 2026-07-30 14:38:07 +02:00
1 parent a73a9ffc6d
commit 14dd128a68
6 files changed
+338 -208

No files matched your search

@@ -203,7 +203,7 @@ describe("vcsActionState", () => {
});
});
it("clears running presentation state once the action finishes", () => {
it("keeps running presentation state until the finished action settles", () => {
const initial = beginVcsActionState({
operation: "run_change_request",
label: "Running source control action",
@@ -232,18 +232,18 @@ describe("vcsActionState", () => {
);
expect(finished).toMatchObject({
isRunning: false,
isRunning: true,
operation: "run_change_request",
actionId,
action,
currentLabel: null,
currentPhaseLabel: null,
currentLabel: "Pushing...",
currentPhaseLabel: "Pushing...",
lastOutputLine: null,
error: null,
});
});
it("retains a terminal action error for presentation", () => {
it("keeps running presentation state and retains a terminal action error until settle", () => {
const initial = beginVcsActionState({
operation: "run_change_request",
label: "Running source control action",
@@ -262,7 +262,7 @@ describe("vcsActionState", () => {
);
expect(failed).toMatchObject({
isRunning: false,
isRunning: true,
operation: "run_change_request",
actionId,
action,
@@ -583,11 +583,16 @@ describe("vcsActionState", () => {
const targetKey = { environmentId, cwd };
const successfulActionId = "invalidate-success";
const failedActionId = "invalidate-failure";
const interruptedActionId = "invalidate-interrupted";
const successfulTransportActionId = createVcsActionTransportId(
targetKey,
successfulActionId,
);
const failedTransportActionId = createVcsActionTransportId(targetKey, failedActionId);
const interruptedTransportActionId = createVcsActionTransportId(
targetKey,
interruptedActionId,
);
const client = {
[WS_METHODS.gitRunStackedAction]: (input: { readonly actionId: string }) =>
input.actionId === successfulTransportActionId
@@ -600,16 +605,18 @@ describe("vcsActionState", () => {
result,
}),
)
: Stream.make(
progress({
kind: "action_failed",
actionId: failedTransportActionId,
cwd,
action,
phase: "push",
message: "push failed after creating the branch",
}),
),
: input.actionId === interruptedTransportActionId
? Stream.fromEffect(Effect.interrupt)
: Stream.make(
progress({
kind: "action_failed",
actionId: failedTransportActionId,
cwd,
action,
phase: "push",
message: "push failed after creating the branch",
}),
),
} as unknown as WsRpcProtocolClient;
const supervisor = EnvironmentSupervisor.EnvironmentSupervisor.of({
target,
@@ -659,6 +666,7 @@ describe("vcsActionState", () => {
);
expect(AsyncResult.isSuccess(successfulResult)).toBe(true);
expect(registry.get(manager.stateAtom(targetKey))).toEqual(EMPTY_VCS_ACTION_STATE);
expect(registry.get(state).revision).toBe(1);
expect(removed).toEqual([`${environmentId}:*`]);
@@ -670,8 +678,29 @@ describe("vcsActionState", () => {
);
expect(AsyncResult.isFailure(failedResult)).toBe(true);
expect(registry.get(manager.stateAtom(targetKey))).toMatchObject({
isRunning: false,
operation: "run_change_request",
actionId: failedActionId,
error: "Source control action 'commit_push' failed during push.",
});
expect(registry.get(state).revision).toBe(2);
expect(removed).toEqual([`${environmentId}:*`, `${environmentId}:*`]);
const interruptedResult = yield* Effect.promise(() =>
manager.runStackedAction(targetKey).run(registry, {
actionId: interruptedActionId,
action,
}),
);
expect(AsyncResult.isFailure(interruptedResult)).toBe(true);
if (AsyncResult.isFailure(interruptedResult)) {
expect(Cause.hasInterruptsOnly(interruptedResult.cause)).toBe(true);
}
expect(registry.get(manager.stateAtom(targetKey))).toEqual(EMPTY_VCS_ACTION_STATE);
expect(registry.get(state).revision).toBe(3);
expect(removed).toEqual([`${environmentId}:*`, `${environmentId}:*`, `${environmentId}:*`]);
}),
),
);
+13 -2
View File
@@ -388,14 +388,17 @@ export function applyVcsActionProgressEvent(
};
case "action_finished":
return {
...EMPTY_VCS_ACTION_STATE,
...current,
isRunning: true,
actionId: event.actionId,
action: event.action,
operation: "run_change_request",
error: null,
};
case "action_failed":
return {
...EMPTY_VCS_ACTION_STATE,
...current,
isRunning: true,
actionId: event.actionId,
action: event.action,
operation: "run_change_request",
@@ -464,6 +467,12 @@ export function createVcsActionManager<R, E>(
...(input.featureBranch ? { featureBranch: true } : {}),
...(input.filePaths?.length ? { filePaths: [...input.filePaths] } : {}),
};
const clearOwnedState = Effect.sync(() => {
const current = registry.get(stateAtom);
if (current.actionId === input.actionId) {
registry.set(stateAtom, EMPTY_VCS_ACTION_STATE);
}
});
return consumeVcsActionProgress(
runStreamInEnvironment(
target.environmentId,
@@ -492,6 +501,7 @@ export function createVcsActionManager<R, E>(
},
).pipe(
Effect.ensuring(invalidateCachedVcsRefs(registry, target)),
Effect.tap(() => clearOwnedState),
Effect.tapError((error) =>
Effect.sync(() => {
const current = registry.get(stateAtom);
@@ -503,6 +513,7 @@ export function createVcsActionManager<R, E>(
}
}),
),
Effect.onInterrupt(() => clearOwnedState),
);
},
});