FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(ui): initialize state selectively to prevent background task conflicts by tusharmath · Pull Request #2773 · tailcallhq/forgecode · GitHub

fix(ui): initialize state selectively to prevent background task conflicts - #2773

Merged
tusharmath merged 3 commits into
mainfrom
join-handle-fix
Apr 1, 2026
Merged

fix(ui): initialize state selectively to prevent background task conflicts#2773
tusharmath merged 3 commits into
mainfrom
join-handle-fix

Conversation

tusharmath commented Apr 1, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Summary

Fix "JoinHandle polled after completion" panics caused by background tasks spawned during forge info racing with process exit.

Context

When running forge info, the handler was calling on_new() to initialize the model/agent state. However, on_new() also internally invokes hydrate_caches(), which spawns fire-and-forget background tasks. Because forge info exits quickly after printing output, these background tasks would still be running (or just completing) as the process terminated, triggering JoinHandle polled after completion panics in the async runtime.

The info command only needs agent/provider/model resolution — it has no use for the cache hydration side effects.

Changes

  • Replaced on_new() call with init_state(false) in the TopLevelCommand::Info handler
  • init_state(false) performs only the necessary state initialization without spawning background cache hydration tasks

Testing

# Run the info command and verify no panics occur
cargo run -- info

# Run with a specific conversation ID if applicable
cargo run -- info --conversation-id <id>

# Run the test suite for forge_main
cargo insta test --accept -p forge_main

Links

  • Related: background task lifecycle management in UI::on_new() / UI::hydrate_caches()

github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Apr 1, 2026
tusharmath changed the title join handle fix fix(ui): initialize state selectively to prevent background task conflicts Apr 1, 2026
tusharmath enabled auto-merge (squash) April 1, 2026 18:19
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

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL