Repository navigation
refactor(agent-core-v2): remove idle reminder reconciliation - #5235
Conversation
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.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f1e472c8e
ℹ️ 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".
| readonly _serviceBrand: undefined; | ||
| register<D = unknown>(variant: string, provider: ContextInjectionProvider<D>): ReminderRegistration; | ||
| notify(content: string, notification: ReminderNotification): void; |
There was a problem hiding this comment.
Add the required library changeset
This commit changes source code in both @moonshot-ai/agent-core-v2 and @moonshot-ai/kimi-code-sdk, but it adds no .changeset entry. Without the required technical changeset, the release workflow will neither record nor version these library changes; add a patch changeset covering both affected packages.
AGENTS.md reference: AGENTS.md:L169-L170
Useful? React with 👍 / 👎.
| if (this.scopeContext.agentId !== MAIN_AGENT_ID) return; | ||
| this.refreshPending = true; | ||
| await this.skillCatalog.ready; |
There was a problem hiding this comment.
Persist the deferred plugin refresh
When a plugin-enabled session is reloaded and then closed or the server restarts before another agent step begins, this now records the refresh only in the non-replayable pluginSessionStartRefreshPendingKey. On resume that flag resets to false while the durable pluginSessionStartSnapshotKey still contains the old guidance, so resolveDesiredSessionStart keeps returning the stale snapshot on future prompts; the removed idle reconciliation previously rendered and persisted the refreshed snapshot before returning. Persist the pending refresh or materialize it before reload completes.
AGENTS.md reference: AGENTS.md:L111-L113
Useful? React with 👍 / 👎.
7Sageer
left a comment
There was a problem hiding this comment.
插件 refresh 与快照恢复的边界还需要核对;release-note 的处理如已有团队约定,可按原任务保留。
| @@ -115,7 +115,6 @@ export class AgentPluginService extends Service implements IAgentPluginService { | |||
| if (this.scopeContext.agentId !== MAIN_AGENT_ID) return; | |||
| this.refreshPending = true; | |||
| await this.skillCatalog.ready; | |||
There was a problem hiding this comment.
[P1] refreshPending 与 pluginSessionStartSnapshotKey 的 replay 属性不同。/reload 后若在下一 step 前退出或重启,pending 标志会丢失,而持久化快照仍是旧内容,后续 provider 会继续使用旧 session-start 提示。原先 idle reconcile 会在 reload 返回前物化新快照。请让刷新请求跨重入保留,或让下一 step 能检测插件版本并刷新,同时补「刷新后立即关闭再恢复」的测试。
7f1e472 to
f3e6531
Compare
…reconciling when idle Remove reconcileWhenIdle from the reminder service and the plugin session-start call; the SDK's swarm/tower (and the fork's hello-world) calls are gone and the tests drive a step hook instead (MoonshotAI#5235). Also carry argsRaw in the registered-user-tools snapshot missed by the MoonshotAI#5268 update. Ledger: 5320/5304 not-applicable (root e2e harness), 5078 equivalent (testkit already ported).
Part 2/7 of the loop stack onto
main. Identical diff to #5207, previously reviewed and merged into the loop integration branch. Stacked on #5234; the shown diff contains only this PR's own changes.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.reconcileWhenIdleacquired loop quiescence, evaluated a selected provider, and calledflushReminders()immediately. That created a second delivery path outside the ordinaryonWillBeginStep/loop.remindconsumption points. This PR removes the alternate path rather than adding another workaround.Code Changes
AgentReminderService,register, andnotify; normal provider evaluation and message construction are unchanged.reconcileWhenIdlefrom the service interface and implementation.context-injectorhook. 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
register/notifydeliveryloop.remindand are consumed at subsequent step/turn injection points/reloadcan inject refreshed session-start guidance immediately while idlepromptOnlyturn; no turn is startedflushReminders()and existing loop-owned consumption remain availableVerification
tsc --noEmitforagent-core-v2: passedtsc --noEmitfornode-sdk: passedpnpm lint: passedChecklist