Repository navigation
fix: remove blocking sleep from preexec hook causing command lag - #1444
Conversation
When socket connection mode is not 'off', the shell integration runs _cmux_stop_pr_poll_loop in the preexec hook before every command. This function had a blocking 'sleep 0.1' call that caused noticeable lag on every command execution. The fix replaces the TERM+sleep+KILL pattern with direct SIGKILL. The PR poll loop is a lightweight background process that only runs 'gh pr view' periodically - it's safe to kill abruptly without waiting for graceful termination. Fixes manaflow-ai#1436
|
@BillionClaw is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip You can customize the high-level summary generated by CodeRabbit.Configure the |
…aflow-ai#1444) When socket connection mode is not 'off', the shell integration runs _cmux_stop_pr_poll_loop in the preexec hook before every command. This function had a blocking 'sleep 0.1' call that caused noticeable lag on every command execution. The fix replaces the TERM+sleep+KILL pattern with direct SIGKILL. The PR poll loop is a lightweight background process that only runs 'gh pr view' periodically - it's safe to kill abruptly without waiting for graceful termination. Fixes manaflow-ai#1436 Co-authored-by: BillionClaw <267901332+BillionClaw@users.noreply.github.com>
Problem
When socket connection mode is set to anything other than "off", running any command introduces noticeable lag (~100ms+ per command). Commands like
lsandclearfeel sluggish compared to when socket mode is "off" or other terminals.Fixes #1436
Root Cause
The
_cmux_stop_pr_poll_loopfunction in both zsh and bash shell integration scripts had a blockingsleep 0.1call. This function is invoked in thepreexechook (before every command) when socket mode is not "off", causing at least 100ms of blocking delay on every single command execution.When socket mode is "off", the PR poll loop is never started (due to socket path checks), so
_CMUX_PR_POLL_PIDis never set, and the blocking sleep is never executed.Change Summary
_cmux_stop_pr_poll_loopincmux-zsh-integration.zsh_cmux_stop_pr_poll_loopincmux-bash-integration.bashTERM → sleep 0.1 → conditional KILLpattern with directSIGKILLThe PR poll loop is a lightweight background process that just runs
gh pr viewperiodically. It is safe to kill abruptly with SIGKILL without waiting for graceful termination.Verification
All checks passed.
Risk
None. The PR poll loop is a stateless periodic
gh pr viewquery. Killing it abruptly does not corrupt any state or lose any data. The next command will simply start a fresh poll loop if needed.Summary by cubic
Removes ~100ms command lag in socket mode by eliminating a blocking sleep in the preexec hook. Replaces the TERM→sleep→KILL sequence with a direct SIGKILL to stop the PR poll loop in both zsh and bash integrations, fixing #1436.
Written for commit eb7c7d0. Summary will update on new commits.
Summary by CodeRabbit