Skip to content

fix(soul): re-inject yolo reminder after context compaction#2003

Open
ahyangyi wants to merge 1 commit intoMoonshotAI:mainfrom
ahyangyi:head-reinject-yolo
Open

fix(soul): re-inject yolo reminder after context compaction#2003
ahyangyi wants to merge 1 commit intoMoonshotAI:mainfrom
ahyangyi:head-reinject-yolo

Conversation

@ahyangyi
Copy link
Copy Markdown
Contributor

@ahyangyi ahyangyi commented Apr 22, 2026

Related Issue

N/A

Description

The YoloModeInjectionProvider uses a one-shot _injected flag to only emit the non-interactive-mode reminder on the first LLM step after yolo activates. After context compaction, the original reminder message is typically folded into the compaction summary (or dropped entirely), leaving the model without the explicit 'don't call AskUserQuestion, plan-mode toggles are auto-approved' guidance — even though yolo is still active on the approval runtime.

Add an on_context_compacted() hook to DynamicInjectionProvider (default no-op) and override it in YoloModeInjectionProvider to clear the one-shot flag. KimiSoul.compact_context now notifies every provider after the compacted history is assembled, so the yolo reminder is re-injected on the next step while yolo remains on.

PlanModeInjectionProvider is unaffected: it already self-heals by scanning history for prior reminders.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open in Devin Review

Copilot AI review requested due to automatic review settings April 22, 2026 12:03
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RealKai42
Copy link
Copy Markdown
Collaborator

@codex

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ahyangyi
Copy link
Copy Markdown
Contributor Author

One of the tests is flaky and failed before rebasing. It seems to be unrelated to this PR, and I opened a separate PR to fix that test: #2008 .

The YoloModeInjectionProvider uses a one-shot `_injected` flag to only
emit the non-interactive-mode reminder on the first LLM step after yolo
activates. After context compaction, the original reminder message is
typically folded into the compaction summary (or dropped entirely),
leaving the model without the explicit 'don't call AskUserQuestion,
plan-mode toggles are auto-approved' guidance — even though yolo is
still active on the approval runtime.

Add an `on_context_compacted()` hook to DynamicInjectionProvider
(default no-op) and override it in YoloModeInjectionProvider to clear
the one-shot flag. KimiSoul.compact_context now notifies every provider
after the compacted history is assembled, so the yolo reminder is
re-injected on the next step while yolo remains on.

PlanModeInjectionProvider is unaffected: it already self-heals by
scanning history for prior reminders.
@ahyangyi ahyangyi force-pushed the head-reinject-yolo branch from 9aae53f to 2594434 Compare April 24, 2026 06:51
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.

3 participants