Repository navigation
fix(omp): tolerate late tool events from background jobs - #332
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (4)
🧰 Additional context used🪛 ast-grep (0.45.3)packages/adapters/omp/src/omp-rpc-session.ts[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec. (detect-child-process-typescript) 🔇 Additional comments (2)
📝 SummarySummary by CodeRabbit
WalkthroughOMP 会话现在验证工具帧的调用标识,并忽略未知或已完成调用的迟到事件。测试模拟器支持注入工具帧,并覆盖异步事件、字段校验和有效空值输出。 ChangesOMP 工具帧处理
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The adapter change is mergeable based on the available evidence; no concrete behavior or compatibility risk remains unresolved. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
OMP background jobs can emit
tool_execution_updateand anothertool_execution_endafter their initial end event has removed the call from the active Tool map. The Adapter currently treats those frames as protocol faults, causing an otherwise usable Session to fail withOmp RPC returned an invalid Tool update(orTool end).Ignore update/end frames that cannot be associated with an active Tool, including frames arriving during a later Turn, without projecting duplicate Tool events. Keep rejecting missing, empty, or non-string call IDs during an active Turn and invalid end payloads for active Tools. Treat a missing
partialResultasnull, preserving other valid JSON values.The change is confined to the OMP RPC Adapter and its tests. It adds 24 regression cases covering late/repeated frames, idle and cross-Turn delivery, unknown calls, missing fields, invalid IDs and active end payloads, and preservation of valid falsy results. No public contract, dependency, UI, or release-version changes.
Related issues
Related to #283 and #173. The previously closed, unmerged #182 was reviewed during investigation; this PR is limited to OMP Tool-frame compatibility and does not include its other changes.
Test plan
Automated checks on this branch, based on
mainat6979011:node node_modules/vitest/vitest.mjs run --config tests/vitest.config.js packages/adapters/omp/test packages/adapters/pi/test— 200 tests passed across 13 files (including 39 OMP RPC tests).npm run typecheck— passed, including test types.node node_modules/prettier/bin/prettier.cjs --check packages/adapters/omp/src/omp-rpc-session.ts packages/adapters/omp/test/omp-rpc-session.test.ts— passed.node node_modules/eslint/bin/eslint.js packages/adapters/omp/src/omp-rpc-session.ts packages/adapters/omp/test/omp-rpc-session.test.ts— passed.git diff --check— passed before commit.Manual validation, performed before the final test additions and removal of unused diagnostic bookkeeping: locally built codexhost 0.9.0 with OMP 18.2.0 on WSL, accessed from Codex Desktop over SSH. A background subagent completed and delivered its result; subsequent interaction in the same Session remained usable. The user confirmed that the original failure was resolved. The exact Desktop build and OS distribution versions were not recorded for that run.
The final branch was not redeployed for another live Harness run. Windows-local OMP, macOS, ARM64, the full TypeScript suite, and Rust checks were not run locally; focused checks were selected for this Adapter-only change, with broader platform coverage left to repository CI.