Skip to content

GuidedGenerationLoop: log diagnostics only when diagnostic log is enabled - #693

Merged
davidkoski merged 1 commit into
ml-explore:mainfrom
tseylerd:main
Oct 14, 2026
Merged

davidkoski merged 1 commit into
ml-explore:mainfrom
tseylerd:main

Conversation

@tseylerd

Copy link
Copy Markdown
Contributor

Proposed changes

Current logging produces an enormous amount of logs from GuidedGenerationLoop.swift when using guided generation.

This commit addresses that and follows the logic used for other logging in GuidedGenerationLoop.swift: it's logged only when diagnosticLog is enabled. This reduces the amount of logs produced and still leaves the possibility to observe the generation process for debugging.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • No, the change doesn't require tests I have added tests that prove my fix is effective or that my feature works
  • No, there's nothing to document I have updated the necessary documentation (if needed)

AI usage

  • I have read this PR description in full and approve it as my own, and it
    accurately describes the code changes.
  • AI usage disclosure: used AI to fix grammar issues in commit message and PR.

@davidkoski

Copy link
Copy Markdown
Member

The test failure is fixed by #696 -- just needs a rebase.

Current logging produces an enormous amount of logs when using guided generation. This commit addresses that and follows the logic used for other logging in GuidedGenerationLoop.swift: it's logged only when diagnosticLog is enabled. This reduces the amount of logs produced and still leaves the possibility to observe the generation process for debugging.
let ms =
elapsed.components.seconds * 1000 + elapsed.components.attoseconds
/ 1_000_000_000_000_000
let prefix = String(accumulatedText.prefix(200))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This accumulated text is only ever consumed here. Perhaps the collection (above, outside this change) should be gated on diagnosticLog being true. That doesn't block merge -- it was this way before, but logger.info is probably true by default.

@davidkoski davidkoski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change looks good, thank you!

@davidkoski
davidkoski merged commit d16ba5a into ml-explore:main Oct 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants