Skip to content

refactor(agent-core-v2): remove idle reminder reconciliation - #5207

Merged
sailist merged 1 commit into
loop-refactfrom
refact-411-11-21-remove-reminder-service
Nov 21, 2026
Merged

sailist merged 1 commit into
loop-refactfrom
refact-411-11-21-remove-reminder-service

Conversation

@sailist

@sailist sailist commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Reminder providers already deliver through loop.remind, but plugin reloads and SDK swarm/tower transitions can bypass that timing by reconciling while idle and forcing an immediate flush. Internal task 411 narrows the change to removing that idle path while preserving the central ReminderService and its normal injection lifecycle.

Bug Reproduction Steps

N/A — this is a reminder-lifecycle refactor with intentional timing changes, not a bug reproduction PR.

Root Cause

IAgentReminderService.reconcileWhenIdle acquired loop quiescence, evaluated a selected provider, and called flushReminders() immediately. That created a second delivery path outside the ordinary onWillBeginStep / loop.remind consumption points. This PR removes the alternate path rather than adding another workaround.

Code Changes

  • Keep AgentReminderService, register, and notify; normal provider evaluation and message construction are unchanged.
  • Remove reconcileWhenIdle from the service interface and implementation.
  • Remove its three callers: plugin session-start refresh, SDK swarm transitions, and SDK tower transitions. These reminders now wait for the existing loop injection points.
  • Drive tests through the existing context-injector hook. Cover deferred registration, delayed plugin refresh, WaitFor independence from unrelated tool descriptions, and the real dynamic-tool removal announcement.

No changeset is included, as explicitly requested by the author.

Behavior Changes and Affected Users

Behavior Before After Affected users and compatibility Coverage
Normal register / notify delivery Providers and notifications use loop.remind and are consumed at subsequent step/turn injection points Unchanged All reminder domains; no compatibility impact Reminder service, todo, permission-mode tests
Plugin session-start refresh /reload can inject refreshed session-start guidance immediately while idle Refresh is visible at the next normal step or non-promptOnly turn; no turn is started Plugin reload callers. No legacy immediate-flush escape hatch; the timing change is intentional and needs maintainer approval Plugin service tests assert one message before the next hook and the refreshed second message afterward
SDK swarm/tower transitions Mode transitions can reconcile and flush their reminders before the RPC returns Mode changes take effect immediately, but their reminders arrive at the next normal injection point SDK consumers and products using swarm/tower. No legacy immediate-flush escape hatch; the timing change is intentional and needs maintainer approval SDK swarm/tower tests and reminder-domain tests
Other loop reminder processing flushReminders() and existing loop-owned consumption remain available Unchanged; only the service-level idle reconciliation shortcut is removed Loop and KAP reload paths retain their existing flush behavior Full Linux remote suite; unrelated failures listed below

Verification

  • tsc --noEmit for agent-core-v2: passed
  • tsc --noEmit for node-sdk: passed
  • Full pnpm lint: passed
  • Plugin tests: 11/11 passed
  • Desktop browser registration tests: 7/7 passed
  • Focused reminder, todo, permission-mode, and WaitFor/fork-parity tests: passed
  • Full Linux remote suite: 27,980 tests passed, 7 failed. Twelve additional Desktop suites could not start because Electron was not installed. The seven failures are unrelated existing TUI startup timeouts (4), the local-pages Electron fuse check (1), and remote process-group checks (2). No plugin, fork-parity, or desktop browser-registration failures remained.

Checklist

  • I have read the CONTRIBUTING document.
  • Related context is linked: internal task 411; this is not an external PR.
  • I have added tests that prove the reminder lifecycle works.
  • The behavior-change table above is complete; maintainer approval is still needed for intentionally removing the legacy immediate-flush behavior without an escape hatch.
  • A changeset was intentionally omitted at the author's request, despite the repository's release-artifact changeset convention.
  • No user-documentation update is needed: this changes internal reminder timing without adding or changing a documented workflow.

Keep register and notify on the normal loop.remind path.
Defer plugin, swarm, and tower reminders to the next step or turn.
Update tests to drive the existing context-injector hook.
@changeset-bot

changeset-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bc60264

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T10:04:53.523770Z bc60264 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 21, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@bc60264
npx https://pkg.pr.new/@moonshot-ai/kimi-code@bc60264

commit: bc60264

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc60264a75

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +2544 to +2545
* enter is idempotent and schedules the byte-identical enter reminder for
* non-`tool` triggers on the next step, exit pops that reminder when it is the last message

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve an escape hatch for immediate mode reminders

When an SDK or TUI caller toggles swarm or tower mode while the loop is idle, this change returns before the mode reminder is added to history; exporting or closing the session before another model step therefore loses guidance that was previously delivered immediately. This intentionally removes observable behavior without a compatibility switch, a guard for callers retaining the old behavior, or any changeset in the commit. Add an escape hatch, or obtain explicit maintainer approval and document the lost behavior in the required changeset.

AGENTS.md reference: AGENTS.md:L195-L197

Useful? React with 👍 / 👎.

@sailist
sailist merged commit f36ae94 into loop-refact Nov 21, 2026
24 checks passed
@sailist
sailist deleted the refact-411-11-21-remove-reminder-service branch November 21, 2026 10:12
sailist added a commit that referenced this pull request Nov 23, 2026
Keep register and notify on the normal loop.remind path.
Defer plugin, swarm, and tower reminders to the next step or turn.
Update tests to drive the existing context-injector hook.
sailist added a commit that referenced this pull request Nov 23, 2026
…5235)

Keep register and notify on the normal loop.remind path.
Defer plugin, swarm, and tower reminders to the next step or turn.
Update tests to drive the existing context-injector hook.
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.

1 participant