Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b88fdac
feat(workflows): add cooperative pause and resume
qwen-code-dev-bot Aug 1, 2026
b84c144
fix(workflows): restrict pause to background runs
qqqys Aug 1, 2026
2337d58
fix(cli): clarify foreground workflow pause errors
qwen-code-dev-bot Aug 1, 2026
beba054
fix(core): preserve dispatch errors across cancellation
qwen-code-dev-bot Aug 1, 2026
552cb77
test(core): cover late workflow state callbacks
qwen-code-dev-bot Aug 1, 2026
e0ec123
fix(workflows): address review suggestions (#8320)
qwen-code-dev-bot Aug 2, 2026
ad9adcd
test(workflows): pin review-flagged mutation-surviving branches (#8320)
Aug 2, 2026
9b9d2f5
test(cli): use valid agent status in detail-view reset test (#8320)
Aug 2, 2026
e2d9f09
test(workflows): harden pause-gate settle probes with a full flush (#…
Aug 2, 2026
7b35105
fix(workflows): address round-5 review findings (#8320)
Aug 3, 2026
75c6653
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
wenshao Aug 3, 2026
bb9be5c
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 3, 2026
4b27640
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 3, 2026
3fc2555
test(ci): sync review timeout assertions with repository variables (#…
qwen-code-dev-bot Aug 3, 2026
56822a1
Merge remote-tracking branch 'origin/main' into codex/issue-8105-work…
qwen-code-dev-bot Aug 3, 2026
b2c97d5
Merge remote-tracking branch 'origin/main' into codex/issue-8105-work…
qwen-code-dev-bot Aug 4, 2026
25fb589
fix(workflows): address round-6 review findings (#8320)
qwen-code-dev-bot Aug 4, 2026
f3ea784
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 4, 2026
eb6e6a4
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
wenshao Aug 4, 2026
eafa7fb
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 4, 2026
4f89c15
fix(workflows): address round-7 review findings (#8320)
qwen-code-dev-bot Aug 4, 2026
e005d60
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 4, 2026
da95171
fix(workflows): address round-8 review findings (#8320)
qwen-code-dev-bot Aug 5, 2026
57e9044
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
wenshao Aug 5, 2026
c594078
fix(workflows): address round-9 review findings (#8320)
qwen-code-dev-bot Aug 6, 2026
3f5f27d
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
wenshao Aug 6, 2026
e27867d
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 6, 2026
9685fb0
fix(workflows): address round-10 review findings (#8320)
qwen-code-dev-bot Aug 6, 2026
fd8a6ed
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
wenshao Aug 6, 2026
81d7702
fix(workflows): address round-11 review findings (#8320)
qwen-code-dev-bot Aug 7, 2026
5c117fa
Merge branch 'main' into codex/issue-8105-workflow-pause-resume
qwen-code-dev-bot Aug 7, 2026
89b7803
fix(workflows): address round-12 review findings (#8320)
qwen-code-dev-bot Aug 7, 2026
750133f
fix(workflows): address round-13 review findings (#8320)
qwen-code-dev-bot Aug 7, 2026
444b52b
fix(workflows): address round-14 review findings (#8320)
qwen-code-dev-bot Aug 7, 2026
e41fb76
fix(workflows): address round-15 review findings (#8320)
qwen-code-dev-bot Aug 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(workflows): restrict pause to background runs
  • Loading branch information
qqqys committed Aug 1, 2026
commit b84c14492edac304d0a5dfd55486d4c2cdc1eba0
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,19 @@ describe('BackgroundTasksDialog', () => {
expect(h.workflowResume).not.toHaveBeenCalled();
});

it('does not offer or trigger pause for a foreground workflow', () => {
const h = setup([
workflowEntry({ status: 'running', isBackgrounded: false }),
]);

h.call(() => h.probe.current!.actions.openDialog());
expect(h.lastFrame()).not.toContain('p pause');
h.pressKey({ sequence: 'p' });

expect(h.workflowPause).not.toHaveBeenCalled();
expect(h.workflowResume).not.toHaveBeenCalled();
});

it.each([
['running', 'pause'],
['paused', 'resume'],
Expand Down Expand Up @@ -1006,6 +1019,7 @@ describe('BackgroundTasksDialog', () => {
perPhaseTokens: new Map<string | null, number>(),
pendingApprovals: [] as WorkflowApproval[],
script: '',
isBackgrounded: true,
};
return { ...base, ...overrides } as unknown as DialogEntry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function isStoppableEntry(entry: DialogEntry): boolean {
}

function workflowPauseHint(entry: DialogEntry | null): string | undefined {
if (entry?.kind !== 'workflow') return undefined;
if (entry?.kind !== 'workflow' || !entry.isBackgrounded) return undefined;
switch (entry.status) {
case 'running':
return 'p pause (cooperative)';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/ui/contexts/BackgroundTaskViewContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export function BackgroundTaskViewProvider({
const toggleSelectedWorkflowPause = useCallback(() => {
if (!config) return;
const target = entries[selectedIndex];
if (!target || target.kind !== 'workflow') return;
if (!target || target.kind !== 'workflow' || !target.isBackgrounded) return;
const registry = config.getWorkflowRunRegistry();
if (target.status === 'running') {
registry.pause(target.runId);
Expand Down
17 changes: 16 additions & 1 deletion packages/core/src/agents/workflow-run-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ describe('WorkflowRunRegistry', () => {

it('does not resume a workflow until pausing has reached paused', () => {
const r = new WorkflowRunRegistry();
const entry = r.register(reg('wf_resume_gate'));
const entry = r.register(reg('wf_resume_gate', { isBackgrounded: true }));
const handle = {
runId: entry.runId,
abort: vi.fn(),
Expand All @@ -790,6 +790,21 @@ describe('WorkflowRunRegistry', () => {
expect(handle.resume).toHaveBeenCalledOnce();
});

it('does not pause a foreground workflow', () => {
const r = new WorkflowRunRegistry();
const entry = r.register(reg('wf_foreground'));
const handle = {
runId: entry.runId,
abort: vi.fn(),
pause: vi.fn(() => true),
resume: vi.fn(() => true),
} as unknown as WorkflowRunHandle;
r.attachHandle(handle);

expect(r.pause(entry.runId)).toBe(false);
expect(handle.pause).not.toHaveBeenCalled();
});

it('setRecentLogs caps at 100 entries (keeps the tail)', () => {
const r = new WorkflowRunRegistry();
r.register(reg('wf_1'));
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/agents/workflow-run-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ export class WorkflowRunRegistry {
pause(runId: string): boolean {
const entry = this.entries.get(runId);
const handle = this.handles.get(runId);
if (!entry || entry.status !== 'running' || !handle) return false;
if (!entry?.isBackgrounded || entry.status !== 'running' || !handle) {
return false;
}
return handle.pause();
}

Expand Down
Loading