fix(agent): route reasoning_content to reasoning channel#1907
Merged
yinwm merged 1 commit intosipeed:mainfrom Mar 23, 2026
Merged
fix(agent): route reasoning_content to reasoning channel#1907yinwm merged 1 commit intosipeed:mainfrom
yinwm merged 1 commit intosipeed:mainfrom
Conversation
yinwm
approved these changes
Mar 23, 2026
Collaborator
yinwm
left a comment
There was a problem hiding this comment.
LGTM! This is a well-targeted bug fix with minimal code changes.
Summary:
- Fixes the regression where reasoning_channel_id did not work with OpenAI-compatible providers
- Root cause: handleReasoning only received response.Reasoning, which is empty for OpenAI-compatible providers
- Fix: Fallback to response.ReasoningContent when response.Reasoning is empty
Why approve:
- Minimal change - 4 lines added, 1 modified
- Correct priority - keeps Reasoning as primary source
- Comprehensive regression test added
- Low risk - only affects reasoning channel publish path
- Directly addresses issue 1746
Thanks @xiwuqi!
10 tasks
andressg79
pushed a commit
to andressg79/picoclaw
that referenced
this pull request
Mar 30, 2026
…-content fix(agent): route reasoning_content to reasoning channel
ra1phdd
pushed a commit
to ra1phdd/picoclaw-pkg
that referenced
this pull request
Apr 12, 2026
…-content fix(agent): route reasoning_content to reasoning channel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Fixes the reasoning channel regression behind
#1746: OpenAI-compatible providers can return reasoning inreasoning_content, but PicoClaw did not forward that content to the configured reasoning channel.Problem summary:
reasoning_channel_idis expected to receive model reasoning for channels such as Telegram.reasoning_contentwhile leavingreasoningempty.Root cause:
pkg/agent/loop.gopassed onlyresponse.ReasoningintohandleReasoning().response.ReasoningContent, so the publish path saw an empty string and returned early.What changed:
response.Reasoningpath unchanged when it is populated.response.ReasoningContentbefore callinghandleReasoning().Why this fix:
response.Reasoningand only usesresponse.ReasoningContentwhen needed.Risk / compatibility:
response.Reasoningis empty.response.Reasoningkeep their existing behavior.🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
Fixes #1746
📚 Technical Context (Skip for Docs)
ReasoningContentas evidence that reasoning exists, but the channel delivery path only forwardedresponse.Reasoning. That mismatch makes OpenAI-compatible reasoning invisible toreasoning_channel_id.🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
Passed:
go test ./pkg/agent -run TestProcessMessage_PublishesReasoningContentToReasoningChannel -count=1go test ./pkg/agent -run TestHandleReasoning -count=1go test ./pkg/providers/openai_compat -count=1Additional broader validation:
go test ./pkg/agent -count=1still fails inTestGlobalSkillFileContentChange.upstream/mainworktree at commit3500080, so it is pre-existing and not introduced by this PR.codex review --base origin/maincould not run in this environment because the local Codex config rejectedapprovals_reviewer = never.☑️ Checklist