Commit Graph

30827 Commits

Author SHA1 Message Date
Peter Steinberger
aa05c5c9dd test: fix mock signatures for tsgo 2026-05-25 20:57:08 +01:00
Sebastien Tardif
36f269d60b docs: document fail-closed behavior for rejected modelPatterns
Add inline comment explaining that compileSafeRegex rejects patterns
with nested repetition (ReDoS risk) and returns null. Rejected patterns
are silently skipped; the plugin will not match via that pattern but
other patterns and prefixes still apply.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-25 20:57:04 +01:00
Sebastien Tardif
117e08240b fix(security): guard plugin modelPatterns with compileSafeRegex
Replace raw `new RegExp(patternSource, "u")` in
`resolveModelSupportMatchKind` with the existing
`compileSafeRegex()` guard from `src/security/safe-regex.ts`.

A malicious or careless plugin manifest pattern like `(a+)+$`
causes catastrophic backtracking (ReDoS) against non-matching model
IDs. `compileSafeRegex` detects nested repetition and returns null,
which the caller now treats as a non-match (equivalent to the
previous catch-continue for invalid regex).

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-25 20:57:04 +01:00
Sebastien Tardif
9a6c16130a style: use bracket notation for __openclaw to satisfy no-underscore-dangle
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-25 20:57:01 +01:00
Sebastien Tardif
aff8e644fc test: tighten oversized metadata assertion to check exact id in __openclaw
Replace string containment check with direct field assertions:
- oversized.role is 'assistant'
- __openclaw.id is 'oversized-child' (exact match)
- parentId extraction proven by record inclusion in active tree

5/5 oversized transcript tests pass.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-25 20:57:01 +01:00
Sebastien Tardif
fe8d99d421 fix(security): escape field names in transcript regex extraction
extractJsonStringFieldPrefix and extractJsonNullableStringFieldPrefix
interpolate the `field` parameter into `new RegExp(...)` without
escaping.  All current callers pass hardcoded strings ("id",
"parentId", "type", "role"), but the function signature accepts
any string.  A future caller passing a field containing regex
metacharacters (e.g. "foo.bar") would match unintended patterns.

Wrap the interpolation with escapeRegExp() from src/shared/regexp.ts
so metacharacters are treated literally.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-25 20:57:01 +01:00
Peter Steinberger
78a1e7dfe6 fix(logging): keep string failure codes on EPIPE 2026-05-25 20:56:56 +01:00
Peter Steinberger
623a60a2b7 fix(logging): preserve failure exit on EPIPE 2026-05-25 20:56:56 +01:00
Pavel Zakharov
2aa5f1771f fix(logging): exit on stdout/stderr EPIPE instead of spinning
When the gateway process is orphaned after a systemd service restart,
the parent's journal pipe closes and every write to stdout/stderr returns
EPIPE. The previous handler swallowed it with a bare return, so background
loops (config file watcher, etc.) kept firing and the process spun at
100% CPU indefinitely.

