fix(kiloclaw): resolve kilo-chat attachments against the agent working dir#4381
fix(kiloclaw): resolve kilo-chat attachments against the agent working dir#4381iscekic wants to merge 5 commits into
Conversation
…the screen PermissionCard rendered patterns/metadata (often a full command) in plain Views with no height limit. As a pinned footer below the message list it could grow past the screen, pushing the Deny/Allow buttons off-screen with no way to scroll — approvals became impossible to act on. Wrap the card body in a ScrollView capped at max-h-96 (same pattern as QuestionCard) and let both cards shrink when the available height is smaller (e.g. keyboard open on small screens), keeping the action buttons pinned and reachable while the content scrolls.
…n modal Tables previously rendered inside a horizontal ScrollView within the message bubble, which caused two Android-reported bugs: - Scrolling the table leftward activated the bubble's swipe-to-reply pan gesture (12px activation offset), making tables with more than 2 columns unusable. - A horizontal ScrollView inside a width-constrained bubble mis-measures its height on RN Fabric (same bug already worked around for code blocks), producing overlapping messages in the FlashList. Tables now render as a compact 'View table' chip inline; tapping it opens a full-screen modal where the table scrolls both ways with roomier columns. No horizontal ScrollView ever renders inside a bubble anymore. Applies to both kiloclaw chat and cloud agents chat via the shared MarkdownText renderer.
…g dir OpenClaw resolves the media workspace to ~/.openclaw/workspace and gates local attachment paths to its own local roots. The kiloclaw agent works in /root/clawd (process cwd), which is neither — so a generated file (e.g. a markdown report) could not be attached: relative filePaths resolved into the wrong directory (file not found) and absolute paths under /root/clawd were rejected by local-roots gating whenever host fs read was restricted. Resolve agent-relative paths against the process cwd (falling back to the OpenClaw workspace) and append the cwd to the allowed local roots passed to the OpenClaw media loader. Also hint the model toward absolute paths for upload-file, whose buffer is hydrated by OpenClaw core before the plugin can fix up the path.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe previously flagged Files Reviewed (2 files)
Previous Review Summary (commit 53128a7)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 53128a7)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryA narrow filename-classification edge case in the new Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (3 files)
Note: this PR's branch also contains two Reviewed by claude-sonnet-5-20260630 · Input: 32 · Output: 7K · Cached: 901.6K Review guidance: REVIEW.md from base branch |
Problem
A user asked the KiloClaw agent for a markdown report and the agent could not attach the file to any message.
The attachment pipeline (plugin → kilo-chat backend → mobile) is fully implemented; the failure is a workspace mismatch in the sandbox:
/root/clawd(bootstrap.tschdirs there) and tells it so in prompts.openclaw.jsonnever setsagents.defaults.workspace, so OpenClaw's outbound-media machinery resolves the agent workspace to its default~/.openclaw/workspace, with allowed local media roots/tmp/openclaw+~/.openclaw/{media,canvas,workspace,sandboxes}./root/clawdis in neither.Verified by executing the deployed
openclaw@2026.6.11with kiloclaw's config shape, for areport.mdwritten in the agent's cwd:filePath: "report.md"(relative)Local media file not found: /root/.openclaw/workspace/report.md/root/clawd/report.mdreadFileskips root checksLocal media path is not under an allowed directorySo attaching only worked when the model happened to pass an absolute path and fs read was allowed — flaky in exactly the way users report.
Fix (contained to the kiloclaw-owned plugin)
In
media-delivery.ts:loadOutboundMediaFromUrl, so absolute paths under/root/clawdpass root gating even without hostreadFile.In
channel.ts: hint the model toward absolute paths forupload-file— that action's buffer is hydrated by OpenClaw core (with OpenClaw's own workspace notion) before the plugin runs, so the plugin cannot fix relative paths there.send+filePath(the recommended route for generated text files) is fully plugin-handled and now works with either path form.An alternative was setting
agents.defaults.workspace = '/root/clawd'inconfig-writer.ts, but OpenClaw loadsIDENTITY.md/TOOLS.md/mcporter from its workspace and kiloclaw deliberately seeds those into~/.openclaw/workspace, so repointing it has wider blast radius.Tests
Two regression tests mirroring the reproduced failure modes (relative path from agent cwd; absolute path outside configured roots without
readFile, exercising the real OpenClaw loader). Both fail onmainand pass with the fix; full plugin suite: 200/200.Note: existing machines pick up the fix on their next restart/redeploy (image update).