Skip to content

fix(goal): remove time budget cap and exclude offline time - #3657

Merged
chengluyu merged 4 commits into
mainfrom
fix/goal-time-budget
Sep 10, 2026
Merged

fix(goal): remove time budget cap and exclude offline time#3657
chengluyu merged 4 commits into
mainfrom
fix/goal-time-budget

Conversation

@chengluyu

@chengluyu chengluyu commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This fixes goal time-budget limits and accounting across session shutdown and resume.

Problem

Goal time budgets above 24 hours were rejected. Restoring an active goal also charged the time spent with the program closed: a goal with 2 seconds of saved usage could return with 7 seconds used after 5 seconds offline.

What changed

  • Remove the 24-hour cap while retaining the 1-second minimum and finite-value validation. Schedule long deadlines in segments within Node's timer range, checking the remaining budget after each segment.
  • Save elapsed time and pause active goals when their agent closes, before the lifecycle flushes persistence. Restore saved elapsed time without adding offline time; resuming continues with the remaining budget.
  • Add a close/restore/resume regression test, update legacy-record recovery expectations, and refresh tool-description snapshots and their hashes. Adjust test cleanup for agents already removed through the lifecycle.
  • Update the English and Chinese goal guides and include two CLI patch changesets.

Validation: 241 tests passed across goal, wire resume, and agent lifecycle suites. All 181 tests in the loop and tool suites also passed after regenerating snapshots and rerunning without snapshot updates. Agent-core-v2 typecheck, import-boundary checks, no-comments checks, and git diff --check passed. Type-aware lint reported no errors (existing warnings remain).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fabe97d

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 commented Sep 8, 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-09-10T12:39:36.321666Z fabe97d Manual request
🔒 Security Review Completed 2026-09-10T12:41:04.563991Z fabe97d Manual request
ℹ️ 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 Sep 8, 2026

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

commit: fabe97d

@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: 3820bc5ae9

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +15 to +17
A time budget must be at least 1 second and convert to a finite number of milliseconds.
There is no upper duration limit. Turn and token budgets must be positive and are rounded
to the nearest whole number (minimum 1).

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 Regenerate snapshots after changing the tool description

Changing this raw description changes both the serialized llm.tools_snapshot payload and its hash, but the exact inline snapshots still contain the old 24-hour wording in test/agent/loop/loop.test.ts:155 and test/tool/tool.test.ts:4324,4403. Any full run containing those tests will therefore fail; update the affected snapshot text and hashes alongside this change.

Useful? React with 👍 / 👎.

@chengluyu

Copy link
Copy Markdown
Collaborator Author

@codex review

Updated the affected tool-description snapshots and hashes in 06509ec. All 181 tests in the loop and tool suites pass when rerun without snapshot updates.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 06509ec129

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 06509ec129

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chengluyu

Copy link
Copy Markdown
Collaborator Author

@codex review

Merged latest main (1e6f6e3), regenerated the conflicting snapshots, and reran all 422 related tests successfully. Typecheck and import/comment checks also pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: fabe97d276

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: fabe97d276

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chengluyu
chengluyu merged commit 5b3b5b6 into main Sep 10, 2026
15 checks passed
@chengluyu
chengluyu deleted the fix/goal-time-budget branch September 10, 2026 13:27
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