Repository navigation
chore: sync release 2026-10-30 back to main - #4557
Conversation
* chore(agent-core-v2): slim prompts and reminders * fix(agent-core-v2): restore subagent authorization guidance * chore(agent-core-v2): drop prompt wording assertion
…esults (#4553) * fix(agent-core-v2): cap Read at about 25k tokens and trim file tool results - Cap the max_chars a Read call can request at 100k characters (was 500k) and drop the description sentence that told the model to request a larger budget for whole large files; the event log note now points to Next Read instead of a larger max_chars. - Stop a page at about max_chars / 4 estimated tokens. The limit is applied while the page is assembled: drop whole lines, or cut a single long line by token weight, without re-reading the file. It rounds up, so pages of ASCII text never reach it and keep their exact character pagination. A tail read whose last line cannot fit returns the bounded forward recovery. - Omit the Read status block when a call returns the whole file with nothing to report. - On an incomplete page, point to Grep for a specific section instead of answering from that page alone. - After a successful Edit or Write, tell the model it does not need to Read the file back. * fix(agent-core-v2): reject named Read ranges that exceed the token limit When a call names a range, with n_lines or a negative line_offset, and those lines exceed the estimated token limit, return an error that says how many lines fit and suggests the exact arguments, instead of a page that silently covers only part of the range. Whole-file reads, reads from an offset to the end, single-line requests, and column continuations still page with Next Read. * fix(agent-core-v2): keep character paging for named Read ranges The named-range check ran before character trimming, so an ASCII range longer than max_chars, whose status block pushed the page over both limits, returned a range error instead of a page with Next Read. Run the check only once the page fits max_chars, so it rejects a range only when the token limit would cut it shorter than the character limit does. * test(kap-server): raise max_chars in the paginated attachment read test Every incomplete Read page now carries one more status sentence, so with a 500-character budget and a long attachment path the status took about 490 characters and the read could not finish within the test's 80 pages.
|
Codex Review SummaryThis 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: 5454f272c3
ℹ️ 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".
| const suggestion = { | ||
| path: page.request.args.path, | ||
| line_offset: page.fromTail ? page.rangeEnd - lines + 1 : page.rangeStart, | ||
| n_lines: lines, | ||
| }; |
There was a problem hiding this comment.
Carry max_chars into the suggested retry
When [read].max_chars is raised but default_max_chars remains lower, a named-range request can exceed the token limit only after explicitly requesting the larger max_chars. The suggested arguments are calculated using that larger effective budget but omit it, so retrying the exact JSON falls back to default_max_chars and can truncate the supposedly fitting range again. Include page.request.maxChars in the suggestion so the recovery works for independently configured defaults and maxima.
Useful? React with 👍 / 👎.
| agents_section: | ||
| agentsMd.length > 0 || options.readOnly !== true | ||
| ? renderPrompt(PROJECT_INFORMATION_SECTION, { |
There was a problem hiding this comment.
Preserve nested AGENTS.md discovery for read-only profiles
When no AGENTS.md applies at the current working directory but scoped guides exist below it, this condition removes the entire Project information section from the explore and plan profiles, including the instruction to check subdirectories for more-specific guidance. A root-scoped Glob or Grep records only the search root as its access, so the dynamic discovery reminder does not necessarily find a guide beside a matched descendant; the read-only agent can then return analysis or a plan without applying that guide. Keep the discovery instruction for read-only profiles even when the initial agentsMd content is empty.
AGENTS.md reference: AGENTS.md:L119-L121
Useful? React with 👍 / 👎.
Requirement or Bug
将
release/2026-10-30的 CLI 2.4.1 补丁发布内容回同步到 main,同时保留 main 在分支之后合入的功能、重构与 Web 产物。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
this.environment.inspect(),Read / ReadMediaFile 文案合并 release 精简与 main 的 active-environment 语义。[read] max_chars调整;保留 main 的stubAgentEnvironment测试结构。apps/kimi-code/CHANGELOG.md,消费cap-read-output、slim-agent-prompts、slim-goal-plan-reminders三个 changeset。Release 未改锁文件,本 PR 也没有锁文件差异。aa3ed3681(release 1.2.0 回同步)及后续 Web 修复,因此保留 main 的apps/kimi-code/dist-web,本 PR 对该目录零 diff;2.4.1 CHANGELOG 仍保留已发布的 Web 条目。Behavior Changes and Affected Users
config.toml的[read]下设置max_charskimi web与内置 Web UI 用户验证:
pnpm typecheck通过(含 packages build、CLI、VS Code、vis)。pnpm lint通过;仅有仓内既有 warnings。fullCompaction.test.ts120 passed(pre-shrink 预算按精简后提示词调整为 80k,绝对 token 断言改为数值匹配),Read 96 passed,Bash 56 passed。test/search/searchService.test.ts两条基线问题(sync failure accounting、fingerprint cache),test/sessions.test.ts91 passed。以本 PR CI 为最终验收。git diff --check通过;apps/kimi-code/dist-web、apps/vscode、pnpm-lock.yaml均为零 diff。Checklist
max_chars退路)gen-changesetsskill, or this PR needs no changeset. (回同步已消费 changeset,无新增用户变化)gen-docsskill, or this PR needs no doc update. (Read 配置与中英工具文档随 fix(agent-core-v2): cap Read at about 25k tokens and trim file tool results #4553 回同步;changelog docs 已在 docs(changelog): sync 2.4.1 from apps/kimi-code/CHANGELOG.md #4556 合入)