Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
| turns[0] = clamp( | ||
| turns[0]!, | ||
| Math.max( | ||
| 1, | ||
| RESUME_BRIEF_DEFAULT_MAX_TOKENS * 4 - | ||
| (text.length - turns[0]!.length) - | ||
| 40, | ||
| ), | ||
| ); |
There was a problem hiding this comment.
🟡 Oversized turn loses latest context
For an oversized final turn, clamp keeps its oldest prefix and drops the newest messages. The child receives stale context instead of the turn's latest state.
Learn more
A turn renders its user message first and assistant messages afterward. The budget fallback clamps that complete rendered string from the right, so overflow removes the most recent assistant messages first. This conflicts with the earlier turn-level policy, which deliberately retains recent context for continuation. The truncation marker reveals that some text vanished but does not preserve the state needed to continue.
Example: A single turn contains a short user task followed by 30 assistant updates. If the rendered turn exceeds 6,000 estimated tokens, the brief keeps the task and early updates while dropping update 30, which describes the current work.
Recommended fix: Bound oversized turns structurally. Preserve the turn header and user prompt, then retain assistant messages or parts newest-first within the remaining budget. Add an explicit count or marker for omitted messages and test that the final assistant message survives.
Was this helpful? React with 👍 or 👎 to provide feedback.
Primary change type
Problem and motivation
Recorded Continue needs a fixed public reconstruction and one child-owned accepted context across retries. Resolving guidance again after a lost acceptance acknowledgement could silently change the prepared child.
Summary and scope
Build a bounded brief with exact record provenance, omissions and incomplete-work warnings. Add acceptFrozen to the existing delivery coordinator: validate and detach the full candidate before authority IO, reuse the receipt-owned acceptance ID, and retain through the existing authoritative source store. Composition and recovery still require the original accepted material.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #1005. Native stack target: main. Receipt/native protocol and UI follow separately; this is a shared primitive, not a runtime activation change.
Validation
Tests and documentation
Covers brief bounds and provenance, immutable retries after process restart/lost acknowledgement, changed guidance, candidate mutation during authority IO, conflicting acceptance identity, and retained-source composition. Added assistant-continuation.md. Increment is 764 changed lines including tests/docs/changeset; pr:size is absent.
Compatibility and release impact
Security
AI assistance
Checklist