test(core): stub resident-agent methods in the agent test registry - #7540
test(core): stub resident-agent methods in the agent test registry#7540he-yufeng wants to merge 1 commit into
Conversation
Main's ubuntu CI has been red since QwenLM#7460 on "runs a non-interactive fork through the background registry". That commit added a completion assertion (registry.complete called with the fork's final text), but the shared stub BackgroundTaskRegistry lacks registerResidentAgent/unregisterResidentAgent. The fork's background turn reaches the resident-agent branch, hits the missing stub method, and the turn promise rejects into reportUnexpectedBackgroundError before registry.complete ever runs. The production path is fine (forks are meant to stay resident); the harness stub was just two methods short. Full agent.test.ts: 197/197. Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
|
Thanks for the PR! Template looks good ✓ (minor: "Risk & Scope" and "Linked Issues" sections are missing, but for a 2-line test stub fix the essential sections are all present and well-filled — not worth a round-trip). Problem: observed CI failure on main — Direction: fixing broken CI is unambiguously aligned. The production code is correct — forks are meant to stay resident — and only the test harness stub was incomplete. Size: 2 additions, 0 deletions, 1 file ( Approach: this is the minimal possible fix — two Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓(小问题:缺少 "Risk & Scope" 和 "Linked Issues" 部分,但对于一个 2 行测试 stub 修复,核心部分都已完整填写——不值得为此来回修改)。 问题:main 分支上的 CI 失败—— 方向:修复 CI 失败毫无疑问是对齐的。生产代码是正确的——fork 本应保持 resident——只是测试 harness 的 stub 不完整。 规模:2 行新增,0 行删除,1 个文件( 方案:这是最小化的修复——在现有的共享 registry stub 中添加两个 进入代码审查 🔍 — Qwen Code · qwen3.8-max-preview Reviewed at |
Code ReviewIndependent proposal before reading the diff: the fork path in The diff matches my independent proposal line-for-line. Two No findings. Clean. TestingThis is a test-only change with no user-visible behavior — the unit test itself is the real scenario. Ran the specific test on current main (before) and with the two stub lines added (after): Before (current main)After (with this PR's change applied)Full file run with the fix: 197/197 passed, no regressions. 中文说明代码审查在读 diff 之前的独立方案: Diff 与我的独立方案逐行匹配。两个 无发现。干净。 测试这是一个纯测试改动,没有用户可见行为——单元测试本身就是真实场景。在当前 main 上运行了特定测试(修改前),以及添加两行 stub 后(修改后): 修改前:1/197 失败, — Qwen Code · qwen3.8-max-preview Reviewed at |
|
Confidence: 5/5 — clean across every stage; would merge without hesitation. This is exactly the kind of PR you want to see: a clear root-cause explanation, a two-line fix that matches the existing stub pattern, and a verified before/after. The author correctly identified that the production code is fine and only the test harness was incomplete — the shared 中文说明置信度:5/5 —— 每个阶段都很干净;毫不犹豫地合并。 这正是你想看到的 PR:清晰的根因分析、符合现有 stub 模式的两行修复、以及经过验证的 before/after。作者正确地指出生产代码没有问题,只是测试 harness 不完整——共享的 — Qwen Code · qwen3.8-max-preview Reviewed at |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
— qwen3.7-max via Qwen Code /review
|
Closing as duplicate of #7538, which was opened about two hours earlier and stubs the same registry methods plus the rest of the set agent.ts can reach (getQueuedCount, restartCompletedAgent, waitForMessages, bridgeApprovalEvents) and the fork-dispatch assertion. That superset covers this one's ground. |
What this PR does
Un-reds main's ubuntu CI:
agent.test.ts > runs a non-interactive fork through the background registryfails on every current main run.Why it's needed
#7460 added an assertion that the fork completes through
registry.complete, but the shared stub registry inbeforeEachlacksregisterResidentAgent/unregisterResidentAgent. The background turn hits the missing method, the turn promise rejects intoreportUnexpectedBackgroundError, andcompletenever runs. I reproduced it locally:execute()is called once, then the turn dies at the resident-agent line. Two stub methods fix it. The production path is fine; forks are supposed to stay resident.Reviewer Test Plan
How to verify
On current main the focused test fails 1/197. With this change
npx vitest run packages/core/src/tools/agent/agent.test.tsis 197/197.Evidence (Before & After)
N/A (test-only change)
Tested on