Skip to content

fix: guard repeated before-turn attempts per session#324

Open
compoodment wants to merge 2 commits into
xDarkicex:mainfrom
compoodment:fix/before-turn-new-turn-guard
Open

fix: guard repeated before-turn attempts per session#324
compoodment wants to merge 2 commits into
xDarkicex:mainfrom
compoodment:fix/before-turn-new-turn-guard

Conversation

@compoodment

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the dead global BeforeTurnKernel turn guard with a bounded per-session attempt signature map.
  • Marks a BeforeTurnKernel attempt before the RPC starts, so repeated assemble calls after timeout/failure do not retry the same session turn immediately.
  • Builds the signature from the original normalized transcript shape and explicit message IDs only, avoiding synthetic UUID churn from normalized messages.
  • Adds regression coverage for same-session duplicate failed attempts and same-text turns in different sessions.

Fixes #312.

Verification

  • pnpm exec tsc --noEmit — PASS
  • pnpm run clean:test && pnpm exec tsc -p tsconfig.tests.json && node --test --test-name-pattern="beforeTurn attempt" .ts-build/test/unit/context-engine.test.js — PASS
  • pnpm check — FAILS after TypeScript/plugin inspector, in existing unrelated context-engine/memory-provider/slot-conflict unit tests; the new beforeTurn tests pass in that run.
  • npm run test:integration — FAILS in existing unrelated checklist/host-flow expectation tests.

Stack note: this branch includes #318 so test compilation is unblocked before this focused before-turn change.

– Vale

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@compoodment, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 1 hour. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 47a72d23-f287-4ed3-af20-0eaae2d80bbc

📥 Commits

Reviewing files that changed from the base of the PR and between 6d47279 and 8708846.

📒 Files selected for processing (3)
  • src/context-engine.ts
  • test/integration/markdown-ingest.test.ts
  • test/unit/context-engine.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@compoodment
compoodment marked this pull request as ready for review June 5, 2026 20:33
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.

bug: BeforeTurnKernel new-turn guard is dead and would be global if wired naïvely

1 participant