Exit cleanly with code 0 instead — a process whose own output streams
are broken has nowhere to log and no reason to keep running.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 20:56:56 +01:00
Peter Steinberger
c88f660258 test(gateway): pin live gateway models to pi runtime 2026-05-25 20:37:33 +01:00
Peter Steinberger
a0023fbfa0 perf: speed up local TUI startup 2026-05-25 20:30:00 +01:00
Peter Steinberger
d0ab0d9922 refactor: share realtime voice activation helpers (#86615) 2026-05-25 20:25:17 +01:00
Peter Steinberger
f00a912c25 fix: tighten Discord voice wake matching (#86595)
* fix: tighten Discord voice wake matching

* test: avoid wildcard model runtime normalization
2026-05-25 19:51:32 +01:00
Peter Steinberger
baab4cf045 refactor(logging): share diagnostic message lifecycle
Refactor diagnostic queued/state/processed emission into a shared helper used by dispatch and isolated cron turns.

Preserve dispatch processed-event behavior, cron queue-depth symmetry, and final cron session-id adoption while adding focused helper coverage and reviewer comments for the non-obvious invariants.
2026-05-25 19:48:45 +01:00
Vincent Koc
e844d1d6e5 fix(cron): restore suspended lanes to default concurrency 2026-05-25 20:39:37 +02:00
Dallin Romney
a61d5308b5 fix(auth): emit one-shot doctor-pointer warning for Keychain-only legacy Codex OAuth profiles (#86220) 2026-05-25 11:39:32 -07:00
Peter Steinberger
9b9d8970b0 fix(codex): recover stale preflight bindings (#86602)
Fixes #86211.
Recreates the focused recovery from #86216 with maintainer-side tests.

Co-authored-by: Paul Frederiksen <paul@paulfrederiksen.com>
2026-05-25 19:37:49 +01:00
Peter Steinberger
8351556059 test(cron): pin sequential duration regression 2026-05-25 19:23:47 +01:00
IWhatsskill
985bc934a1 fix(cron): canonicalize preserved row ids 2026-05-25 19:23:47 +01:00
IWhatsskill
c916906584 fix(cron): preserve unsupported payload rows on writes 2026-05-25 19:23:47 +01:00
brokemac79
1e188bcda9 fix(status): prefer active OAuth for runtime aliases
Prefer the active Claude CLI OAuth auth label when the configured Anthropic model resolves through an equivalent Claude CLI runtime alias, so `/status` no longer reports an unused env API-key label.

Also adds regression coverage for both text and message status renderers, plus the maintainer changelog entry.

Closes #80184.

Co-authored-by: brokemac79 <martin_cleary@yahoo.co.uk>
2026-05-25 19:19:51 +01:00
Sebastien Tardif
915c820c38 fix(google): stop appending preview to flash lite
Normalize Google Gemini 3.1 Flash Lite routing to the GA model id and keep the retired preview spelling as a compatibility alias. Align default alias docs, FAQ guidance, and deprecated-model manifest recommendations with the GA id.

Fixes #86151.

Co-authored-by: Sebastien Tardif <sebtardif@ncf.ca>
2026-05-25 19:12:36 +01:00
Peter Steinberger
baf469f02e fix(agents): notify stale cron media failures 2026-05-25 19:04:03 +01:00
Peter Steinberger
f01b2a8eab fix(agents): deliver stale cron media completions 2026-05-25 19:04:03 +01:00
ai-hpc
f5d2db2a60 fix(agents): keep cron media completions run-scoped 2026-05-25 19:04:03 +01:00
tianxiaochannel-oss88
9445960d9d guide workspace-only scratch paths 2026-05-25 19:03:57 +01:00
Peter Steinberger
207a5a2983 fix(cron): report rotated session in final diagnostics 2026-05-25 19:03:50 +01:00
Arnab Saha
48532227d5 fix(cron): gate lifecycle diagnostic events behind isDiagnosticsEnabled
Address clawsweeper P2: cron isolated-agent lifecycle (message.queued,
session.state, message.processed) now mirrors the dispatch path and
respects the diagnostics.enabled master toggle. Added regression test
for the disabled-config path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 19:03:50 +01:00
Arnab Saha
804a31ec5c fix(cron): address review — drop unsupported taskLabel, pair with session.state lifecycle, add regression test + changelog 2026-05-25 19:03:50 +01:00
Arnab Saha
6ccd4e72f0 fix(cron): emit message.queued/processed for isolated-agent turns 2026-05-25 19:03:50 +01:00
haoxingjun
b5ada806dd fix: hydrate current turn image attachments 2026-05-25 19:03:43 +01:00
YUHAO-corn
177ebdc24c fix(gateway): ignore inherited launchd env for respawn 2026-05-25 19:03:37 +01:00
Peter Steinberger
bc12e04993 fix: raise default cron concurrency 2026-05-25 18:59:26 +01:00
liaoyl830
6e8d2dbbbc fix(doctor): skip restart prompt when gateway is healthy after recent restart (#86533)
* fix(doctor): skip restart prompt when gateway is healthy after recent restart

`openclaw doctor` unconditionally prompted "Restart gateway service now?"
with default=Yes whenever the gateway was running, even if it had just
restarted via SIGUSR1 after an update. This caused restart loops on macOS
where the prompt raced with launchctl KeepAlive.

Changes:
- Probe gateway health before the restart prompt when a restart handoff
  exists (deep doctor mode). If healthy, skip the prompt entirely.
- Change `initialValue` from `true` to `false` as a safety net so users
  don't accidentally confirm a restart by pressing Enter.
- Update existing test that expected a single `readGatewayRestartHandoffSync`
  call (now called twice: diagnostic display + health-probe check).

Fixes #86518

* fix(doctor): correct GatewayRestartHandoff mock types in tests

Add explicit literal types + satisfies constraint so the mock handoff
objects match the exact GatewayRestartHandoff type expected by the
type-check CI.

* fix(doctor): apply recent-restart skip to normal doctor flow

* test(doctor): align normal-flow handoff expectation

* chore: add doctor restart prompt changelog

---------

Co-authored-by: OpenClaw Contributor <openclaw-contributor@example.com>
Co-authored-by: liaoyl830 <267396060+liaoyl830@users.noreply.github.com>
Co-authored-by: sallyom <somalley@redhat.com>
2026-05-25 13:53:28 -04:00
brokemac79
8129dba5d8 fix: emit agent.send lifecycle hooks on rotation (#85875)
* fix: emit agent send lifecycle hooks

* fix(gateway): align agent send session lifecycle hooks

* fix(gateway): emit agent lifecycle before validation exits

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-25 18:51:13 +01:00
Peter Steinberger
822ee62947 fix: tighten openshell exec preflight 2026-05-25 18:36:55 +01:00
brokemac79
aafed830a5 fix: preflight malformed openshell exec commands 2026-05-25 18:36:55 +01:00
NVIDIAN
8061d66713 fix(update): allow package-manager hardlinks in swaps
Allow package-manager-managed hardlinked package roots during update/install swaps while keeping generic plugin, hook, and dependency-free install moves fail-closed.

Fixes #85559.

Co-authored-by: ai-hpc <mail.speedy.hpc@hotmail.com>
2026-05-25 18:30:49 +01:00
Sally O'Malley
bd65b4232a fix(security): audit Claude permission overrides under YOLO (#86557)
* fix(agents): warn on Claude permission overrides under YOLO

* fix: narrow Claude audit backend guard

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-25 18:18:51 +01:00
Peter Steinberger
5ae91f01fa fix: speed up Discord voice wake consults 2026-05-25 18:09:16 +01:00
Jason (Json)
5cfa577778 Recover Codex context overflow prompt errors (#85542)
* fix: recover codex context overflow prompt errors

* test: align Codex overflow prompt proof

* test: satisfy manifest registry mock contract

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-25 17:44:48 +01:00
FullerStackDev
d5b0174eb1 fix(agents): derive overflow budgets from provider errors 2026-05-25 17:35:47 +01:00
Peter Steinberger
313762282c fix(plugins): only memoize complete metadata snapshots 2026-05-25 17:29:46 +01:00
Jason (Json)
1b64ccbfff fix: fallback after active media wake failure (#85489)
* fix: fallback after active media wake failure

* docs: clarify generated media fallback docs
2026-05-25 17:23:20 +01:00
Peter Steinberger
159e4406ab perf(plugins): reuse derived metadata snapshots 2026-05-25 17:20:39 +01:00
Gio Della-Libera
657b246e56 test(agents): preserve provider hook mock exports (#86523) 2026-05-25 08:45:37 -07:00
Gio Della-Libera
dc17412c3a Doctor: expose shell completion health findings (#85566)
* feat(doctor): expose shell completion health findings

* fix(doctor): keep shell completion lint informational
2026-05-25 08:39:41 -07:00
Sally O'Malley
f0b6f70053 fix(agents): honor effective exec policy for Claude live Bash (#86330)
* fix(agents): answer Claude live control_request can_use_tool via exec policy

Claude CLI emits stream-json control_request frames with subtype
can_use_tool when it wants to use a native tool. The Claude live-session
bridge previously dropped these frames, leaving Claude waiting for a
control_response until the 180/600s no-output timeout fired (see #80819).

Resolve the effective OpenClaw exec policy (per-agent tools.exec -> global
tools.exec -> allowlist/on-miss defaults) once at session-start time and
thread it through fingerprinting and the session record. When a
can_use_tool request arrives:

- Allow native Bash when the resolved policy is security=full, ask=off
  (matching the bypassPermissions semantics OpenClaw already documents).
- Otherwise deny with a message that names the resolved policy and
  points the agent at OpenClaw MCP tools.

Unsupported control_request subtypes get a structured error response
instead of a silent no-op, and stray control_response frames are
silently dropped. Adds spawn-test coverage for both allow and deny paths.

Fixes #80819

* fix(agents): align Claude live control_request policy with backend defaults

Resolve the effective exec policy through the same defaults that
extensions/anthropic/cli-shared.ts:isOpenClawRequestedYolo and
src/agents/exec-defaults.ts:resolveExecDefaults already use (security
?? "full", ask ?? "off") instead of falling back to a hand-rolled
allowlist/on-miss default that disagreed with the rest of the codebase.
Without this, a default-config OpenClaw deployment launches Claude with
--permission-mode bypassPermissions but the bridge would still deny
Bash control_requests, re-creating the #80819 stall for the very
default-config case the issue reports.

Also thread the effective Claude permission mode into the policy
decision. Prefer the operator's explicit --permission-mode in argv,
falling back to what normalizeClaudePermissionArgs would have inserted
for an un-overridden launch. Native Bash is auto-allowed only when the
effective mode is bypassPermissions AND tools.exec resolves to
full/no-ask, so explicit raw-arg overrides like --permission-mode
default or acceptEdits broaden Claude's native prompting and are
honored by routing through deny.

Adds a no-config regression test (default deployment allows Bash, no
stall) and a permission-mode-override test (tools.exec full/off plus
explicit --permission-mode default in raw args denies). Existing
allow/deny tests continue to pass via the synthesized-mode fallback.

* fix(agents): honor effective exec policy for Claude live Bash

---------

Co-authored-by: Guillaume Thirry <g.thirry@gmail.com>
2026-05-25 11:39:17 -04:00
Vincent Koc
99997e4441 fix(test): stabilize e2e runtime imports 2026-05-25 17:35:26 +02:00
Peter Steinberger
69d728ac4f perf: cache plugin package realpaths (#86517) 2026-05-25 16:26:36 +01:00