Skip to content

feat(opencode): Message logger#32381

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

feat(opencode): Message logger#32381
bornmw wants to merge 3 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=DEBUGLLM 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
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.

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

1 participant