Skip to content

fix: summarize stringified terminal commands#10

Merged
1aal merged 1 commit into
apecloud-basefrom
fix/runtime-tool-command-summary
May 31, 2026
Merged

fix: summarize stringified terminal commands#10
1aal merged 1 commit into
apecloud-basefrom
fix/runtime-tool-command-summary

Conversation

@1aal
Copy link
Copy Markdown
Collaborator

@1aal 1aal commented May 30, 2026

变更原因

Case Z5 复测中 reasoning_summary 已经通过,但 Diagnostic checks completed.detail.checks[].commandSummary 仍全部是泛化的 Run terminal command with。定位后发现 Runtime Manager 收到的 terminal tool arguments 在实际链路里可能是字符串化的 {command: ...} / JSON-like 形式,旧逻辑没有先解析 command 字段,直接把整段字符串当作 shell 命令摘要,导致摘要变成 Run terminal command with {command:,Cloud 再脱敏后只剩泛化文本。

解决方法

  • Runtime worker 在生成 tool action summary 前,兼容解析:
    • 正常 dict args;
    • JSON 字符串 args;
    • Python literal dict 字符串;
    • 宽松 {command: ...} / {cmd: ...} / {shell_command: ...} 字符串。
  • 提取真实 command 后继续复用现有 _safe_command_summary,生成 kubectl get/describe/logs/exec 等安全概述。
  • 摘要前裁掉 KUBECONFIG=... / export KUBECONFIG=... && 等前置环境变量赋值,避免把运行上下文混进用户可见命令概述。

验证

  • uv run --extra dev pytest tests/runtime_manager/test_registry.py -k 'tool_event_helpers_are_json_safe or summarizes_stringified_terminal_arguments' -q\n- uv run --extra dev pytest tests/runtime_manager -q\n- uv run ruff check runtime_manager tests/runtime_manager\n- git diff --check\n- git diff --check origin/apecloud-base...HEAD\n

@1aal 1aal marked this pull request as ready for review May 31, 2026 01:15
@1aal 1aal merged commit cb044d0 into apecloud-base May 31, 2026
4 checks passed
@1aal 1aal deleted the fix/runtime-tool-command-summary branch May 31, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant