fix(openclaw): canonicalize mixed Kimi tool calls#4040
Conversation
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR refactors safe exec tool-call rewriting in the Kimi inference compatibility layer. It adds a helper to extract individual exec commands, introduces two new rewrite strategies for parsing both single combined calls and canonical multi-toolCall sequences, and integrates the new logic into message and event rewriting paths with a corresponding test. ChangesSafe Exec Tool-Call Canonicalization
Sequence DiagramsequenceDiagram
participant Message as Kimi Message
participant Rewrite as getSafeExecRewrite
participant Combined as getSafeCombinedExecToolCall
participant Canonical as getCanonicalSafeExecToolCallSequence
participant Result as Rewritten Message
Message->>Rewrite: Check message content
alt Single combined exec call
Rewrite->>Combined: Parse delimited command chain
Combined->>Combined: Validate hostname date uptime sequence
Combined->>Result: Split into 3 exec toolCalls
else Multiple exec toolCalls
Rewrite->>Canonical: Recognize canonical sequence
Canonical->>Canonical: Verify 2+ toolCalls match expected set
Canonical->>Result: Deduplicate and order canonically
else No match
Rewrite->>Result: Return no rewrite
end
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
PR Review AdvisorRecommendation: blocked This is an automated advisory review. A human maintainer must make the final merge decision. Limitations: Review used deterministic PR context, the provided diff, and read-only file inspection; no scripts, package-manager commands, or tests were executed.; The required E2E run was reported as auto-dispatched, but no completed passing kimi-inference-compat-e2e result for the head SHA was available in the gathered status rollup.; Review thread state was not fully available beyond the provided GraphQL/comment context.; The linked issue is already closed by PR #3046, so acceptance mapping includes historical clauses that this follow-up only partially exercises. Full advisor summaryPR Review AdvisorBase: The code change is narrowly scoped and has a focused unit regression, but mergeability is blocked and the required Kimi E2E for the head SHA has not been observed as passing. Gate status
🔴 Blockers
🟡 Warnings
🔵 Suggestions
Acceptance coverage
Security review
Test / E2E status
✅ What looks good
Review completeness
|
Selective E2E Results — ✅ All requested jobs passedRun: 26263352050
|
Summary
This PR fixes the Kimi K2.6/OpenClaw compatibility plugin after the latest OpenClaw runtime can persist a mixed streamed state containing already-split
hostname/datecalls plus the original combinedhostname; date; uptimecall. The plugin now canonicalizes that mixed safe diagnostic shape back to exactlyhostname,date, anduptimeso the Kimi E2E trajectory acceptance check can pass.Related Issue
Fixes #2620
Changes
execcommand extraction across single-call and mixed-call rewrites.hostname,date, anduptime.hostname,date,hostname; date; uptimetrajectory shape fromkimi-inference-compat-e2e.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)Focused verification run:
npm ci --ignore-scriptsnpx vitest run test/kimi-inference-compat-plugin.test.tsnpm run build:cligit diff --checkAI Disclosure
Signed-off-by: Julie Yaunches jyaunches@nvidia.com
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests