diff --git a/internal/runmgr/exec_tool_artifact_test.go b/internal/runmgr/exec_tool_artifact_test.go index e6256f9..10c011e 100644 --- a/internal/runmgr/exec_tool_artifact_test.go +++ b/internal/runmgr/exec_tool_artifact_test.go @@ -77,9 +77,11 @@ func TestRunPythonRegisterArtifactBackfill(t *testing.T) { if err := tools.RegisterInterpreterTools(c.mgr.registry); err != nil { t.Fatal(err) } + // 夹具必须是结构合法的最小 docx:登记口会做 OPC 结构自检, + // 伪 zip(PK 魔数+垃圾字节)现在会被拒绝而非登记。 py := c.ExecuteTool(core.ToolCallRequest{ CallID: "py1", Name: "run_python", - Arguments: json.RawMessage(`{"script":"open('note.docx','wb').write(b'PK\\x03\\x04hello')\n"}`), + Arguments: json.RawMessage(`{"script":"import zipfile\nwith zipfile.ZipFile('note.docx','w') as z:\n z.writestr('[Content_Types].xml','')\n z.writestr('word/document.xml','')\n"}`), }) if py.Status != "ok" || !strings.Contains(py.Output, "exit=0") { t.Fatalf("run_python: %s %s", py.Status, py.Output)