Skip to content

refactor(soul): rename attachment to dynamic_injection and add provider error isolation#1399

Merged
RealKai42 merged 1 commit intomainfrom
kaiyi/review-attachment-rename
Mar 11, 2026
Merged

refactor(soul): rename attachment to dynamic_injection and add provider error isolation#1399
RealKai42 merged 1 commit intomainfrom
kaiyi/review-attachment-rename

Conversation

@RealKai42
Copy link
Copy Markdown
Collaborator

@RealKai42 RealKai42 commented Mar 11, 2026

Summary

  • Rename Attachment/AttachmentProvider to DynamicInjection/DynamicInjectionProvider to better reflect the system's purpose as a dynamic prompt injection mechanism
  • Rename soul/attachment.pysoul/dynamic_injection.py, soul/attachments/soul/dynamic_injections/
  • Add try/except in _collect_injections() so a failing provider doesn't block the entire LLM step

Test plan

  • All 75 related tests pass (test_normalize_history, test_plan_mode_injection_provider, test_plan_mode_reminder, test_plan_mode)
  • grep -r confirms zero remaining references to old naming

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.

Copilot AI review requested due to automatic review settings March 11, 2026 06:35
@RealKai42 RealKai42 changed the title feat: implement dynamic injection system for plan mode reminders refactor(soul): rename attachment to dynamic_injection and add provider error isolation Mar 11, 2026
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 1 additional finding.

Open in Devin Review

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

Implements a “dynamic injection” mechanism (replacing the prior attachment-based approach) to inject plan mode reminders into the prompt/history before each LLM step, with updated provider logic and tests to match.

Changes:

  • Replace attachment concepts with DynamicInjection / DynamicInjectionProvider and migrate plan mode reminder provider accordingly.
  • Update KimiSoul to collect and inject dynamic injections each step, then normalize history for API input.
  • Update/rename tests and imports to cover the new dynamic injection flow and reminder detection.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/kimi_cli/soul/kimisoul.py Switches from attachment collection/injection to dynamic injection collection/injection within the step pipeline.
src/kimi_cli/soul/dynamic_injection.py Introduces the core DynamicInjection abstraction + provider interface and history normalization behavior.
src/kimi_cli/soul/dynamic_injections/plan_mode.py Migrates plan mode reminder logic to a DynamicInjectionProvider implementation.
src/kimi_cli/soul/dynamic_injections/__init__.py Package init for dynamic injection providers.
tests/core/test_plan_mode_reminder.py Updates reminder detection tests to import from dynamic injection plan mode module.
tests/core/test_plan_mode_injection_provider.py Updates provider flow tests to use PlanModeInjectionProvider.get_injections().
tests/core/test_plan_mode.py Renames and updates manual plan mode toggle tests to validate pending injection behavior.
tests/core/test_normalize_history.py Updates normalization tests to import from dynamic_injection.

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

Comment on lines 264 to 270
async def toggle_plan_mode(self) -> bool:
"""Toggle plan mode on/off. Returns the new state.

Tools are not hidden/unhidden — instead, each tool checks plan mode
state at call time and rejects if blocked.
Periodic reminders are handled by the attachment system.
Periodic reminders are handled by the dynamic injection system.
"""
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The PR description still contains placeholder text (Resolve #(issue_number)) and does not link an actual related issue. Please update the PR metadata to reference the real issue/decision thread (or remove the placeholder if none applies) so reviewers have the correct context for this behavior change in the core LLM step pipeline.

Copilot uses AI. Check for mistakes.
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