feat(cli): report TUI state to Herdr - #9047
Draft
yiliang114 wants to merge 3 commits into
Draft
Conversation
Collaborator
Author
E2E test report
Observed behavior on macOS:
Focused Reporter and AppContainer tests pass, as do lint, typecheck, build, and bundle. Forced-kill cleanup and live Windows/Linux runs were not exercised; Herdr process detection remains the crash fallback. |
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
yiliang114
added a commit
that referenced
this pull request
Aug 19, 2026
- 1.4/9: quote production vs incl-tests LOC (3,482/9,714 supervisor; 3,033/6,186 agent-view). - 1.5: the cross-session-inbox branch is in the author fork, not this repo. - 1.8: #9047 is an open PR proposal, not a trace of shipped code.
# Conflicts: # packages/cli/src/ui/AppContainer.tsx
# Conflicts: # packages/cli/src/ui/startInteractiveUI.tsx
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.
What this PR does
This PR adds a fail-open TUI reporter when Qwen Code is launched inside a Herdr-managed pane. It reports the current session identity through Herdr's existing Qwen session source and reports
working,blocked, andidlelifecycle state through a separate TUI source with serialized, deduplicated delivery and graceful release.The state comes from Qwen Code's own interactive UI: model, tool, and slash-command execution report
working; authentication, approvals, and required startup prompts reportblocked; everything else reportsidle. The integration is limited to the interactive TUI and does not change core, ACP, headless mode, Agent Team, or external-agent orchestration.Why it's needed
Herdr can identify Qwen Code and persist its session after herdrdev/herdr#2743, but screen matching can still classify localized working and approval states as idle, as reproduced in herdrdev/herdr#2756. Qwen Code already has the authoritative state before it is rendered or translated, so reporting that state directly removes the locale dependency.
Full lifecycle reporting depends on the paired ownership contract proposed in herdrdev/herdr#2757. Existing Herdr versions continue to accept session identity and safely fall back to screen detection when the separate lifecycle source is not recognized as the same Qwen owner.
Reviewer Test Plan
How to verify
idlewith the current Qwen session ID.workingwithout relying on localized screen text.blocked, then approve it and confirm the state returns throughworkingtoidle./clearand confirm that the session ID changes without losing lifecycle state./quitand confirm that the TUI lifecycle source is released while Herdr retains normal process/screen fallback behavior.Evidence (Before & After)
Before: the localized active-turn and approval buffers in herdrdev/herdr#2756 remained
idleunder screen detection.After: a live macOS run observed
idle → working → idle,working → blocked → working → idle, a session replacement after/clear, and lifecycle release after/quit.Tested on
Environment (optional)
macOS, Node.js 22.22.0, Qwen Code bundle, and local Herdr master
952729ewith the minimal paired-owner change described in herdrdev/herdr#2757.Risk & Scope
Linked Issues
References herdrdev/herdr#2756 and herdrdev/herdr#2757.
中文说明
本 PR 做了什么
本 PR 在 Qwen Code 由 Herdr 托管的 pane 中启动时增加一个 fail-open 的 TUI Reporter。它通过 Herdr 现有的 Qwen session source 上报当前会话身份,并通过独立的 TUI source 上报
working、blocked、idle生命周期状态;发送过程串行、去重,并在正常退出时释放状态权威。状态直接来自 Qwen Code 的交互式 UI:模型、工具和 slash command 执行时上报
working;认证、审批和必须处理的启动提示上报blocked;其余状态上报idle。该集成仅限交互式 TUI,不修改 core、ACP、headless、Agent Team 或外部 Agent 调度。为什么需要它
herdrdev/herdr#2743 合并后,Herdr 已能识别 Qwen Code 并持久化 session,但屏幕匹配仍可能把本地化后的 working 和 approval 界面判断为 idle,herdrdev/herdr#2756 已完成真实复现。Qwen Code 在渲染和翻译之前就掌握准确状态,直接上报可去掉对界面语言的依赖。
完整生命周期上报依赖 herdrdev/herdr#2757 提议的配对 ownership 契约。旧版 Herdr 仍会接受 session identity;当独立 lifecycle source 尚未被视为同一个 Qwen owner 时,会安全回退到屏幕检测。
Reviewer 测试计划
如何验证
idle且 session ID 正确。working。blocked;批准后确认状态经working回到idle。/clear,确认 session ID 更新且 lifecycle state 不丢失。/quit,确认 TUI lifecycle source 被释放,同时 Herdr 保留正常的进程/屏幕回退行为。证据(前后对比)
Before:herdrdev/herdr#2756 中的本地化 active-turn 与 approval detection buffer 在屏幕检测下仍显示为
idle。After:macOS 真实联调观察到
idle → working → idle、working → blocked → working → idle、/clear后 session 替换,以及/quit后 lifecycle release。测试平台
环境(可选)
macOS、Node.js 22.22.0、Qwen Code bundle,以及带有 herdrdev/herdr#2757 所述最小 paired-owner 改动的本地 Herdr master
952729e。风险与范围
关联问题
关联 herdrdev/herdr#2756 与 herdrdev/herdr#2757。