fix(worker): await runAgent to prevent premature worker exit#517
Merged
zbigniewsobiecki merged 1 commit intodevfrom Feb 24, 2026
Merged
fix(worker): await runAgent to prevent premature worker exit#517zbigniewsobiecki merged 1 commit intodevfrom
zbigniewsobiecki merged 1 commit intodevfrom
Conversation
…ker exit triggerManualRun() used fire-and-forget (.then/.catch/.finally) for runAgent(), which worked for the long-lived API server but caused worker containers to exit before the agent completed. Replace with try/catch/finally using await so callers that await triggerManualRun() (e.g. worker-entry.ts) block until the agent finishes. The API router caller already doesn't await the outer promise, so its behavior is unchanged. Also includes: - CLI: add --org flag to login, show effective org in whoami - README: update webhook callback URLs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
🤔 Just a sec, looking into that worker exit fix now |
Collaborator
|
Thanks for taking a look! 👍 The main fix is in Tests updated to remove the timing hacks ( CI checks are still running, but local verification is complete (typecheck, lint, full test suite all passing). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
triggerManualRun()used fire-and-forget (.then/.catch/.finally) forrunAgent(), which caused worker containers toprocess.exit(0)before agents completed. Replaced withtry/catch/finallyusingawaitso worker callers block until the agent finishes. API server behavior unchanged (outer call is already not awaited).--orgflag tocascade loginfor persisting org context, and display effective org incascade whoamiwhen admin context-switches.Test plan
npm run typecheck— passesnpm run lint— passes (biome, 600 files clean)tests/unit/triggers/manual-runner.test.ts— 9/9 tests pass, updated to remove fire-and-forget timing hacks (setImmediate/setTimeoutpolling)🤖 Generated with Claude Code