Skip to content

refactor(agent-core): slim llm request log line - #190

Merged
wbxl2000 merged 1 commit into
mainfrom
refactor/slim-llm-request-log
May 29, 2026
Merged

refactor(agent-core): slim llm request log line#190
wbxl2000 merged 1 commit into
mainfrom
refactor/slim-llm-request-log

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

No prior issue. Opening directly per CONTRIBUTING's "can open a PR directly" path — this is a small, focused refactor (~94 lines, under the ~100-line threshold) that touches diagnostic log output only, not product-user-visible behavior. Problem described below.

Problem

The high-frequency llm request diagnostic log line carried up to 8 fields per request (turnId, step, attempt, maxAttempts, estimatedInputTokens, messageCount, toolCallCount, partialMessageCount), making it wide and noisy.

What changed

Slim the per-request llm request line down to ~3 fields:

  • Merge turnId + stepturnStep (e.g. "0.1")
  • Merge attempt + maxAttemptsattempt (e.g. "2/3", only emitted on retries)
  • Drop messageCount and toolCallCount

The deduplicated llm config line is unchanged (still includes thinkingEffort for all providers). The same turnStep/attempt formatting is applied to the llm request failed line in the retry path for consistency.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above. (Explained above; no issue.)
  • I have added tests that prove my feature works. (Updated turn.test.ts and error-paths.e2e.test.ts to assert the slimmed field shape.)
  • Ran gen-changesets skill, or this PR needs no changeset. (Added .changeset/slim-llm-request-log.md — patch bump for @moonshot-ai/agent-core + @moonshot-ai/kimi-code.)
  • Ran gen-docs skill, or this PR needs no doc update. (Internal log format; no user-facing docs affected.)

@changeset-bot

changeset-bot Bot commented May 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3df54e5

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@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

@wbxl2000
wbxl2000 force-pushed the refactor/slim-llm-request-log branch from f3fe04f to 913b584 Compare May 29, 2026 05:00
@pkg-pr-new

pkg-pr-new Bot commented May 29, 2026

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

commit: 3df54e5

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@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: 913b584cd5

ℹ️ 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 .changeset/slim-llm-request-log.md Outdated
"@moonshot-ai/kimi-code": patch
---

Slim the `llm request` diagnostic log line: merge `turnId`/`step` into a single `turnStep` field and `attempt`/`maxAttempts` into `attempt`, and drop the `messageCount`/`toolCallCount` fields. The deduplicated `llm config` line is unchanged.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Correct stale note about llm config fields

The changeset says the deduplicated llm config line is unchanged, but this commit also routes that log through the new buildLlmRequestContext shape, and the updated test now expects turnStep instead of the previous turnId/step fields for llm config. Users relying on the release note will miss that diagnostic field rename, so either keep llm config backward-compatible or update this note to describe the changed context fields.

Useful? React with 👍 / 👎.

@wbxl2000
wbxl2000 force-pushed the refactor/slim-llm-request-log branch from 913b584 to 9569f9e Compare May 29, 2026 05:09
Merge turnId/step into a single `turnStep` field ("0.1") and
attempt/maxAttempts into `attempt` ("2/3"), and drop the
messageCount/toolCallCount fields. The per-request `llm request`
line goes from up to 8 fields down to ~3; the `llm config` line
(including thinkingEffort, logged for all providers) is unchanged.
@wbxl2000
wbxl2000 force-pushed the refactor/slim-llm-request-log branch from 9569f9e to 3df54e5 Compare May 29, 2026 05:12
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

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

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

@wbxl2000
wbxl2000 merged commit 1873859 into main May 29, 2026
6 checks passed
@wbxl2000
wbxl2000 deleted the refactor/slim-llm-request-log branch May 29, 2026 05:36
@github-actions github-actions Bot mentioned this pull request May 29, 2026
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