fix(agent): seed CLAWBOX.md so the agent knows device conventions - #82
Conversation
…x conventions Root cause: the OpenClaw agent's session-start context (AGENTS.md, BOOTSTRAP.md, etc.) knows nothing about ClawBox-specific device conventions. When the user asks 'is skill X installed?', the agent falls back to guessing paths and looks in /home/clawbox/.npm-global/lib/node_modules/openclaw/skills — the package's built-in skills directory, not where the App Store writes user-installed skills (~/.openclaw/workspace/skills/). It then reports 'skill not installed' despite the file being on disk. Same class of problem for browser automation (agent doesn't know browser_* MCP tools exist) and for skill installation (agent would copy files manually instead of going through app_install). Adds config/clawbox-workspace-guide.md — a concise markdown file that documents: - Where user-installed skills live (~/.openclaw/workspace/skills/) and explicitly where they do NOT live (the npm-global path) - That skill install/uninstall must go through app_install / app_uninstall (so the App Store UI stays consistent and gateway reload actually fires) - The full browser_* MCP tool set with a standard launch → screenshot → click/type → screenshot workflow, plus the 'do not use ui_open_app(browser)' caveat (that opens the Setup panel) - The ui_*, app_*, webapp_* tools inventory for UI operations - File-system + network pointers (project dir, config path, device URLs) gateway-pre-start.sh now seeds this file as ~/.openclaw/workspace/CLAWBOX.md whenever: - The workspace dir exists (so we don't race the first gateway boot before OpenClaw has initialized it) - The shipped template differs from the on-disk copy (cmp -s), so edits the agent or user made locally aren't clobbered on every restart Also appends a one-line reference to AGENTS.md (if it exists and doesn't already mention CLAWBOX.md), so the agent's default session-start bootstrap flow naturally loads our guide. Verified on Jetson: first run seeded both files, second run logged 'skipping' for both (idempotent), syntax clean via bash -n.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 33 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new ClawBox workspace integration guide is added as documentation, along with a shell script modification that automatically seeds this guide into the workspace during gateway startup, conditionally appending references to session-start context files. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@config/clawbox-workspace-guide.md`:
- Line 54: The doc entry for the ui_open_app built-in is using the wrong Browser
Setup app ID; update the description to use the actual app ID "browser" (not
"browser-setup") so agents call ui_open_app with appId === "browser", matching
the MCP special-case that detects Browser Setup by checking appId === "browser";
ensure the table row for `ui_open_app` mentions the supported app IDs and
explicitly lists "browser" for Browser Setup to avoid mismatched calls.
- Around line 9-13: Update the doc to say the agent should check the configured
workspace value (agents.defaults.workspace) as resolved by the openclaw config
resolver (the logic in openclaw-config that reads ~/.openclaw/openclaw.json and
falls back to ~/.openclaw/workspace) rather than assuming only the default path,
and clarify that built-in npm package skills
(/home/clawbox/.npm-global/…/openclaw/skills) are still not to be checked;
explicitly mention agents.defaults.workspace and the config resolution so
readers know where the runtime path comes from.
In `@scripts/gateway-pre-start.sh`:
- Around line 178-184: The script currently hard-codes CLAWBOX_WORKSPACE and
always replaces CLAWBOX.md when sources differ, which overwrites local edits;
change it to use the resolved workspace value (the same source used by
openclaw-config.ts — i.e., use the agents.defaults.workspace resolution instead
of "/home/clawbox/.openclaw/workspace") and make seeding idempotent by only
installing CLAWBOX.md if the destination does not exist (do not copy when files
differ), ensure variables CLAWBOX_WORKSPACE, CLAWBOX_GUIDE_SRC and
CLAWBOX_GUIDE_DST remain properly quoted, and add minimal error handling around
install (check source exists and return non-zero on failure) so the script
preserves local edits and uses the canonical workspace location.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 747b7067-f91e-4167-a7b8-7a076068af54
📒 Files selected for processing (2)
config/clawbox-workspace-guide.mdscripts/gateway-pre-start.sh
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…esolve workspace, seed-if-missing Three findings on PR ID-Robots#82, all addressed: 1. CLAWBOX.md documented the ui_open_app app ID as 'browser-setup' in the tools table, but the MCP special-case in clawbox-mcp.ts checks appId === 'browser' for the Browser Setup panel. An agent following the doc literally would have passed an unknown app ID. The table entry now lists the actual built-in IDs (chat, files, settings, store, vnc, terminal, browser) and explicitly notes that 'browser' opens the Setup panel — not a real browsing session — and points back to the browser_* section for real web browsing. 2. The skills-path section and the pre-start script both hard-coded ~/.openclaw/workspace/skills/ as the answer to 'where do skills live?'. The actual source of truth is agents.defaults.workspace in openclaw.json (with a fallback to ~/.openclaw/workspace when unset), which is what getSkillsDir() on the ClawBox API side reads. Guide now describes that resolution and gateway-pre-start.sh computes the workspace via Python: reads agents.defaults.workspace, expands ~, treats relative paths as relative to ~/.openclaw, and falls back to the default on missing/invalid config. 3. CLAWBOX.md was being overwritten on every gateway start whenever its content differed from the shipped template (cmp -s check). That clobbers any local customization the user or agent has made. Switched to seed-if-missing: only write when the file doesn't exist. Operators who want to pull in an updated template can delete the on-disk copy; next gateway start re-seeds.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
14 tests had been red on beta since before the Gemma/provider-switch work in PRs ID-Robots#82/ID-Robots#83 landed. Three separate root causes: 1. Test mocks drifted from the configure route's real imports. The route now calls `applyModelOverrideToAllAgentSessions` and `parseFullyQualifiedModel` (added in ID-Robots#83 for session sweeping), plus four functions from `@/lib/llamacpp` and one from `@/lib/local-ai-runtime`. Tests mocked none of these, so the first request-time call to any of them threw and the route returned 500 — producing the "expected 200 to be 500" cascade. Added the missing mocks with real-shape implementations. 2. vitest-under-bun clears mock implementations along with call history in `vi.clearAllMocks()`. Factory defaults set inside `vi.mock(...)` survive `vi.resetModules` but not `mockClear`. Tests passed in isolation, failed in sequence. Re-apply the implementations in `beforeEach` so each test starts with a consistent mock surface. 3. The ai-models-step component test relied on `llamaCppIsActive` defaulting true, but the panel only sets it true when `currentProviderId === "llamacpp"`. Without that prop the "Gemma 4 is already configured" pill never rendered. Added the prop. Extras during simplifier pass: - Mirror real `parseFullyQualifiedModel` logic byte-for-byte (`idx <= 0 || idx === fq.length - 1`) so trailing-slash inputs reject as expected. Fixed drift in `chat-model.test.ts` too. - Extract shared proxy-URL constant via `vi.hoisted` to avoid duplicating the magic string across two mock factories. Result: 93/93 files, 1069/1069 tests pass — CI signal restored.
…90) 14 tests had been red on beta since before the Gemma/provider-switch work in PRs #82/#83 landed. Three separate root causes: 1. Test mocks drifted from the configure route's real imports. The route now calls `applyModelOverrideToAllAgentSessions` and `parseFullyQualifiedModel` (added in #83 for session sweeping), plus four functions from `@/lib/llamacpp` and one from `@/lib/local-ai-runtime`. Tests mocked none of these, so the first request-time call to any of them threw and the route returned 500 — producing the "expected 200 to be 500" cascade. Added the missing mocks with real-shape implementations. 2. vitest-under-bun clears mock implementations along with call history in `vi.clearAllMocks()`. Factory defaults set inside `vi.mock(...)` survive `vi.resetModules` but not `mockClear`. Tests passed in isolation, failed in sequence. Re-apply the implementations in `beforeEach` so each test starts with a consistent mock surface. 3. The ai-models-step component test relied on `llamaCppIsActive` defaulting true, but the panel only sets it true when `currentProviderId === "llamacpp"`. Without that prop the "Gemma 4 is already configured" pill never rendered. Added the prop. Extras during simplifier pass: - Mirror real `parseFullyQualifiedModel` logic byte-for-byte (`idx <= 0 || idx === fq.length - 1`) so trailing-slash inputs reject as expected. Fixed drift in `chat-model.test.ts` too. - Extract shared proxy-URL constant via `vi.hoisted` to avoid duplicating the magic string across two mock factories. Result: 93/93 files, 1069/1069 tests pass — CI signal restored.
Summary
The OpenClaw agent's session-start context (AGENTS.md, BOOTSTRAP.md, etc.) has no ClawBox-specific guidance. Observed failure mode earlier today: user installed
self-improving-agentvia the App Store, asked the agent to confirm — the agentread-checked/home/clawbox/.npm-global/lib/node_modules/openclaw/skills(the npm package's built-in skills dir), saw nothing, and confidently reported the skill as not installed. The skill was actually at~/.openclaw/workspace/skills/self-improving-agent/the whole time.Same class of problem applies to the desktop-Chromium integration and to skill installs:
browser_*MCP tools exist → defaults toui_open_app("browser")which opens the Setup panel, not a browsing session.app_install— which skips the App Store registration + gateway reload the user needs to see / uninstall it from the UI.What changed
New
config/clawbox-workspace-guide.mddocuments:~/.openclaw/workspace/skills/) and do NOT live (the npm-global path)app_install/app_uninstall(so the App Store UI stays consistent + gateway reload actually fires)browser_*MCP tool inventory with the standard launch → screenshot → click/type workflow, plus the "do not useui_open_app("browser")" caveatui_*/app_*/webapp_*tools inventoryscripts/gateway-pre-start.shnow seeds this file as~/.openclaw/workspace/CLAWBOX.mdwhen:cmp -s) — so later agent/user edits aren't clobbered on every restartAlso appends a one-liner reference to
AGENTS.md(when it exists and doesn't already mention CLAWBOX.md), so the agent's normal session-start bootstrap loads our guide without us having to overwrite AGENTS.md.Test plan
bash -nsyntax clean## ClawBox integrationsection pointing at CLAWBOX.mdSummary by CodeRabbit
Release Notes
Documentation
Chores