-
Notifications
You must be signed in to change notification settings - Fork 59
fix: treat force-released agent as step failure, not success #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3448,6 +3448,12 @@ export class WorkflowRunner { | |
| throw new Error(`Step "${step.name}" timed out after ${timeoutMs ?? 'unknown'}ms`); | ||
| } | ||
| } | ||
|
|
||
| if (exitResult === 'force-released') { | ||
| throw new Error( | ||
| `Step "${step.name}" failed — agent was force-released after exhausting idle nudges without completing` | ||
| ); | ||
| } | ||
|
Comment on lines
+3452
to
+3456
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Throwing on The new throw at lines 3452-3456 causes steps to fail when agents are force-released after exhausting idle nudges. However, three existing tests ( Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in b9c9403 — the released vs force-released distinction means existing tests that expect step completion after idle release still pass (exitResult === 'released' is SUCCESS). Only nudge-exhausted force-releases throw. Real e2e confirmed: nudge → force-release → step:failed, while normal idle release → step:completed. |
||
| } finally { | ||
| // Snapshot PTY chunks before cleanup — we need them for output reading below | ||
| ptyChunks = this.ptyOutputBuffers.get(agentName) ?? []; | ||
|
|
@@ -3477,7 +3483,7 @@ export class WorkflowRunner { | |
| : exitResult === 'timeout' | ||
| ? 'Agent completed (released after idle timeout)' | ||
| : exitResult === 'released' | ||
| ? 'Agent completed (force-released after idle nudging)' | ||
| ? 'Agent completed (idle — treated as done)' | ||
| : `Agent exited (${exitResult})`; | ||
| } | ||
|
|
||
|
|
@@ -3517,7 +3523,7 @@ export class WorkflowRunner { | |
| agentDef: AgentDefinition, | ||
| step: WorkflowStep, | ||
| timeoutMs?: number | ||
| ): Promise<'exited' | 'timeout' | 'released'> { | ||
| ): Promise<'exited' | 'timeout' | 'released' | 'force-released'> { | ||
| const nudgeConfig = this.currentConfig?.swarm.idleNudge; | ||
| if (!nudgeConfig) { | ||
| // Idle = done: race exit against idle. Whichever fires first completes the step. | ||
|
|
@@ -3568,7 +3574,7 @@ export class WorkflowRunner { | |
| } | ||
|
|
||
| // Agent is still running after the window expired. | ||
| if (remaining !== undefined && Date.now() - startTime >= remaining) { | ||
| if (timeoutMs !== undefined && Date.now() - startTime >= timeoutMs) { | ||
| return 'timeout'; | ||
| } | ||
|
|
||
|
|
@@ -3587,7 +3593,7 @@ export class WorkflowRunner { | |
| ); | ||
| this.emit({ type: 'step:force-released', runId: this.currentRunId ?? '', stepName: step.name }); | ||
| await agent.release(); | ||
| return 'released'; | ||
| return 'force-released'; | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.