fix(subagent): 兼容 OpenCode 原生 background 参数 - #12
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates SubAgent Magazine’s task-status handling to support OpenCode native background subagents (task(..., background: true)), ensuring tasks are not marked done immediately when the tool call completes but the child session is still running.
Changes:
- Treat
input.background === truethe same as legacyinput.run_in_background === truewhen translating tool statecompleted → done. - Apply the compatibility update in both real-time tool-part updates and history-scan recovery logic.
- Preserve the existing safety guard: only keep
runningwhenmetadata.session_id/metadata.sessionIdconfirms a child session was actually spawned.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
感谢你针对该问题的修复,合并pr后,我会尽快推送新版本,感谢你的支持。 |
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.
修改说明
OMOS 2.2.1 使用 OpenCode 原生的
task(..., background: true)启动后台子代理。task工具启动子 session 后会先返回completed。这时子 session通常还在运行,所以 SubAgent Magazine 需要继续把条目保持为
running。目前代码只识别旧参数
run_in_background: true,没有处理background: true。这会导致 OMOS 启动的任务被提前显示为done。本次修改在两个状态处理位置同时兼容这两个参数:
原有的
session_id/sessionId检查保持不变。只有确认子 session已经创建,条目才会继续保持
running,因此启动失败的任务不会一直卡住。
验证
npm run typechecknpm run buildrunningdonerun_in_background行为不变Closes #11