* fix(cron): record cache token counters in run telemetry
CronUsageSummary declares cache_read_tokens and cache_write_tokens, the
gateway-protocol schema and UI types accept them, and the run-history read
path normalizes them, but the single writer of CronRunTelemetry["usage"]
never assigned either field. Both values were already in scope and were
folded into the total_tokens it did write, so every cron run record
reported a total larger than input_tokens + output_tokens with no field
explaining the remainder.
Operators use run history to attribute token spend per job. Cache reads
cost roughly an order of magnitude less than fresh input tokens and the
ratio varies per job, so two jobs with identical input_tokens could differ
severalfold in real cost with nothing in the record to tell them apart.
The remainder was not a usable substitute either: the Math.max against the
provider aggregate means it is the cache buckets or a provider total, and
no field distinguished the two.
Assign both fields when nonzero, matching the adjacent total_tokens guard,
so records from providers reporting no cache usage stay byte-identical and
historical records keep parsing unchanged.
Refs #124647
* test(cron): assert cache counters in diagnostic-events usage record
This assertion pinned the pre-fix shape: the fixture reports cacheRead 7
and cacheWrite 3, and expected total_tokens 160 against input 50 +
output 100. The 10-token remainder it accepted without comment is
exactly the cache buckets, which is the accounting gap this branch
fixes. Updated to assert both counters rather than relax the toEqual,
so the record stays required to account for its own total.
* fix(cron): construct complete run usage without mutation
Co-authored-by: Koduri Mahesh Bhushan Chowdary <mkoduri73@gmail.com>
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
* feat(ui): make sidebar visibility per-tab and free Cmd-click for new tabs
Sidebar visibility was persisted in localStorage, which is shared origin-wide,
so collapsing it in one tab leaked into every other tab and window on reload.
Visibility is view state, not a preference: stop persisting it and keep it in
the tab-local navigation snapshot. Width stays persisted.
A tab whose first load targets one specific conversation now starts collapsed,
seeded once at bootstrap from the canonical session-URL contract so bare /chat
and dashboards are unaffected and SPA navigation never re-collapses. Cmd-B,
the toggle, hover-peek, and the remote UiCommand path all still work.
Cmd/Ctrl-click on a sidebar session row now falls through to the browser so
sessions open in a real new tab or window; multi-select moves to Alt/Option-
click, which previously fell through to the browser's link-download behavior.
Shift-click range selection is unchanged.
* test(ui): prove per-tab sidebar visibility at the browser boundary
Covers the two states that matter: a bare /chat first load keeps the sidebar,
and a tab opened directly on one conversation renders that conversation
full-width with the sidebar collapsed and Cmd-B restoring it. Waits on the
composer, not just the missing sidebar, so the capture cannot pass against a
blank pane.
* fix(ui): narrow new-tab sidebar collapse intent
* fix(ui): collapse sidebar for catalog sessions opened in new tabs
* test(ui): split bootstrap navigation visibility coverage
* fix(infra): detect virtiofs and 9p filesystems to prevent WAL corruption
SQLite WAL requires shared-memory/mmap coherence between processes, which
cross-VM filesystems (Docker Desktop, OrbStack, Podman host bind mounts)
cannot provide. Under sustained write pressure the host<->VM cache can
break silently, leaving zero-filled pages that corrupt the database.
Add fuse.virtiofs, virtiofs, 9p, and 9p2000.L to the rollback journal
policy so databases on these filesystems fall back to journal_mode=DELETE
instead of the unsafe WAL mode.
Closes#120549
* fix(infra): also detect virtiofs via Linux statfs magic number
The CROSS_VM_FILESYSTEM_TYPES check handles virtiofs via mountinfo
(/proc/self/mountinfo and macOS mount), but the statfs fallback in
resolvePathJournalPolicy() had no entry for virtiofs. Add
LINUX_VIRTIOFS_SUPER_MAGIC (0x6b656700) to the rollback-journal
statfs check so virtiofs databases also get journal_mode=DELETE when
the filesystem type is readable via statfs even if mountinfo parsing
is unavailable.
Extends the existing SMB/CIFS/SMB2/NFS statfs rollback test to
include virtiofs.
Closes#120549
* fix(infra): classify 9p via V9FS statfs magic + trim cross-VM comment
Address ClawSweeper P2+P3 findings:
P2: Add LINUX_V9FS_SUPER_MAGIC (0x01021997) to the statfs rollback
fallback in resolvePathJournalPolicy(). Without this, a Linux 9p
filesystem falls through to WAL when /proc/self/mountinfo is
unavailable or the mount entry cannot be parsed, defeating the
cross-VM rollback policy for 9p mounts. Add a statfs regression
case alongside the existing SMB/CIFS/SMB2/virtiofs cases.
P3: Trim the CROSS_VM_FILESYSTEM_TYPES source comment from 7 lines
to 2 lines. Keep the durable filesystem contract note; move the
issue-specific forensic narrative to the PR discussion.
* fix(infra): remove incorrect virtiofs statfs magic, keep V9FS only
Real-environment evidence showed fuse.virtiofs reports FUSE_SUPER_MAGIC
(0x65735546) in statfs, not a distinct virtiofs constant. The Linux UAPI
defines no virtiofs statfs magic matching 0x6b656700, so that branch could
never match in production and was a merge-blocking defect.
virtiofs is still fully covered by the mount-name detection path
(/proc/self/mountinfo + macOS mount), which is where the real fuse.virtiofs
evidence runs. The statfs fallback now correctly handles only 9p
(V9FS_MAGIC 0x01021997), which does have a distinct Linux statfs type.
* chore: trigger PR context check with corrected body
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
* feat(control-ui): add Cmd+/ keyboard shortcuts overview dialog
A declarative shortcut catalog (keyboard-shortcut-contract/catalog) now owns
every Control UI chord: matching, platform-aware formatting, and the new
lazy-loaded Cmd+/ (Ctrl+/ elsewhere) overview dialog all derive from it, so
the overlay cannot drift from real handler behavior. Migrates the scattered
hardcoded shortcut labels (palette, debug overlay, appearance, sidebar,
terminal, workspace) and the duplicated Apple-platform check onto the catalog,
which also makes the previously meta-only sidebar and workspace chords
reachable on non-Apple platforms. The Slash matcher keeps Latin layouts that
put another printable on the physical Slash key (German Cmd+'-' zoom) intact.
* feat(control-ui): list non-obvious shortcuts in the Cmd+/ overview
Adds the invisible-but-real shortcuts to the catalog: composer history
recall (up/down), Esc dictation cancel, new-session-page submit (follows
the same chatSendShortcut preference as chat send), image-viewer zoom
(+/-/0), and the sidebar multi-select mouse chords (mod+Click,
Shift+Click) via a display-only Click key token. Multi-combo rows now
group their chips on the right instead of spreading across the row.
* fix(control-ui): keep Ctrl+Shift+Backquote toggling the terminal
The catalog matcher's exact-Shift comparison rejected the shipped
Ctrl+Shift+` terminal chord that main's predicate accepted (Shift was
deliberately unconstrained for layouts where the Backquote key is
shifted). Backquote now joins '/' as a Shift-insensitive key, with a
regression test. Found by ClawSweeper review on #128563.
* feat(nodes): opt-in container isolation for node-hosted worker sessions
nodeHost.workerRuns.isolation=container runs each worker session inside a
Docker-compatible container (docker/OrbStack/podman): stdio launch transport,
exactly two bind mounts (bundle read-only, workspace read-write), allowlisted
env, and the container itself as the durable launch identity — created stopped
and journaled before the descriptor is delivered, killed/removed on cancel,
fence, shutdown, and recovery, with an owned-orphan sweep at startup. Missing
or changed engines disable hosting with an explicit diagnostic instead of
falling back to bare processes. Additive nullable worker_container_json column
on node_worker_launches (schema version unchanged).
* fix(test): base-shape fixture skips additive columns of stripped tables
node_worker_launches is excluded from claw-scoped state schemas, so the
read-only compat fixture cannot drop its additive column there; drop only
columns whose owning table exists.
* fix(test): guard split destructuring in base-shape fixture
* test(state): record worker_container_json in the canonical additive-column list
* fix(nodes): harden container isolation per review findings
- Revalidate the engine daemon target immediately before container creation;
a replaced daemon receives zero create/start requests (regression proves it).
- A pending launch keeps its worker slot until the journaled container is
killed/removed; cancellation cannot free capacity over a live container.
- Windows node hosts fail closed at startup for isolation=container with an
actionable diagnostic (native paths cannot be container mount targets).
- Container identity moves from an additive column to the same-version
companion table node_worker_launch_containers (bare STRICT, lazily ensured
on first container write, pruned with the launch journal): the launch table
is contract-optional and shipped readers reject additive columns there. An
exact v9 predecessor now provably opens and uses the journal after the
candidate populated container rows.
talk.config forwarded only the operator ui.seamColor, so a user-selected
ui.prefs.accent never reached the native Talk overlay; it now wins with
the same precedence the Control UI applies (regression test fails
pre-fix). The widget-theme observer now explicitly watches the <html>
style attribute that carries the inline accent override instead of
relying on incidental data-theme re-sets.
* docs(channels): scope implicitMentions overrides to the channels that read them
Only Mattermost, Slack, and Tlon call resolveChannelImplicitMentions, and they
are the only channels whose schemas accept the key. The other documented
producers pass no policy, so allowedImplicitMentionKinds stays undefined and
every produced fact counts as a mention.
* docs(channels): correct implicitMentions override wording
QQBot is a listed reply-to-bot producer with a passthrough schema, so the key
is accepted and ignored there rather than rejected. Also drops 'yet', which
implied a planned rollout while #80234 is still an open product decision.
* docs: limit implicit mention claims to bundled channels
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
The registry-owned isDispatchAuthorized gate runs after the async
pairing-lease revalidation, immediately before the invoke frame is
sent. Both node.invoke dispatch sites (raw handler and plugin-policy
transport wrapper) computed the command allowlist decision before
calling registry.invoke and only rechecked runtime approval authority
in the closure, so a config reload that revoked the command during the
lease await still dispatched it. Re-resolve the allowlist from live
runtime config inside the closure so late revocations fail closed
without dispatch.
Pins added for previously untested invariants: pairing is validated
before any policy evaluation (unpaired callers cannot probe deny
reasons), a pairing-store failure during admission or during the
registry lease recheck fails closed with UNAVAILABLE and no dispatch,
and the new closure denies dispatch after a mid-flight policy change.
Each new test was verified to fail on the pre-fix code for the
intended reason.
Assessment of Microsoft's Lobster patch 0046 via giodl73-repo/lobster-plugins-and-patches.
Failed channel turns could leave caller-owned pending group history in the next prompt. Finalize it on every terminal path, and filter Telegram rolling context while preserving explicit reply ancestry.
Co-authored-by: SunnyShu0925 <shu.zongyu@xydigit.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
formatChildResultData was the last of three identical Child result/Subagent result wrapPromptDataBlock call sites without maxEscapedChars/truncationMarker. wrapPromptDataBlockWithTag truncates to maxChars before escaping <>, so an angle-bracket-dense child result (code/XML/HTML output) could still expand the escaped block up to ~4x the intended 512-char budget. Bring this site in line with the other two, already fixed by carrier PR #119731 (agent-steering-queue.ts, internal-events.ts).
Co-authored-by: Peter Steinberger <steipete@gmail.com>
* fix(system-agent): increase setup inference probe max tokens from 32 to 128
The 32-token cap starves reasoning models that spend tokens on thinking
before emitting visible text. The probe gets a reasoning-only turn and
reports healthy local models as broken inference.
Increase to 128 tokens to accommodate reasoning model thinking overhead.
Fixes#124345
* fix(system-agent): leave reasoning room in setup probes
Co-authored-by: synthclaw <synthalorian@gmail.com>
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Node's ESM resolver runs getPackageScopeConfig() for every file: URL to pick
a module format, and each call re-materializes package.json — re-parsing
openclaw's 318-key exports map (~93µs/call, verified on Node 26.5.0). Across
the ~17k module edges of a gateway boot that costs 1.3-2.6s CPU, showing up
in profiles as package_json_reader.get (self time) or attributed inclusively
under any registered resolve hook.
Install a Module.registerHooks resolve fast path from the main-module entry
points that resolves relative "./*.js" imports inside dist/ by URL join with
format "module", skipping scope detection entirely. Behavior-identical: all
145 dist package.json files declare type module and dist contains no
CJS-syntax .js files, so Node would conclude the same format. require()
resolutions, bare specifiers, non-.js targets, out-of-dist parents, and
dist-escaping ../ chains defer to default resolution; source checkouts and
runtimes without registerHooks (Bun) are untouched.
Measured (interleaved same-dist A/B, isolated OPENCLAW_STATE_DIR, macOS,
Node 26.5.0): gateway boot user CPU 5.2s -> 2.9s, self-reported listening
time 3.3-6.6s -> stable 2.1s.