Skip to content

fix(agent-core): queue cron prompts while goals are paused - #2440

Open
ousamabenyounes wants to merge 2 commits into
MoonshotAI:mainfrom
ousamabenyounes:fix/issue-2390
Open

fix(agent-core): queue cron prompts while goals are paused#2440
ousamabenyounes wants to merge 2 commits into
MoonshotAI:mainfrom
ousamabenyounes:fix/issue-2390

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 31, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2390

Problem

Cron prompts that become due while a goal is paused currently start a full model turn. In a long-running session this repeatedly rereads the complete context even though autonomous goal work is explicitly stopped.

What changed

The cron scheduler now treats a paused goal as temporarily ineligible for delivery. It neither steers the agent nor advances the task cursor, so the prompt remains queued and becomes eligible on the next tick after /goal resume.

The regression test covers both halves of that contract: no steer, telemetry, or cursor advance while paused, followed by one delivery after the goal becomes active. The scheduled-task reference is updated in English and Chinese, and the CLI receives a patch changeset.

Test verification (RED → GREEN)

  • RED on upstream main: keeps a due cron queued while the goal is paused failed because one steer occurred instead of zero.
  • Revert proof: removing only the scheduler guard reproduced the same RED (1 failed, 20 passed).
  • GREEN: the focused file passes 21/21; the complete cron area passes 46/46.
  • Changed production lines: 2/2 covered (100% diff coverage).
  • Package typecheck and build, changed-file type-aware lint, Sherif, changeset validation, and the VitePress docs build pass.
  • Full local suite: 16,846 passed, 12 files skipped by repository configuration, 3 expected failures, 83 skipped tests, and 2 todos. Typecheck, type-aware lint (0 errors), Sherif, changeset status, documentation build, and git diff --check also pass.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • I have checked that this PR does not introduce internal identifiers.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Follow-up review fix

Addressed the print-mode hang reported in review: kimi -p no longer keeps a ref’ed interval alive for future cron tasks while the goal is paused, matching the scheduler’s paused-delivery semantics.

  • RED: the new regression test failed with expected false to be true when only this CLI guard was absent.
  • GREEN: the focused test passes; the complete run-prompt file passes 48/48; the repository suite passes 16,846 tests.
  • Independent review: PASS. OpenCodeReview-through-Codex: PASS. Main reread and explicit revert proof: PASS.

@changeset-bot

changeset-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 54d0bda

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

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

@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: afe730b64b

ℹ️ 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 thread packages/agent-core/src/agent/cron/manager.ts
@ousamabenyounes

Copy link
Copy Markdown
Author

Addressed the paused-goal print-mode hang in 54d0bdaee: future cron tasks no longer hold kimi -p open while CronManager is suppressing delivery. Added a regression test with explicit RED (expected false to be true) and GREEN proof. Validation: run-prompt 48/48; full repository suite 16,846 tests passing; typecheck, lint (0 errors), Sherif, changeset, docs build, independent review, OCR/Codex review, and final reread all pass.

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.

Cron-fired prompts against a paused goal still make full-context LLM calls (~7M tokens spent answering 'goal is paused')

1 participant