Skip to content

feat(opencode): Message logger - #32381

Closed
bornmw wants to merge 7 commits into
anomalyco:devfrom
bornmw:message-logger
Closed

bornmw wants to merge 7 commits into
anomalyco:devfrom
bornmw:message-logger

Conversation

@bornmw

@bornmw bornmw commented Jun 15, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #29186

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds configurable LLM request/response logging via experimental.log_messages ("info", "debug", "trace") and wires it into both the native and AI SDK runtimes.

  • "info" — logs messages + response text (Effect.logInfo)
  • "debug" — adds generation params (Effect.logDebug)
  • "trace" — adds raw provider-native request body (native runtime only, Effect.logDebug)

Also fixes a crash on --continue where a "dummy" session ID placeholder triggered a server-side validation error — the fake route was removed and the App component's existing --continue effect
handles navigation once sync loads.

How did you verify your code works?

  • Typecheck passes
  • Built and tested locally with OPENCODE_LOG_LEVEL=DEBUG — LLM request and LLM response entries appear in the log file at all three verbosity levels
  • --continue no longer shows the "ses" validation error

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

bornmw added 3 commits June 14, 2026 23:45
Replace experimental.log_messages boolean with a string union
('info' | 'debug' | 'trace') that controls verbosity:
- 'info': messages + response text (logInfo)
- 'debug': adds generation params (logDebug)
- 'trace': adds raw provider-native request body (logDebug)
The experimental.log_messages config was only wired into the native
LLM runtime path. The default AI SDK runtime had no logging support,
so the setting appeared broken for most users.

- Log request (model, messages, generation params) before streamText
- Log response events via Stream.tap in the LLMEvent pipeline
- Reuse MessageLogger.formatEvents for response formatting
@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Message logger doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@bornmw bornmw changed the title Message logger feat(opencode): Message logger Jun 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

[FEATURE]: Log LLM API request/response body at DEBUG log level

1 participant