From f5474fcea33e8b38fca4e3f33f5723fa48ef5758 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 12 Jul 2026 17:16:31 +0100 Subject: [PATCH] test(ui): stabilize read tool card fixture (#105508) * test(ui): stabilize read tool card fixture * docs(agents): wait for CI before PR prepare --- AGENTS.md | 4 ++-- .../pages/chat/components/chat-tool-cards.test.ts | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 7a280e0bbed3..abb9c1d3093a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -208,7 +208,7 @@ Skills own workflows; root owns hard policy and routing. - PR artifacts/screenshots: attach to PR/comment/external artifact store. Never push screenshots, videos, proof images, or proof assets to OpenClaw or any product repo branch, including temp artifact branches. Use Crabbox artifact publishing plus the manifest URL. Do not commit `.github/pr-assets`. - CI polling: exact SHA, relevant checks only, minimal fields. Skip routine noise (`Auto response`, `Labeler`, docs agents, performance/stale). Logs only after failure/completion or concrete need. - Trusted-workflow release-branch CI: pass `target_ref` + `release_candidate_ref`; never `release_gate` (requires workflow head == target). -- Agent PR landing to `main`: use only the repo-native `scripts/pr` wrapper: run `scripts/pr review-init `, follow its emitted checkout/guard guidance, initialize and complete review artifacts with `scripts/pr review-artifacts-init `, validate them with `scripts/pr review-validate-artifacts `, then run `OPENCLAW_TESTBOX=1 scripts/pr prepare-run ` and `scripts/pr merge-run `. The Testbox flag is mandatory for agents so prepare verifies hosted CI/Testbox on the current head or reuses a patch-identical pre-rebase run green within 24 hours instead of running full gates locally. For owner-approved reviewed fork code without hosted Testbox, use `OPENCLAW_PR_GATES_REMOTE=testbox` instead. Do not rebase only because `main` advanced; merge drift is advisory unless strict drift is explicitly enabled, while GitHub still blocks conflicts. Do not idle on `auto-response` or `check-docs`. +- Agent PR landing to `main`: use only the repo-native `scripts/pr` wrapper: run `scripts/pr review-init `, follow its emitted checkout/guard guidance, initialize and complete review artifacts with `scripts/pr review-artifacts-init `, validate them with `scripts/pr review-validate-artifacts `, then run `OPENCLAW_TESTBOX=1 scripts/pr prepare-run ` and `scripts/pr merge-run `. The Testbox flag is mandatory for agents so prepare verifies hosted CI/Testbox on the current head or reuses a patch-identical pre-rebase run green within 24 hours instead of running full gates locally. `prepare-run` fails fast; invoke only after exact-head CI is complete and green. For owner-approved reviewed fork code without hosted Testbox, use `OPENCLAW_PR_GATES_REMOTE=testbox` instead. Do not rebase only because `main` advanced; merge drift is advisory unless strict drift is explicitly enabled, while GitHub still blocks conflicts. Do not idle on `auto-response` or `check-docs`. - After `scripts/pr merge-run` removes its worktree, `cd` to a persistent repo before follow-up commands. - `scripts/pr` review JSON: land-ready recommendation `READY FOR /prepare-pr`, `issueValidation.status=valid`; never `APPROVE`. @@ -259,7 +259,7 @@ Skills own workflows; root owns hard policy and routing. - Prefer injection and narrow `*.runtime.ts` mocks over broad barrels or `openclaw/plugin-sdk/*`. - Do not edit baseline/inventory/ignore/snapshot/expected-failure files to silence checks without explicit approval. - Do not run independent `pnpm test`/Vitest commands concurrently in one worktree; Vitest cache races with `ENOTEMPTY`. Group one command or use distinct `OPENCLAW_VITEST_FS_MODULE_CACHE_PATH`. -- Test workers max 16. Memory pressure: `OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test`. +- Vitest rejects Jest `--runInBand`; use `OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test` for serial proof. Test workers max 16. - Live: `OPENCLAW_LIVE_TEST=1 pnpm test:live`; verbose `OPENCLAW_LIVE_TEST_QUIET=0`. - Guide: `docs/reference/test.md`. diff --git a/ui/src/pages/chat/components/chat-tool-cards.test.ts b/ui/src/pages/chat/components/chat-tool-cards.test.ts index 28829fe0928f..86f2b3150a7c 100644 --- a/ui/src/pages/chat/components/chat-tool-cards.test.ts +++ b/ui/src/pages/chat/components/chat-tool-cards.test.ts @@ -7,18 +7,21 @@ vi.mock("../markdown.ts", async (importOriginal) => await importOriginal()); vi.mock("../tool-display.ts", () => ({ formatToolDetail: (display: { detail?: string }) => display.detail, resolveToolDisplay: ({ name, args }: { name: string; args?: unknown }) => { + const argRecord = + args && typeof args === "object" && !Array.isArray(args) + ? (args as Record) + : undefined; const labels: Record = { sessions_spawn: "Sub-agent", skill_workshop: "Skill Workshop", web_search: "Web Search", }; const detail = - name === "skill_workshop" && - args && - typeof args === "object" && - typeof (args as { action?: unknown }).action === "string" - ? (args as { action: string }).action - : undefined; + name === "skill_workshop" && typeof argRecord?.action === "string" + ? argRecord.action + : name === "read" && typeof argRecord?.path === "string" + ? argRecord.path + : undefined; return { name, label: labels[name] ?? name,