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

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

Rebase update (2026-11-02)

Current main uses agent-core-v2. This branch is rebased at 04009e458ea541f5e3f1045ffa9741ab6081ca0f; it retains the paused-goal cron guard, v2 print-runner guard, regression tests, docs, and changeset. The old agent-core files were removed upstream and are not part of the rebased diff. Current validation: RED on current main, then 95 cron and 35 v2 print tests GREEN, both package typechecks pass. GitHub CI pending. Earlier test counts below describe the pre-migration branch.

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: 04009e4

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".

ousamabenyounes added a commit to ousamabenyounes/kimi-code that referenced this pull request Jul 31, 2026
@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.

ousamabenyounes added a commit to ousamabenyounes/kimi-code that referenced this pull request Aug 16, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T00:42:12.444886Z 04009e4 New commits
ℹ️ 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.

Port the paused-goal cron guard to the v2 scheduler and keep print runs from waiting on fires the scheduler suppresses.
@ousamabenyounes

Copy link
Copy Markdown
Author

Rebased onto current main and resolved conflicts from the migration to agent-core-v2. The old agent-core cron and print-runner files were removed upstream, so I kept the paused-goal guard and regression tests in the current v2 paths, alongside the English/Chinese docs and changeset. New head: 04009e458ea541f5e3f1045ffa9741ab6081ca0f.

Validation on the rebased checkout: the paused-goal cron regression fails on current main (one unexpected model call), then passes with this patch; 95 cron tests and 35 v2 print tests pass. Both affected packages typecheck. Changed-file oxlint reports 0 errors (4 existing warnings). Independent high-effort Codex review: PASS after tracing the synchronous dispatch path. I am monitoring GitHub CI and any new review feedback.

This branch has not been deployed

No deployments
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