Skip to content

Fix Grok account-rotation continuation during an active turn - #12

Merged
kenryu42 merged 1 commit into
kenryu42:mainfrom
apoapostolov:fix/rotation-followup
Sep 20, 2026
Merged

kenryu42 merged 1 commit into
kenryu42:mainfrom
apoapostolov:fix/rotation-followup

Conversation

@apoapostolov

@apoapostolov apoapostolov commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Bare sendUserMessage during an active turn throws Pi core's Extension <runtime> already-processing error. Deliver the rotation continuation as a followUp so it queues while streaming and still starts a turn when idle.

  • src/provider/rotation.ts: send the continuation with { deliverAs: 'followUp' }
  • tests/provider/rotation.test.ts: assert the queueing option

Full suite: 295/295 (vitest, TZ=UTC).

Summary by CodeRabbit

  • Bug Fixes
    • Account rotation continuation messages now use follow-up delivery, ensuring they appear in the ongoing conversation flow.

Bare sendUserMessage during an active turn throws Pi core's
Extension "<runtime>" already-processing error. deliverAs followUp
queues when streaming and still starts a turn when idle.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a905d7c3-00ab-433f-996f-145798b210e3

📥 Commits

Reviewing files that changed from the base of the PR and between 4bc0d81 and ca6cd40.

📒 Files selected for processing (2)
  • src/provider/rotation.ts
  • tests/provider/rotation.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Account rotation continuation messages now use deliverAs: 'followUp'. Rotation tests verify this behavior for account-switching and fallback-candidate scenarios.

Changes

Rotation delivery

Layer / File(s) Summary
Set and validate follow-up delivery mode
src/provider/rotation.ts, tests/provider/rotation.test.ts
Rotation continuation messages specify deliverAs: 'followUp'. Tests verify the setting in both rotation scenarios.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: kenryu42

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing Grok account-rotation continuation during an active turn. It is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The implementation appears safe to merge, with a non-blocking test-coverage gap around the follow-up lifecycle.

Fix All in CodexFindings

  1. P2 Follow-up lifecycle remains untested ▶

Summary

This PR changes Grok account-rotation continuations to use Pi’s follow-up delivery mode so they can queue during an active turn.

  • Passes { deliverAs: 'followUp' } when sending the rotation continuation.
  • Updates unit assertions for the new option.
  • The tests do not exercise the active-turn and idle-turn delivery lifecycle that motivated the change.

Reviews (1) · Last reviewed commit: "Queue Grok account-rotation continuation..."

Comment on lines +139 to +141
expect(test.sendUserMessage).toHaveBeenCalledWith(ROTATION_CONTINUATION, {
deliverAs: 'followUp',
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Follow-up lifecycle remains untested

These assertions only check the arguments passed to a bare vi.fn(). They do not reproduce an active turn, the previous already-processing error, or follow-up delivery while streaming and idle. A regression in the queueing lifecycle could therefore pass these tests. The same concern applies to the assertion at lines 265–267; add a lifecycle-level test that models active-turn queueing and the subsequent continuation delivery.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code

@kenryu42
kenryu42 merged commit 4986aed into kenryu42:main Sep 20, 2026
4 checks passed
@kenryu42

Copy link
Copy Markdown
Owner

Hey, thanks for the pr!

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