Skip to content

fix(atlas): block continuation while delegated tasks are pending#3771

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
tw-yshuang:fix/atlas-pending-continuation-race
May 4, 2026
Merged

fix(atlas): block continuation while delegated tasks are pending#3771
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
tw-yshuang:fix/atlas-pending-continuation-race

Conversation

@tw-yshuang
Copy link
Copy Markdown
Contributor

@tw-yshuang tw-yshuang commented May 3, 2026

Summary

  • treat pending background tasks as active when Atlas decides whether to inject a continuation
  • prevent Atlas from resuming a plan while a delegated subagent is still in the session-creation window
  • add regression coverage for the pending-task continuation race

Root cause

Atlas continuation only checked for running background tasks. When a delegated subagent had already been launched but had not yet acquired its session ID, the task remained in pending. That left a race window where Atlas could inject another continuation before the delegated work had actually started, which made the orchestration appear stuck or out of order.

What changed

  • updated src/hooks/atlas/boulder-continuation-injector.ts to treat both pending and running tasks as active background work
  • added a regression test covering the pending-session-creation case in src/hooks/atlas/boulder-continuation-injector.test.ts

Tests

  • bun test src/hooks/atlas/boulder-continuation-injector.test.ts src/hooks/atlas/index.test.ts
  • bun run typecheck

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Summary by cubic

Block Atlas continuation while delegated background tasks are still pending session creation, closing a race that could resume plans too early. This keeps orchestration in order and prevents stuck-looking runs.

  • Bug Fixes
    • Treat both pending and running background tasks as active in injectBoulderContinuation (via ACTIVE_BACKGROUND_TASK_STATUSES).
    • Add a regression test to ensure continuation is skipped when a delegated task is still pending.

Written for commit 56e4044. Summary will update on new commits.

Atlas continuation only treated running background tasks as active work. When a delegated subagent had been launched but was still waiting for session creation, the task remained pending and Atlas could inject another continuation too early.

Treat pending tasks as active background work in the continuation injector and add regression coverage for the pending-session-creation race so delegated work is allowed to acquire a session before Atlas resumes the plan.

Tests: bun test src/hooks/atlas/boulder-continuation-injector.test.ts src/hooks/atlas/index.test.ts; bun run typecheck

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Correctly prevents race conditions by treating 'pending' tasks as active. Simple logic change with regression tests.

@tw-yshuang
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 3, 2026
@code-yeongyu code-yeongyu merged commit ef7ac52 into code-yeongyu:dev May 4, 2026
3 of 4 checks passed
@tw-yshuang tw-yshuang deleted the fix/atlas-pending-continuation-race branch May 6, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants