Skip to content

fix: Store session handle before manifest write in handle_resume#106

Open
2witstudios wants to merge 1 commit intomainfrom
pu/fix-4
Open

fix: Store session handle before manifest write in handle_resume#106
2witstudios wants to merge 1 commit intomainfrom
pu/fix-4

Conversation

@2witstudios
Copy link
Owner

Summary

  • Race condition in handle_resume: The session handle was stored in the session map AFTER writing the manifest, but handle_spawn explicitly stores it BEFORE (with a comment explaining why). The Swift app's ManifestWatcher fires on manifest write and immediately tries to attach — if the session handle isn't in the map yet, the attach fails silently.
  • Rollback path fix: On manifest update failure, the old code tried to kill a handle variable that had already been moved. The new code properly removes the session from the map and kills it, matching handle_spawn's rollback pattern.

Test plan

  • cargo check passes
  • All unit and integration tests pass (cargo test)
  • Manual: suspend an agent, resume it, verify the Swift app attaches immediately without a retry delay

🤖 Generated with Claude Code

handle_spawn correctly stores the session handle BEFORE writing the
manifest because ManifestWatcher in Swift fires on manifest write and
immediately tries to attach. handle_resume had this ordering reversed,
creating a race where the Swift app would try to attach before the
session existed in the map. Also fixes the rollback path to remove
the session from the map on manifest update failure, matching the
pattern in handle_spawn.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2026

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aadc89e6-8179-43d0-af66-611d3bae1d01

📥 Commits

Reviewing files that changed from the base of the PR and between 55aa882 and 2b4deeb.

📒 Files selected for processing (1)
  • crates/pu-engine/src/engine.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pu/fix-4

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant