Skip to content

Fix Reasoning Content Being Silently Dropped by Adding Channel-Aware Reasoning Routing #645#802

Merged
yinwm merged 26 commits intosipeed:refactor/channel-systemfrom
biisal:reasoning-chnl
Feb 27, 2026
Merged

Fix Reasoning Content Being Silently Dropped by Adding Channel-Aware Reasoning Routing #645#802
yinwm merged 26 commits intosipeed:refactor/channel-systemfrom
biisal:reasoning-chnl

Conversation

@biisal
Copy link
Contributor

@biisal biisal commented Feb 26, 2026

closes #645

📝 Description

Implements reasoning output handling so reasoning is no longer silently dropped.

This PR:

  • adds reasoning_channel_id support to all channel configs
  • routes reasoning by source channel via agent loop logic
  • forwards reasoning to configured destination channel/chat
  • updates config/config.example.json with concrete reasoning_channel_id examples
  • adds tests for reasoning channel ,publish flow, ctx expiration
  • refactor PublishOutboundMedia and PublishOutbound to early check if context is expired

Used different channel id for reasoning output so the main chat looks clean even though user can provide same chat id if they want reasoning output to the same channel.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)
  • Feature is fully human written and refactored by AI and test cases mostly written by AI

🔗 Related Issue

📚 Technical Context (Skip for Docs)

  • Reference URL: N/A
  • Reasoning: Reasoning-capable provider responses included reasoning fields, but they were not consistently surfaced. This change introduces explicit reasoning routing with opt-in per-channel config and test coverage to prevent regressions.

🧪 Test Environment

  • Hardware: PC (local dev) and laptop
  • OS: MacOS and Arch Linux
  • Model/Provider: OpenAI-compatible provider
  • Channels: logic covered for all configured channel types

📸 Evidence (Optional)

Click to view Logs/Screenshots
avisek@codeltix-dot-com   make check
all modules verified
?   	github.com/sipeed/picoclaw/cmd/picoclaw	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/agent	(cached)
ok  	github.com/sipeed/picoclaw/pkg/auth	(cached)
ok  	github.com/sipeed/picoclaw/pkg/bus	(cached)
ok  	github.com/sipeed/picoclaw/pkg/channels	(cached)
?   	github.com/sipeed/picoclaw/pkg/channels/dingtalk	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/discord	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/feishu	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/line	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/maixcam	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/onebot	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/pico	[no test files]
?   	github.com/sipeed/picoclaw/pkg/channels/qq	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/channels/slack	(cached)
?   	github.com/sipeed/picoclaw/pkg/channels/telegram	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/channels/wecom	(cached)
?   	github.com/sipeed/picoclaw/pkg/channels/whatsapp	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/config	(cached)
?   	github.com/sipeed/picoclaw/pkg/constants	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/cron	(cached)
?   	github.com/sipeed/picoclaw/pkg/devices	[no test files]
?   	github.com/sipeed/picoclaw/pkg/devices/events	[no test files]
?   	github.com/sipeed/picoclaw/pkg/devices/sources	[no test files]
?   	github.com/sipeed/picoclaw/pkg/health	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/heartbeat	(cached)
ok  	github.com/sipeed/picoclaw/pkg/identity	(cached)
ok  	github.com/sipeed/picoclaw/pkg/logger	(cached)
ok  	github.com/sipeed/picoclaw/pkg/media	(cached)
ok  	github.com/sipeed/picoclaw/pkg/migrate	(cached)
ok  	github.com/sipeed/picoclaw/pkg/providers	(cached)
ok  	github.com/sipeed/picoclaw/pkg/providers/anthropic	(cached)
ok  	github.com/sipeed/picoclaw/pkg/providers/openai_compat	(cached)
?   	github.com/sipeed/picoclaw/pkg/providers/protocoltypes	[no test files]
ok  	github.com/sipeed/picoclaw/pkg/routing	(cached)
ok  	github.com/sipeed/picoclaw/pkg/session	(cached)
ok  	github.com/sipeed/picoclaw/pkg/skills	(cached)
ok  	github.com/sipeed/picoclaw/pkg/state	(cached)
ok  	github.com/sipeed/picoclaw/pkg/tools	(cached)
ok  	github.com/sipeed/picoclaw/pkg/utils	(cached)
?   	github.com/sipeed/picoclaw/pkg/voice	[no test files]
avisek@codeltix-dot-com  

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

@alexhoshina alexhoshina force-pushed the refactor/channel-system branch from 05eb426 to 6bc71b5 Compare February 26, 2026 15:30
@alexhoshina alexhoshina force-pushed the refactor/channel-system branch from 8b1e667 to ba98069 Compare February 26, 2026 16:26
imguoguo and others added 4 commits February 27, 2026 10:10
…ipeed#812)

* chore(docker): move Dockerfile into docker/ directory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(docker): add entrypoint script to goreleaser Dockerfile

- entrypoint.sh: on first run (config and workspace both absent) runs
  picoclaw onboard then exits for the user to configure; subsequent
  starts exec picoclaw gateway directly
- Dockerfile.goreleaser: copy and use entrypoint.sh, run as root
- .goreleaser.yaml: update dockerfile path, add entrypoint.sh to
  extra_files so it is included in the docker build context

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(docker): update docker-compose to use pre-built image and bind mount

- Use docker.io/sipeed/picoclaw:latest instead of building locally
- Replace named volume with bind mount ./data:/root/.picoclaw
- Move docker-compose.yml into docker/ directory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: update Docker Compose section to reflect new docker/ layout

- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow: first run generates docker/data/config.json,
  container exits, user edits config, then restarts
- Replace "Rebuild" section with "Update" (docker pull) since the
  compose file now uses the pre-built sipeed/picoclaw image
- Apply same changes to README.zh.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(docker): use restart: on-failure to prevent restart after first-run setup

unless-stopped restarts the container regardless of exit code, causing
an infinite loop when entrypoint exits 0 after the initial onboard.
on-failure only restarts on non-zero exit (i.e. crashes), so the
container stays stopped after setup until the user restarts it manually.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: sync Docker Compose section across all language READMEs

Apply the same updates as the English/Chinese READMEs:
- Use docker compose -f docker/docker-compose.yml for all commands
- Update setup flow to first-run auto-config pattern
- Replace build/rebuild section with update via docker pull
- Affected: README.fr.md, README.ja.md, README.pt-br.md, README.vi.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
refactor(pkg/utils): add unified atomic file write utility
@alexhoshina
Copy link
Collaborator

Perhaps you need to rebase again. I rebased the main branch, and there are changes in the commits of the refactor branch. Sorry for the extra work you have to do, but this is necessary preparation before merging into main.

@alexhoshina
Copy link
Collaborator

The refactor branch is scheduled to be merged during the daytime of February 28, 2026, Beijing Time (GMT+8), with the exact time yet to be determined. You may wait until after the merge to request a PR review Or complete the review before finishing the merge; I will review your PR as quickly as possible We have provided comprehensive migration documentation for the new channel system.

@alexhoshina alexhoshina added this to the Refactor Channel milestone Feb 27, 2026
lxowalle and others added 4 commits February 27, 2026 14:36
* Prompt to modify the max_tool_iterations parameter.

* fix typo and set max iterations to 50
…ions and improve message bus context cancellation handling.
* * Set default value of max tokens to 32768

* * set max tokens to 32k, default model to null

* * Fix format error
@alexhoshina
Copy link
Collaborator

Hello, @biisal, I have just rebased your fork! I am very sorry that my incorrect operation on the base branch refactor/channel-system caused changes to the history, resulting in a massive number of conflicts. Please check if any of your modifications were incorrectly handled by my rebase. My sincere apologies! Thank you for your contribution.

@yinwm yinwm merged commit 90e49bc into sipeed:refactor/channel-system Feb 27, 2026
2 checks passed
@yinwm
Copy link
Collaborator

yinwm commented Feb 27, 2026

thanks for the pr

alexhoshina added a commit to alexhoshina/picoclaw that referenced this pull request Feb 27, 2026
Add a 5-second timeout to handleReasoning's PublishOutbound call so
fire-and-forget goroutines do not block indefinitely when the outbound
bus channel is full. Reasoning output is best-effort; on timeout the
publish is abandoned with a warning log instead of holding the
goroutine alive.

Fixes goroutine leak introduced in sipeed#802.
liangzhang-keepmoving pushed a commit to liangzhang-keepmoving/picoclaw that referenced this pull request Mar 2, 2026
Add a 5-second timeout to handleReasoning's PublishOutbound call so
fire-and-forget goroutines do not block indefinitely when the outbound
bus channel is full. Reasoning output is best-effort; on timeout the
publish is abandoned with a warning log instead of holding the
goroutine alive.

Fixes goroutine leak introduced in sipeed#802.
jrussellsmyth pushed a commit to jrussellsmyth/picoclaw that referenced this pull request Mar 3, 2026
Add a 5-second timeout to handleReasoning's PublishOutbound call so
fire-and-forget goroutines do not block indefinitely when the outbound
bus channel is full. Reasoning output is best-effort; on timeout the
publish is abandoned with a warning log instead of holding the
goroutine alive.

Fixes goroutine leak introduced in sipeed#802.
hyperwd pushed a commit to hyperwd/picoclaw that referenced this pull request Mar 5, 2026
Fix Reasoning Content Being Silently Dropped by Adding Channel-Aware Reasoning Routing sipeed#645
hyperwd pushed a commit to hyperwd/picoclaw that referenced this pull request Mar 5, 2026
Add a 5-second timeout to handleReasoning's PublishOutbound call so
fire-and-forget goroutines do not block indefinitely when the outbound
bus channel is full. Reasoning output is best-effort; on timeout the
publish is abandoned with a warning log instead of holding the
goroutine alive.

Fixes goroutine leak introduced in sipeed#802.
Pluckypan pushed a commit to Pluckypan/picoclaw that referenced this pull request Mar 6, 2026
Fix Reasoning Content Being Silently Dropped by Adding Channel-Aware Reasoning Routing sipeed#645
Pluckypan pushed a commit to Pluckypan/picoclaw that referenced this pull request Mar 6, 2026
Add a 5-second timeout to handleReasoning's PublishOutbound call so
fire-and-forget goroutines do not block indefinitely when the outbound
bus channel is full. Reasoning output is best-effort; on timeout the
publish is abandoned with a warning log instead of holding the
goroutine alive.

Fixes goroutine leak introduced in sipeed#802.
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.

8 participants