Skip to content

fix(gateway): pass process.env in status command probe auth to resolv…#52513

Merged
steipete merged 6 commits intoopenclaw:mainfrom
CodeForgeNet:fix/status-gateway-secretref-env-resolution
Mar 23, 2026
Merged

fix(gateway): pass process.env in status command probe auth to resolv…#52513
steipete merged 6 commits intoopenclaw:mainfrom
CodeForgeNet:fix/status-gateway-secretref-env-resolution

Conversation

@CodeForgeNet
Copy link
Copy Markdown
Contributor

@CodeForgeNet CodeForgeNet commented Mar 22, 2026

Fixes #52360
Related: #38973, #39415, #46014, #49730


resolveGatewayProbeAuthSafe takes an optional env param. When called
from status-all.ts without it, the credential chain fell back to an empty
object -- so OPENCLAW_GATEWAY_TOKEN was never found, even when the token
was sitting right there in the shell environment and confirmed clean by
openclaw secrets audit.

The runtime has always used process.env directly. The status command path
didn't. That gap is what caused the false-negative.

Three changes:

  1. buildGatewayProbeCredentialPolicy now defaults env to process.env
    when not passed -- future callers that omit it won't silently break.
  2. status-all.ts passes env: process.env explicitly to both probe auth
    calls.
  3. Regression test added: calls resolveGatewayProbeAuthSafe without env,
    sets the token in process.env, and asserts it resolves without a warning.

The related issues above (Telegram botToken, loopback probe identity,
openclaw message send SecretRef failures) all share this same root cause --
missing env propagation. Not separate bugs.


Summary

  • Problem: openclaw status reported gateway.auth.token SecretRef is unresolved even when the gateway was healthy and the env variable was
    present. openclaw gateway status showed the gateway as reachable.
  • Why it matters: Operators running health checks or scripts reading
    openclaw status --json got misleading auth failure output. Operational
    trust in the status surface broke.
  • What changed: env propagated through the credential policy builder;
    status-all.ts passes process.env explicitly. One regression test added.
  • What did NOT change: Runtime credential resolution, gateway auth
    behavior, token precedence logic, config shape. Nothing changes for users
    with a plain-text token (non-SecretRef).

Change Type

  • Bug fix

Scope

  • Gateway / orchestration
  • Auth / tokens

Linked Issue/PR


User-visible / Behavior Changes

openclaw status and openclaw status --json no longer report a
false-negative gateway auth failure when gateway.auth.token is configured
as an env-backed SecretRef. Output now matches what openclaw gateway status
already showed.


Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? Yes -- env-backed SecretRef tokens now
    resolve in the status command path where they previously did not.
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

No new token exposure. The fix makes the status probe read from process.env
the same way the runtime already does. No tokens are logged or transmitted
differently.


Repro + Verification

Environment

  • OS: macOS arm64
  • OpenClaw: 2026.3.13
  • Gateway mode: local / loopback
  • Auth mode: token, source: env

Steps

  1. Set gateway.auth.token as an env SecretRef pointing to
    OPENCLAW_GATEWAY_TOKEN
  2. Export the token in your shell or put it in ~/.openclaw/.env
  3. Run openclaw gateway status -- reports healthy
  4. Run openclaw status -- before this fix: false-negative auth failure.
    After: resolves correctly.

Expected

openclaw status resolves the SecretRef and probes the gateway successfully.

Actual (before fix)

connect failed: gateway.auth.token SecretRef is unresolved in this command
path; probing without configured auth credentials.

Evidence

  • Regression test: probe-auth.test.ts -- calls
    resolveGatewayProbeAuthSafe without env, verifies token resolves from
    process.env with no warning.

Human Verification

  • Traced the full credential resolution chain from status-all.ts through
    buildGatewayProbeCredentialPolicy to resolveGatewayCredentialsFromConfig
  • Confirmed env ?? {} was the actual fallback before the fix
  • Confirmed status.gateway-probe.ts already passed process.env (not
    affected by this PR)
  • Did not verify on Windows or with remote gateway mode -- SecretRef behavior
    there is a separate path

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery

  • Revert: git revert on this commit -- self-contained, one logical change
  • Files to restore: src/gateway/probe-auth.ts,
    src/commands/status-all.ts
  • Watch for: status command now showing a token warning that was previously
    hidden -- would mean a genuinely unresolved ref that was masked before

Risks and Mitigations

  • Risk: process.env fallback in buildGatewayProbeCredentialPolicy could
    expose env vars in contexts where callers intentionally pass an isolated env.
    • Mitigation: The fallback only triggers when env is undefined -- not
      when an empty object is passed explicitly. Tests that pass
      {} as NodeJS.ProcessEnv are unaffected. Existing tests confirmed
      passing.

@CodeForgeNet CodeForgeNet requested a review from a team as a code owner March 22, 2026 23:25
@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime commands Command implementations size: S labels Mar 22, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 22, 2026

Greptile Summary

This PR fixes a false-negative auth failure in openclaw status where gateway.auth.token configured as an env-backed SecretRef was never resolved because buildGatewayProbeCredentialPolicy fell back to an empty object instead of process.env when env was omitted.

Changes:

  • src/gateway/probe-auth.tsenv: params.env ?? process.env ensures the credential policy always resolves against the live environment when a caller omits env. Callers that explicitly pass {} are unaffected.
  • src/commands/status-all.ts — Both resolveGatewayProbeAuthSafe call-sites now explicitly pass env: process.env, making intent clear and consistent with the rest of the codebase.
  • src/gateway/probe-auth.test.ts — Regression test that omits env, sets the token in process.env, and asserts resolution succeeds without a warning. The finally block correctly restores the original env var value to avoid test pollution.

Confidence Score: 5/5

  • This PR is safe to merge — the fix is minimal, backward-compatible, and directly resolves the described bug.
  • Three focused changes: a one-line nullish-coalescing fallback in buildGatewayProbeCredentialPolicy, two explicit env: process.env arguments in status-all.ts, and a well-structured regression test. No logic is restructured, no new network paths are opened, and existing tests that pass {} explicitly continue to exercise the "unresolved" warning path as intended. The PR description is thorough and the mitigation for the only stated risk (explicit {} callers) is correctly handled by ?? vs ||.
  • No files require special attention.

Reviews (1): Last reviewed commit: "fix(gateway): pass process.env in status..." | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4395487eaf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

config: params.cfg,
cfg: params.cfg,
env: params.env,
env: params.env ?? process.env,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge This env fallback is a no-op and leaves the status bug unfixed

The new process.env default here does not change the status probe path: resolveGatewayProbeCredentialsFromConfig() already does const env = params.env ?? process.env in src/gateway/credentials.ts, and resolveGatewayCredentialsWithSecretInputs() already does the same in src/gateway/call.ts. That means the added env: process.env calls in src/commands/status-all.ts and the new regression test would both behave the same on the parent commit, so if openclaw status is still hitting the unresolved SecretRef case, this patch does not actually fix it.

Useful? React with 👍 / 👎.

@CodeForgeNet CodeForgeNet force-pushed the fix/status-gateway-secretref-env-resolution branch from 4395487 to 9942e14 Compare March 22, 2026 23:43
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9942e14fb5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +127 to +131
const localProbeAuthResolution = await resolveGatewayProbeAuthSafeWithSecretInputs({
cfg,
mode: "local",
env: process.env,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid resolving unused probe-auth secret inputs

When gateway.mode=local, or when remote mode is falling back because gateway.remote.url is missing, this await (together with the adjacent remote await) still resolves the unused credential set before line 137 decides which auth to keep. The new resolveGatewayProbeAuthSafeWithSecretInputs() path can execute file/exec secret providers and propagate provider failures from resolveGatewayCredentialsWithSecretInputs(), so a stale gateway.remote.* or gateway.auth.* SecretRef can now abort status --all even though the selected probe auth would not use it. Please only resolve the branch selected by isRemoteMode && !remoteUrlMissing.

Useful? React with 👍 / 👎.

@CodeForgeNet CodeForgeNet force-pushed the fix/status-gateway-secretref-env-resolution branch from 9942e14 to a9bdf78 Compare March 22, 2026 23:50
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9bdf78ae2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +127 to +136
const localProbeAuthResolution = await resolveGatewayProbeAuthSafeWithSecretInputs({
cfg,
mode: "local",
env: process.env,
});
const remoteProbeAuthResolution = await resolveGatewayProbeAuthSafeWithSecretInputs({
cfg,
mode: "remote",
env: process.env,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the default status probe path as well

This only fixes status --all. The normal openclaw status and openclaw status --json flow still goes through src/commands/status.scan.shared.ts:69 into src/commands/status.gateway-probe.ts:12-16, which still calls the synchronous resolveGatewayProbeAuthSafe path and never resolves env/file/exec SecretRefs. In the same env-backed gateway.auth.token setup described in the PR, users will keep seeing the false-negative auth warning on the primary status surfaces even after this commit lands.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle bot added the channel: discord Channel integration: discord label Mar 23, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4532d7a4f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const localProbeAuthResolution = await resolveGatewayProbeAuthSafeWithSecretInputs({
cfg,
mode: "local",
env: process.env,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Probe against the gateway runtime env, not process.env

When the gateway is running as a managed service and OPENCLAW_GATEWAY_TOKEN lives only in that service environment—or the caller shell still has a stale value—this now resolves the SecretRef from the interactive process.env and can probe with the wrong credentials. We already handle the service-runtime case in src/cli/daemon-cli/status.gather.ts:369-372 by using the merged daemon environment, so openclaw status --all will still report a misleading auth failure on otherwise healthy launchd/systemd installs.

Useful? React with 👍 / 👎.

Comment on lines +77 to +78
if (!isGatewaySecretRefUnavailableError(error)) {
throw error;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Downgrade empty secret values to a probe warning

If an env/file/exec SecretRef resolves successfully but yields an empty value, resolveGatewaySecretInputString() throws a plain Error (src/gateway/call.ts:334-336) instead of GatewaySecretRefUnavailableError. This helper only swallows the latter, so openclaw status --all now aborts instead of falling back to an unauthenticated probe with a warning; a blank OPENCLAW_GATEWAY_TOKEN or empty secret file is enough to trigger it.

Useful? React with 👍 / 👎.

@CodeForgeNet CodeForgeNet force-pushed the fix/status-gateway-secretref-env-resolution branch from f4532d7 to 58855c7 Compare March 23, 2026 00:08
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 031b4efc32

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +5 to 18
export async function resolveGatewayProbeAuthResolution(
cfg: ReturnType<typeof loadConfig>,
): Promise<{
auth: {
token?: string;
password?: string;
};
warning?: string;
} {
return resolveGatewayProbeAuthSafe({
}> {
return resolveGatewayProbeAuthSafeWithSecretInputs({
cfg,
mode: cfg.gateway?.mode === "remote" ? "remote" : "local",
env: process.env,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update sync callers before making probe auth async

Making resolveGatewayProbeAuthResolution() asynchronous here breaks the shared status scan, which still treats it as a plain object in src/commands/status.scan.shared.ts:69-92 and immediately reads .warning/.auth before calling probeGateway(). On the normal openclaw status / status --json paths this means the probe no longer receives the configured credentials (it sees undefined instead), so auth-backed gateways will be reported as unreachable even though they are healthy.

Useful? React with 👍 / 👎.

steipete added a commit to CodeForgeNet/openclaw that referenced this pull request Mar 23, 2026
steipete added a commit to CodeForgeNet/openclaw that referenced this pull request Mar 23, 2026
@steipete steipete force-pushed the fix/status-gateway-secretref-env-resolution branch from 26bc81f to 45827f3 Compare March 23, 2026 02:09
@openclaw-barnacle openclaw-barnacle bot added size: M and removed channel: discord Channel integration: discord size: S labels Mar 23, 2026
CodeForgeNet and others added 6 commits March 23, 2026 02:10
…e SecretRef

Fixes openclaw#52360

resolveGatewayProbeAuthSafe was called from status-all.ts without an
env argument, causing the credential resolution chain to fall back to
an empty object instead of process.env. This made env-backed SecretRef
tokens (gateway.auth.token, Telegram botToken, etc.) appear unresolved
in the status command path even when the runtime was healthy.

Added process.env as default fallback in buildGatewayProbeCredentialPolicy
and passed env explicitly from status-all.ts callers.

Related: openclaw#33070, openclaw#38973, openclaw#39415, openclaw#46014, openclaw#49730
…atus path

Address two Codex P1/P2 issues:

1. (P1) Plain 'openclaw status' and 'openclaw status --json' still went
   through the sync resolveGatewayProbeAuthSafe path in
   status.gateway-probe.ts, which cannot expand SecretRef objects.
   Switched to async resolveGatewayProbeAuthSafeWithSecretInputs.

2. (P2) status-all.ts was eagerly resolving both local and remote probe
   auth before deciding which to use. A stale SecretRef in the unused
   branch could abort the command. Collapsed to a single resolution
   call using the correct mode upfront.

Updated status.scan.test.ts to use mockResolvedValue since
resolveGatewayProbeAuthResolution is now async.
Function is now async after switching to resolveGatewayProbeAuthSafeWithSecretInputs.
Missing await caused TS error: Property 'auth' does not exist on type 'Promise<...>'.
@steipete steipete force-pushed the fix/status-gateway-secretref-env-resolution branch from 45827f3 to 9adbca2 Compare March 23, 2026 02:14
@openclaw-barnacle openclaw-barnacle bot added channel: msteams Channel integration: msteams size: S and removed size: M labels Mar 23, 2026
@steipete steipete merged commit 339a672 into openclaw:main Mar 23, 2026
12 checks passed
@steipete
Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm check && pnpm build && pnpm test
  • Land commit: 9adbca2
  • Merge commit: $(gh pr view 52513 --json mergeCommit --jq '.mergeCommit.oid')

Thanks @CodeForgeNet!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9adbca2bce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +69 to 71
const gatewayProbeAuthResolution = await resolveGatewayProbeAuthResolution(params.cfg);
let gatewayProbeAuthWarning = gatewayProbeAuthResolution.warning;
const gatewayProbe = remoteUrlMissing
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip probe auth resolution when the gateway probe is skipped

When gateway.mode=remote but gateway.remote.url is unset, or when resolveGatewayProbeSnapshot() is called with skipProbe, this new await resolveGatewayProbeAuthResolution(params.cfg) still runs before line 71 short-circuits to gatewayProbe = null. Because src/commands/status.gateway-probe.ts now resolves secret inputs asynchronously, an unused gateway.remote.*/gateway.auth.* file or exec SecretRef can now fail openclaw status and openclaw status --json even though those paths never attempt a probe. Please gate auth resolution behind the same remoteUrlMissing/skipProbe check.

Useful? React with 👍 / 👎.

frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
frankekn pushed a commit to artwalker/openclaw that referenced this pull request Mar 23, 2026
@CodeForgeNet CodeForgeNet deleted the fix/status-gateway-secretref-env-resolution branch March 23, 2026 09:14
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
furaul pushed a commit to furaul/openclaw that referenced this pull request Mar 24, 2026
Interstellar-code pushed a commit to Interstellar-code/operator1 that referenced this pull request Mar 24, 2026
npmisantosh pushed a commit to npmisantosh/openclaw that referenced this pull request Mar 25, 2026
npmisantosh pushed a commit to npmisantosh/openclaw that referenced this pull request Mar 25, 2026
npmisantosh pushed a commit to npmisantosh/openclaw that referenced this pull request Mar 25, 2026
PotatoParser added a commit to Lilac-Labs/openclaw that referenced this pull request Mar 26, 2026
* fix(delivery-queue): increment retryCount on deferred entries when time budget exceeded

When delivery recovery ran out of the 60s time budget, remaining pending
entries were silently deferred to the next restart with no retryCount
increment. This caused them to loop forever across restarts, never hitting
MAX_RETRIES and never moving to failed/.

Fix: call failDelivery() on each remaining entry before breaking out of
the recovery loop (both the deadline check and the backoff-exceeds-deadline
check). This increments retryCount so that entries eventually exhaust
MAX_RETRIES and are permanently skipped.

Fixes openclaw#24353

* fix(delivery-queue): break immediately on deadline instead of failing all remaining entries

P1-C: After now >= deadline, the old code would iterate all remaining queue
entries and call failDelivery() on each — O(n) work that nullified the
maxRecoveryMs wall-clock cap on large queues.

Fix: break out of the recovery loop immediately when the deadline is exceeded.
Remaining entries are picked up on next startup unchanged (retryCount not
incremented). The deadline means 'stop here', not 'fail everything remaining'.

* fix(delivery-queue): align test assertion and JSDoc with 'next startup' log message

* fix(browser): add ChildProcessWithoutNullStreams cast for @types/node compat

The stdio tuple overload resolves differently across @types/node versions
(v20 vs v24/v25). Cast the spawn() result to ChildProcessWithoutNullStreams
to ensure proc.stderr?.on/off type-checks regardless of installed @types/node.

* test(delivery-queue): align test assertion with 'next startup' log message

* fix(delivery-queue): increment retryCount on deadline-deferred entries

Codex P1: entries deferred by the recovery time budget kept retryCount=0
forever, so they could loop across restarts without ever reaching MAX_RETRIES.

After breaking on deadline, call failDelivery() for all remaining entries
so retryCount is incremented. Entries stay in queue until MAX_RETRIES is
reached and they are pruned normally.

Also updates the maxRecoveryMs test to assert retryCount=1 on deferred entries.

* fix(ci): restore delivery queue branch checks

* fix(plugins): make metadata generator formatter portable

* fix(image): deprecate legacy skill and clarify auth

* docs(image): remove duplicate typical values bullet

* fix: harden image auth env lookups (openclaw#52552) (thanks @vincentkoc)

* test(mattermost): cover directory discovery

* test(msteams): cover store and live directory helpers

* fix(mattermost): honor replyToMode off for threaded messages

* perf(reply): lazy-load runner execution and memory

* fix(plugins): remove metadata generator conflict markers

* test(nextcloud-talk): cover inbound behavior branches

* test(irc): cover inbound behavior branches

* test: slim outbound test import graphs

* perf: remove remaining unit thread pins

* perf(reply): lazy-load usage cost resolution

* test(googlechat): cover security normalization

* perf(reply): lazy-load context token lookup

* style(format): fix extension test drift

* test: centralize cli runtime capture helpers

* refactor: reuse shared cli runtime test mocks

* fix: restore bundled plugin metadata generator

* fix(telegram): add allow_sending_without_reply to prevent lost messages

When a Telegram message that OpenClaw is replying to gets deleted before
delivery, the Telegram API rejects the entire sendMessage call with
"message to be replied not found". This causes the bot's response to be
silently lost and stuck in the failed delivery queue permanently.

Setting allow_sending_without_reply: true tells Telegram to deliver the
message as a standalone message if the reply target no longer exists,
instead of failing the entire request.

Applied to all 6 locations across 4 source files where
reply_to_message_id is set:
- send.ts: buildTelegramReplyParams (both reply_parameters and plain reply)
- bot/delivery.send.ts: buildTelegramSendParams
- draft-stream.ts: draft stream reply params
- bot-handlers.runtime.ts: error reply messages (file too large, media download failed)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix(telegram): update test expectations for allow_sending_without_reply

Update exact-match test assertions in send.test.ts to include the new
allow_sending_without_reply: true parameter. Tests using objectContaining
already pass, but several tests use exact object matching.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix: finish telegram reply fallback landing (openclaw#52524) (thanks @moltbot886)

* refactor: extract single-provider plugin entry helper

* refactor: add provider onboarding preset appliers

* refactor: share parsed channel allowlist prompts

* refactor: share channel setup status helpers

* fix: export provider-entry plugin sdk subpath

* style: format plugin sdk helper updates

* fix(docs): code-verified fixes from deep reference audit

- sdk-runtime.md: add missing required params (runId, timeoutMs) to
  runEmbeddedPiAgent example
- sdk-provider-plugins.md: add missing onModelSelected hook (openclaw#22),
  clarify capabilities is data not callable, drop misleading '21' count

* test: fix googlechat security typing drift

* perf: remove stale unit isolated entry

* refactor(outbound): split delivery queue storage and recovery

* fix(docs): remaining code audit fixes

- sdk-entrypoints.md: fix mislabeled 'Channel entry options' heading
  (should be 'Options' — these are definePluginEntry options, not
  channel-specific)
- sdk-overview.md: add 4 missing API object fields (version, description,
  source, rootDir) from OpenClawPluginApi type

* perf(reply): split usage line helpers

* perf(reply): narrow queue imports

* test(msteams): cover graph helpers

* test(msteams): cover upload and webhook helpers

* refactor: harden generated-file guards and provider ids

* fix: restore main gate after type updates

* fix(plugins): accept media-understanding id hints

* test: default scoped vitest configs to no-isolate

* test(msteams): cover poll and file-card helpers

* test: fix provider config typing drift

* perf: default channel vitest lanes to threads

* perf(reply): lazy-load media path normalization

* style(format): fix msteams test drift

* refactor(plugins): move remaining channel and provider ownership out of src

* refactor(plugins): finish provider and whatsapp cleanup

* fix(gateway): pass process.env in status command probe auth to resolve SecretRef

Fixes openclaw#52360

resolveGatewayProbeAuthSafe was called from status-all.ts without an
env argument, causing the credential resolution chain to fall back to
an empty object instead of process.env. This made env-backed SecretRef
tokens (gateway.auth.token, Telegram botToken, etc.) appear unresolved
in the status command path even when the runtime was healthy.

Added process.env as default fallback in buildGatewayProbeCredentialPolicy
and passed env explicitly from status-all.ts callers.

Related: openclaw#33070, openclaw#38973, openclaw#39415, openclaw#46014, openclaw#49730

* fix(status): resolve only selected probe-auth branch and fix plain status path

Address two Codex P1/P2 issues:

1. (P1) Plain 'openclaw status' and 'openclaw status --json' still went
   through the sync resolveGatewayProbeAuthSafe path in
   status.gateway-probe.ts, which cannot expand SecretRef objects.
   Switched to async resolveGatewayProbeAuthSafeWithSecretInputs.

2. (P2) status-all.ts was eagerly resolving both local and remote probe
   auth before deciding which to use. A stale SecretRef in the unused
   branch could abort the command. Collapsed to a single resolution
   call using the correct mode upfront.

Updated status.scan.test.ts to use mockResolvedValue since
resolveGatewayProbeAuthResolution is now async.

* fix(status): await resolveGatewayProbeAuthResolution in scan.shared

Function is now async after switching to resolveGatewayProbeAuthSafeWithSecretInputs.
Missing await caused TS error: Property 'auth' does not exist on type 'Promise<...>'.

* fix: finish gateway probe auth landing (openclaw#52513) (thanks @CodeForgeNet)

* fix: finish gateway probe auth landing (openclaw#52513) (thanks @CodeForgeNet)

* test: clear msteams gate drift for gateway probe auth landing (openclaw#52513) (thanks @CodeForgeNet)

* fix(exec): return plain-text tool result on failure instead of raw JSON

When an exec command fails (e.g. timeout), the tool previously rejected
with an Error, which the tool adapter caught and wrapped in a JSON object
({ status, tool, error }). The model then received this raw JSON as the
tool result and could parrot it verbatim to the user.

Now exec failures resolve with a proper tool result containing the error
as human-readable text in content[], matching the success path structure.
The model sees plain text it can naturally incorporate into its reply.

Also fixes a pre-existing format issue in update-cli.test.ts.

Fixes openclaw#52484

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix: finish exec tool failure landing (openclaw#52508) (thanks @martingarramon)

* fix(openshell): bundle upstream cli fallback

* perf(reply): lazy-load session store writes

* fix(build): restore plugin-sdk and line compat after refactor

* refactor(kilocode): route shared model constants through core seam

* refactor(plugin-sdk): route core provider and telegram seams through sdk barrels

* fix(acp): preserve hidden thought chunks from gateway chat

* fix(docs): rename 'Channel Options' to 'Options' in sdk-entrypoints

This heading labels definePluginEntry options (generic, not channel-specific).
Another agent reverted the previous fix during a merge.

* fix(line): narrow plugin-sdk seams after refactor

* test(voice-call): cover helper utilities

* test(voice-call): cover manager and api helpers

* fix(acp): preserve hidden thought replay on session load

* test(voice-call): cover twilio and reaper helpers

* docs(changelog): note ACP hidden thought replay fix

* test(voice-call): cover utility and tailscale helpers

* fix(ci): resync generated baselines and line runtime seam

* fix(docs): remove duplicate '### Options' headings (MD024)

* fix(ci): restore plugin manifests and boundary tests

* style(docs): format sdk entrypoints doc

* docs(config): refresh generated baseline

* test(voice-call): cover outbound call flow helpers

* fix(ci): repair tts and matrix refactor fallout

* fix(ci): repair voice-call typing and provider contracts

* fix(ci): satisfy voice-call typing and extension boundaries

* Remove personal references from docs (openclaw#25260)

* docs: remove personal references from AGENTS.md

* docs: remove personal reference from sag skill

* docs: note generic agent guidance cleanup

* Update CHANGELOG.md

---------

Co-authored-by: Josh Lehman <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>

* fix(plugins): route keyed queue imports through core (openclaw#52608)

* fix(matrix): preserve send aliases and voice intent

* fix(build): repair stale plugin sdk surfaces

* fix(plugin-sdk): export line runtime subpath

* fix(auth): route copilot login through sdk seam

* feat(web-search): add bundled Exa plugin (openclaw#52617)

* test(msteams): await async setup status lines

* fix(whatsapp): remove outbound runtime cycle

* fix(plugin-sdk): fast-path root diagnostic subscriptions

* fix(exa): align freshness typing and config docs

* fix(matrix): avoid touching dropped room bindings

* fix(web-search): align Exa plugin with current API

* docs(tools): add DuckDuckGo Search provider page

New page: tools/duckduckgo-search.md
- Key-free fallback provider, no API key needed
- Clear Warning about unofficial HTML-based integration
- Limitations section covering bot-challenge risk and reliability
- CardGroup showing good-for vs not-recommended-for use cases

Updated: tools/web.md with DuckDuckGo in CardGroup and comparison table
Updated: docs.json nav and redirect

* test(telegram): align webhook grammy mock

* docs(tools): add Exa Search page, align all search provider docs

New page: tools/exa-search.md
- Neural/keyword/hybrid search modes with content extraction
- Tool parameters including contents (highlights, text, summary)
- Search mode reference table

Rewritten: tools/duckduckgo-search.md
- Aligned to consistent template (Setup, Config, Tool parameters, Notes, Related)
- Simplified from previous version

Aligned across all providers:
- Every search page now ends with a consistent ## Related section
- Replaced 'See [Web tools]' with proper Related links
- Added Exa + DuckDuckGo to web.md overview CardGroup and comparison table
- Added Exa to docs.json nav and redirects

* fix(telegram): inject media loader through bot deps

* fix(ci): harden telegram seams and cap job timeouts

* docs(tools): update Exa Search notes for current API behavior

Add notes about default highlights contents, highlightScores/summary
preservation from responses, description resolution order, and
100-result cap.

* perf: add vitest test perf workflows

* fix(ci): harden changed extension diff fallback

* fix(telegram): harden grammy seams across tests

* refactor: extract exec outcome and tool result helpers

* test: isolate exec foreground failure coverage

* fix(test): allow empty extension lane

* perf: enable vitest fs module cache by default

* fix(cli): route plugin logs to stderr during --json output

* fix(cli): route deferred plugin logs to stderr in status --json

* fix: keep status --json stdout clean (openclaw#52449) (thanks @cgdusek)

* refactor(ci): collapse fast setup jobs into preflight

* fix(exec): accept runtime failure kind in formatter

* fix: include .env file vars in gateway service environment on install

When building the gateway install plan, read and parse
~/.openclaw/.env (or $OPENCLAW_STATE_DIR/.env) and merge those
key-value pairs into the service environment at the lowest
priority — below config env vars, auth-profile refs, and the
core service environment (HOME, PATH, OPENCLAW_*).

This ensures that user-defined secrets stored in .env (e.g.
BRAVE_API_KEY, OPENROUTER_API_KEY, DISCORD_BOT_TOKEN) are
embedded in the LaunchAgent plist (macOS), systemd unit (Linux),
and Scheduled Task (Windows) at install time, rather than
relying solely on the gateway process loading them via
dotenv.config() at startup.

Previously, on macOS the LaunchAgent plist never included .env
vars, which meant:
- launchctl print did not show user secrets (hard to debug)
- Child processes spawned before dotenv loaded had no access
- If the same key existed in both .env and the plist, the stale
  plist value won via dotenv override:false semantics

Dangerous host env vars (NODE_OPTIONS, LD_PRELOAD, etc.) are
filtered using the same security policy applied to config env
vars.

Fixes openclaw#37101
Relates to openclaw#22663

* fix: normalize env var keys and isolate tests from real .env

- Apply normalizeEnvVarKey({ portable: true }) before security
  filtering, matching the established pattern in env-vars.ts.
  Rejects non-portable key names (spaces, special chars) that
  would produce invalid plist/systemd syntax.

- Isolate existing tests from the developer's real ~/.openclaw/.env
  by providing a temp HOME directory, preventing flaky failures
  when the test machine has a populated .env file.

* fix: narrow exec exit failure kind typing

* fix(test): isolate flaky extension lanes

* feat(web-search): add DuckDuckGo bundled plugin (openclaw#52629)

* feat(web-search): add DuckDuckGo bundled plugin

* chore(changelog): restore main changelog

* fix(web-search): harden DuckDuckGo challenge detection

* refactor: split durable service env helpers

* refactor: extract gateway install token helpers

* fix(web-search): mark DuckDuckGo experimental

* docs(tools): update DuckDuckGo Search for landed plugin code

- Mark as experimental (not just unofficial)
- Add region and safeSearch tool parameters (from DDG schema)
- Add plugin config example for region/safeSearch defaults
- Document auto-detection order (100 = last)
- Note SafeSearch defaults to moderate
- Verified against extensions/duckduckgo/src/

* fix(agents): deny local MEDIA paths for MCP results

* Usage: include reset and deleted session archives (openclaw#43215)

Merged via squash.

Prepared head SHA: 49ed6c2
Co-authored-by: rcrick <[email protected]>
Co-authored-by: frankekn <[email protected]>
Reviewed-by: @frankekn

* docs(tools): soften DDG wording (scrapes -> pulls/gathers)

* fix(build): add stable memory-cli dist entry (openclaw#51759)

Co-authored-by: oliviareid-svg <[email protected]>
Co-authored-by: Frank <[email protected]>

* refactor!: drop legacy CLAWDBOT env compatibility

* refactor!: remove moltbot state-dir migration fallback

* fix(gateway): preserve async hook ingress provenance

* fix(ci): write dist build stamp after builds

* perf: trim vitest hot imports and refresh manifests

* fix(security): unwrap time dispatch wrappers

* fix(plugin-sdk): fall back to src root alias files

* fix(ci): skip docs-only preflight pnpm audit

* docs(changelog): note time exec approval fix

* docs: refresh plugin-sdk api baseline

* fix(runtime): make dist-runtime staging idempotent

* fix(media): bound remote error-body snippet reads

* fix(gateway): gate internal command persistence mutations

* fix: restrict remote marketplace plugin sources

* fix(runtime): skip peer resolution for bundled plugin deps

* docs(agents): prefer current test model examples

* fix(exec): escape invisible approval filler chars

* test(models): refresh example model fixtures

* fix(security): unify dispatch wrapper approval hardening

* fix(security): harden explicit-proxy SSRF pinning

* fix: gate synology chat reply name matching

* docs: clarify sessions_spawn ACP vs subagent policies

* refactor(exec): split wrapper resolution modules

* refactor(exec): make dispatch wrapper semantics spec-driven

* refactor(exec): share wrapper trust planning

* refactor(exec): rename wrapper plans for trust semantics

* fix: include .npmrc in onboard docker build

* test: trim docker live auth mounts

* Docs: refresh config baseline for Synology Chat

* refactor: clarify synology delivery identity names

* refactor: centralize synology dangerous name matching

* refactor: narrow synology legacy name lookup

* refactor: audit synology dangerous name matching

* refactor: dedupe synology config schema

* fix: normalize scoped vitest filter paths

* fix(voice-call): harden webhook pre-auth guards

* fix(synology-chat): fail closed shared webhook paths

* docs: credit nexrin in synology changelog

* test: fix base vitest thread regressions

* test: finish base vitest thread fixture fixes

* test(voice-call): accept oversize webhook socket resets

* test: honor env auth in gateway live probes

* fix: harden plugin docker e2e

* Docs: align MiniMax examples with M2.7

* fix(ci): restore stale guardrails and baselines

* Test: isolate qr dashboard integration suite

* Gateway: resolve fallback plugin context lazily

* fix: bind bootstrap setup codes to node profile

* fix(tlon): unify settings reconciliation semantics

* refactor(synology-chat): type startup webhook path policy

* docs(synology-chat): clarify multi-account webhook paths

* refactor: unify minimax model and failover live policies

* docs: sync minimax m2.7 references

* fix: harden Windows Parallels smoke installs

* docs: reorder unreleased changelog by user impact

* refactor: remove embedded runner cwd mutation

* Infra: support shell carrier allow-always approvals

* refactor: centralize bootstrap profile handling

* refactor: reuse canonical setup bootstrap profile

* fix(plugin-sdk): resolve hashed diagnostic events chunks

* fix(plugin-sdk): normalize hashed diagnostic event exports

* test: fix ci env-sensitive assertions

* fix(gateway): fail closed on unresolved discovery endpoints

* feat: add slash plugin installs

* fix(media): block remote-host file URLs in loaders

* fix(media): harden secondary local path seams

* test: harden no-isolate reply teardown

* docs(changelog): add Windows media security fix

* refactor(gateway): centralize discovery target handling

* test: narrow live transcript scaffolding strip

* test: fix ci docs drift and bun qr exit handling

* fix(browser): enforce node browser proxy allowProfiles

* refactor(media): share local file access guards

* test: stabilize ci test harnesses

* test: harden no-isolate test module resets

* fix(plugins): preserve live hook registry during gateway runs

* test: fix channel summary registry setup

* test: harden isolated test mocks

* chore(plugins): remove opik investigation checkpoints

* ACPX: align pinned runtime version (openclaw#52730)

* ACPX: align pinned runtime version

* ACPX: drop version example from help text

* test: stop leaking image workspace temp dirs

* fix(android): gate canvas bridge to trusted pages (openclaw#52722)

* fix(android): gate canvas bridge to trusted pages

* fix(changelog): note android canvas bridge gating

* Update apps/android/app/src/main/java/ai/openclaw/app/node/CanvasActionTrust.kt

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix(android): snapshot canvas URL on UI thread

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* test: isolate base vitest thread blockers

* fix: sync agent and autoreply e2e updates

* test: harden no-isolate mocked module resets

* docs: reorder unreleased changelog

* fix(changelog): note windows media path guardrails (openclaw#52738)

* fix: alphabetize web search provider listings

* docs: clarify unreleased breaking changes

* test: harden ci isolated mocks

* fix: align websocket stream fallback types

* test: finish no-isolate suite hardening

* style: format image-generation runtime tests

* fix(memory-core): register memory tools independently to prevent coupled failure (openclaw#52668)

Merged via admin squash because current required CI failures are inherited from base and match latest `main` failures outside this PR's `memory-core` surface.

Prepared head SHA: df7f968
Co-authored-by: artwalker <[email protected]>
Reviewed-by: @frankekn

* fix(status): recompute fallback context window (openclaw#51795)

* fix(status): recompute fallback context window

* fix(status): keep live context token caps on fallback

* fix(status): preserve fallback runtime context windows

* fix(status): preserve configured fallback context caps

* fix(status): keep provider-aware transcript context lookups

* fix(status): preserve explicit fallback context caps

* fix(status): clamp fallback configured context caps

* fix(status): keep raw runtime slash ids

* fix(status): refresh plugin-sdk api baseline

* fix(status): preserve fallback context lookup

* test(status): refresh plugin-sdk api baseline

* fix(status): keep runtime slash-id context lookup

---------

Co-authored-by: create <[email protected]>
Co-authored-by: Frank Yang <[email protected]>
Co-authored-by: RichardCao <[email protected]>

* fix(telegram): make buttons schema optional in message tool

The Telegram plugin injects a `buttons` property into the message tool
schema via `createMessageToolButtonsSchema()`, but without wrapping it
in `Type.Optional()`. This causes TypeBox to include `buttons` in the
JSON Schema `required` array.

In isolated sessions (e.g. cron jobs) where no `currentChannel` is set,
all plugin schemas are merged into the message tool. When the LLM calls
the message tool without a `buttons` parameter, AJV validation fails
with: `buttons: must have required property 'buttons'`.

Wrap the buttons schema in `Type.Optional()` so it is not required.

* fix: keep message-tool buttons optional for Telegram and Mattermost (openclaw#52589) (thanks @tylerliu612)

* test: update codex test fixtures to gpt-5.4

* fix: repair runtime seams after rebase

* fix: restore Telegram topic announce delivery (openclaw#51688) (thanks @mvanhorn)

When `replyLike.text` or `replyLike.caption` is an unexpected
non-string value (edge case from some Telegram API responses),
the reply body was coerced to "[object Object]" via string
concatenation. Add a `typeof === "string"` guard to gracefully
fall back to empty string, matching the existing pattern used
for `quoteText` in the same function.

Co-authored-by: Penchan <[email protected]>

* docs: sync generated release baselines

* test: isolate pi embedded model thread fixtures

* fix: restore provider runtime lazy boundary

* fix: preserve Telegram reply context text (openclaw#50500) (thanks @p3nchan)

* fix: guard Telegram reply context text (openclaw#50500) (thanks @p3nchan)

* fix: preserve Telegram reply caption fallback (openclaw#50500) (thanks @p3nchan)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>

* fix: harden gateway SIGTERM shutdown (openclaw#51242) (thanks @juliabush)

* fix: increase shutdown timeout to avoid SIGTERM hang

* fix(telegram): abort polling fetch on shutdown to prevent SIGTERM hang

* fix(gateway): enforce hard exit on shutdown timeout for SIGTERM

* fix: tighten gateway shutdown watchdog

* fix: harden gateway SIGTERM shutdown (openclaw#51242) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>

* build: prepare 2026.3.22-beta.1

* fix: restore provider runtime lazy boundary

* test: add parallels npm update smoke

* test: split pi embedded model thread fixtures

* fix: stop browser server tests from launching real chrome

* test: stabilize live provider docker probes

* fix: restart windows gateway after npm update

* test: isolate server-context browser harness imports

* test: inject model runtime hooks for thread-safe tests

* test: snapshot ci timeout investigation

* test: target gemini 3.1 flash alias

* test: stabilize trigger handling and hook e2e tests

* build: prepare 2026.3.22

---------

Co-authored-by: Stephen Schoettler <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: create <[email protected]>
Co-authored-by: moltbot886 <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: CodeForgeNet <[email protected]>
Co-authored-by: Martin Garramon <[email protected]>
Co-authored-by: François Martin <[email protected]>
Co-authored-by: Josh Lehman <[email protected]>
Co-authored-by: Charles Dusek <[email protected]>
Co-authored-by: Kevin ONeill <[email protected]>
Co-authored-by: Rick_Xu <[email protected]>
Co-authored-by: rcrick <[email protected]>
Co-authored-by: frankekn <[email protected]>
Co-authored-by: oliviareid-svg <[email protected]>
Co-authored-by: oliviareid-svg <[email protected]>
Co-authored-by: Frank <[email protected]>
Co-authored-by: scoootscooob <[email protected]>
Co-authored-by: ruochen <[email protected]>
Co-authored-by: Onur Solmaz <[email protected]>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Frank Yang <[email protected]>
Co-authored-by: artwalker <[email protected]>
Co-authored-by: RichardCao <[email protected]>
Co-authored-by: RichardCao <[email protected]>
Co-authored-by: liuyang <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Matt Van Horn <[email protected]>
Co-authored-by: Penchan <[email protected]>
Co-authored-by: Penchan <[email protected]>
Co-authored-by: Julia Bush <[email protected]>
joe2643 added a commit to joe2643/openclaw that referenced this pull request Mar 26, 2026
…d off (#2)

* refactor(plugins): move remaining channel and provider ownership out of src

* refactor(plugins): finish provider and whatsapp cleanup

* fix(gateway): pass process.env in status command probe auth to resolve SecretRef

Fixes openclaw#52360

resolveGatewayProbeAuthSafe was called from status-all.ts without an
env argument, causing the credential resolution chain to fall back to
an empty object instead of process.env. This made env-backed SecretRef
tokens (gateway.auth.token, Telegram botToken, etc.) appear unresolved
in the status command path even when the runtime was healthy.

Added process.env as default fallback in buildGatewayProbeCredentialPolicy
and passed env explicitly from status-all.ts callers.

Related: openclaw#33070, openclaw#38973, openclaw#39415, openclaw#46014, openclaw#49730

* fix(status): resolve only selected probe-auth branch and fix plain status path

Address two Codex P1/P2 issues:

1. (P1) Plain 'openclaw status' and 'openclaw status --json' still went
   through the sync resolveGatewayProbeAuthSafe path in
   status.gateway-probe.ts, which cannot expand SecretRef objects.
   Switched to async resolveGatewayProbeAuthSafeWithSecretInputs.

2. (P2) status-all.ts was eagerly resolving both local and remote probe
   auth before deciding which to use. A stale SecretRef in the unused
   branch could abort the command. Collapsed to a single resolution
   call using the correct mode upfront.

Updated status.scan.test.ts to use mockResolvedValue since
resolveGatewayProbeAuthResolution is now async.

* fix(status): await resolveGatewayProbeAuthResolution in scan.shared

Function is now async after switching to resolveGatewayProbeAuthSafeWithSecretInputs.
Missing await caused TS error: Property 'auth' does not exist on type 'Promise<...>'.

* fix: finish gateway probe auth landing (openclaw#52513) (thanks @CodeForgeNet)

* fix: finish gateway probe auth landing (openclaw#52513) (thanks @CodeForgeNet)

* test: clear msteams gate drift for gateway probe auth landing (openclaw#52513) (thanks @CodeForgeNet)

* fix(exec): return plain-text tool result on failure instead of raw JSON

When an exec command fails (e.g. timeout), the tool previously rejected
with an Error, which the tool adapter caught and wrapped in a JSON object
({ status, tool, error }). The model then received this raw JSON as the
tool result and could parrot it verbatim to the user.

Now exec failures resolve with a proper tool result containing the error
as human-readable text in content[], matching the success path structure.
The model sees plain text it can naturally incorporate into its reply.

Also fixes a pre-existing format issue in update-cli.test.ts.

Fixes openclaw#52484

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* fix: finish exec tool failure landing (openclaw#52508) (thanks @martingarramon)

* fix(openshell): bundle upstream cli fallback

* perf(reply): lazy-load session store writes

* fix(build): restore plugin-sdk and line compat after refactor

* refactor(kilocode): route shared model constants through core seam

* refactor(plugin-sdk): route core provider and telegram seams through sdk barrels

* fix(acp): preserve hidden thought chunks from gateway chat

* fix(docs): rename 'Channel Options' to 'Options' in sdk-entrypoints

This heading labels definePluginEntry options (generic, not channel-specific).
Another agent reverted the previous fix during a merge.

* fix(line): narrow plugin-sdk seams after refactor

* test(voice-call): cover helper utilities

* test(voice-call): cover manager and api helpers

* fix(acp): preserve hidden thought replay on session load

* test(voice-call): cover twilio and reaper helpers

* docs(changelog): note ACP hidden thought replay fix

* test(voice-call): cover utility and tailscale helpers

* fix(ci): resync generated baselines and line runtime seam

* fix(docs): remove duplicate '### Options' headings (MD024)

* fix(ci): restore plugin manifests and boundary tests

* style(docs): format sdk entrypoints doc

* docs(config): refresh generated baseline

* test(voice-call): cover outbound call flow helpers

* fix(ci): repair tts and matrix refactor fallout

* fix(ci): repair voice-call typing and provider contracts

* fix(ci): satisfy voice-call typing and extension boundaries

* Remove personal references from docs (openclaw#25260)

* docs: remove personal references from AGENTS.md

* docs: remove personal reference from sag skill

* docs: note generic agent guidance cleanup

* Update CHANGELOG.md

---------

Co-authored-by: Josh Lehman <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>

* fix(plugins): route keyed queue imports through core (openclaw#52608)

* fix(matrix): preserve send aliases and voice intent

* fix(build): repair stale plugin sdk surfaces

* fix(plugin-sdk): export line runtime subpath

* fix(auth): route copilot login through sdk seam

* feat(web-search): add bundled Exa plugin (openclaw#52617)

* test(msteams): await async setup status lines

* fix(whatsapp): remove outbound runtime cycle

* fix(plugin-sdk): fast-path root diagnostic subscriptions

* fix(exa): align freshness typing and config docs

* fix(matrix): avoid touching dropped room bindings

* fix(web-search): align Exa plugin with current API

* docs(tools): add DuckDuckGo Search provider page

New page: tools/duckduckgo-search.md
- Key-free fallback provider, no API key needed
- Clear Warning about unofficial HTML-based integration
- Limitations section covering bot-challenge risk and reliability
- CardGroup showing good-for vs not-recommended-for use cases

Updated: tools/web.md with DuckDuckGo in CardGroup and comparison table
Updated: docs.json nav and redirect

* test(telegram): align webhook grammy mock

* docs(tools): add Exa Search page, align all search provider docs

New page: tools/exa-search.md
- Neural/keyword/hybrid search modes with content extraction
- Tool parameters including contents (highlights, text, summary)
- Search mode reference table

Rewritten: tools/duckduckgo-search.md
- Aligned to consistent template (Setup, Config, Tool parameters, Notes, Related)
- Simplified from previous version

Aligned across all providers:
- Every search page now ends with a consistent ## Related section
- Replaced 'See [Web tools]' with proper Related links
- Added Exa + DuckDuckGo to web.md overview CardGroup and comparison table
- Added Exa to docs.json nav and redirects

* fix(telegram): inject media loader through bot deps

* fix(ci): harden telegram seams and cap job timeouts

* docs(tools): update Exa Search notes for current API behavior

Add notes about default highlights contents, highlightScores/summary
preservation from responses, description resolution order, and
100-result cap.

* perf: add vitest test perf workflows

* fix(ci): harden changed extension diff fallback

* fix(telegram): harden grammy seams across tests

* refactor: extract exec outcome and tool result helpers

* test: isolate exec foreground failure coverage

* fix(test): allow empty extension lane

* perf: enable vitest fs module cache by default

* fix(cli): route plugin logs to stderr during --json output

* fix(cli): route deferred plugin logs to stderr in status --json

* fix: keep status --json stdout clean (openclaw#52449) (thanks @cgdusek)

* refactor(ci): collapse fast setup jobs into preflight

* fix(exec): accept runtime failure kind in formatter

* fix: include .env file vars in gateway service environment on install

When building the gateway install plan, read and parse
~/.openclaw/.env (or $OPENCLAW_STATE_DIR/.env) and merge those
key-value pairs into the service environment at the lowest
priority — below config env vars, auth-profile refs, and the
core service environment (HOME, PATH, OPENCLAW_*).

This ensures that user-defined secrets stored in .env (e.g.
BRAVE_API_KEY, OPENROUTER_API_KEY, DISCORD_BOT_TOKEN) are
embedded in the LaunchAgent plist (macOS), systemd unit (Linux),
and Scheduled Task (Windows) at install time, rather than
relying solely on the gateway process loading them via
dotenv.config() at startup.

Previously, on macOS the LaunchAgent plist never included .env
vars, which meant:
- launchctl print did not show user secrets (hard to debug)
- Child processes spawned before dotenv loaded had no access
- If the same key existed in both .env and the plist, the stale
  plist value won via dotenv override:false semantics

Dangerous host env vars (NODE_OPTIONS, LD_PRELOAD, etc.) are
filtered using the same security policy applied to config env
vars.

Fixes openclaw#37101
Relates to openclaw#22663

* fix: normalize env var keys and isolate tests from real .env

- Apply normalizeEnvVarKey({ portable: true }) before security
  filtering, matching the established pattern in env-vars.ts.
  Rejects non-portable key names (spaces, special chars) that
  would produce invalid plist/systemd syntax.

- Isolate existing tests from the developer's real ~/.openclaw/.env
  by providing a temp HOME directory, preventing flaky failures
  when the test machine has a populated .env file.

* fix: narrow exec exit failure kind typing

* fix(test): isolate flaky extension lanes

* feat(web-search): add DuckDuckGo bundled plugin (openclaw#52629)

* feat(web-search): add DuckDuckGo bundled plugin

* chore(changelog): restore main changelog

* fix(web-search): harden DuckDuckGo challenge detection

* refactor: split durable service env helpers

* refactor: extract gateway install token helpers

* fix(web-search): mark DuckDuckGo experimental

* docs(tools): update DuckDuckGo Search for landed plugin code

- Mark as experimental (not just unofficial)
- Add region and safeSearch tool parameters (from DDG schema)
- Add plugin config example for region/safeSearch defaults
- Document auto-detection order (100 = last)
- Note SafeSearch defaults to moderate
- Verified against extensions/duckduckgo/src/

* fix(agents): deny local MEDIA paths for MCP results

* Usage: include reset and deleted session archives (openclaw#43215)

Merged via squash.

Prepared head SHA: 49ed6c2
Co-authored-by: rcrick <[email protected]>
Co-authored-by: frankekn <[email protected]>
Reviewed-by: @frankekn

* docs(tools): soften DDG wording (scrapes -> pulls/gathers)

* fix(build): add stable memory-cli dist entry (openclaw#51759)

Co-authored-by: oliviareid-svg <[email protected]>
Co-authored-by: Frank <[email protected]>

* refactor!: drop legacy CLAWDBOT env compatibility

* refactor!: remove moltbot state-dir migration fallback

* fix(gateway): preserve async hook ingress provenance

* fix(ci): write dist build stamp after builds

* perf: trim vitest hot imports and refresh manifests

* fix(security): unwrap time dispatch wrappers

* fix(plugin-sdk): fall back to src root alias files

* fix(ci): skip docs-only preflight pnpm audit

* docs(changelog): note time exec approval fix

* docs: refresh plugin-sdk api baseline

* fix(runtime): make dist-runtime staging idempotent

* fix(media): bound remote error-body snippet reads

* fix(gateway): gate internal command persistence mutations

* fix: restrict remote marketplace plugin sources

* fix(runtime): skip peer resolution for bundled plugin deps

* docs(agents): prefer current test model examples

* fix(exec): escape invisible approval filler chars

* test(models): refresh example model fixtures

* fix(security): unify dispatch wrapper approval hardening

* fix(security): harden explicit-proxy SSRF pinning

* fix: gate synology chat reply name matching

* docs: clarify sessions_spawn ACP vs subagent policies

* refactor(exec): split wrapper resolution modules

* refactor(exec): make dispatch wrapper semantics spec-driven

* refactor(exec): share wrapper trust planning

* refactor(exec): rename wrapper plans for trust semantics

* fix: include .npmrc in onboard docker build

* test: trim docker live auth mounts

* Docs: refresh config baseline for Synology Chat

* refactor: clarify synology delivery identity names

* refactor: centralize synology dangerous name matching

* refactor: narrow synology legacy name lookup

* refactor: audit synology dangerous name matching

* refactor: dedupe synology config schema

* fix: normalize scoped vitest filter paths

* fix(voice-call): harden webhook pre-auth guards

* fix(synology-chat): fail closed shared webhook paths

* docs: credit nexrin in synology changelog

* test: fix base vitest thread regressions

* test: finish base vitest thread fixture fixes

* test(voice-call): accept oversize webhook socket resets

* test: honor env auth in gateway live probes

* fix: harden plugin docker e2e

* Docs: align MiniMax examples with M2.7

* fix(ci): restore stale guardrails and baselines

* Test: isolate qr dashboard integration suite

* Gateway: resolve fallback plugin context lazily

* fix: bind bootstrap setup codes to node profile

* fix(tlon): unify settings reconciliation semantics

* refactor(synology-chat): type startup webhook path policy

* docs(synology-chat): clarify multi-account webhook paths

* refactor: unify minimax model and failover live policies

* docs: sync minimax m2.7 references

* fix: harden Windows Parallels smoke installs

* docs: reorder unreleased changelog by user impact

* refactor: remove embedded runner cwd mutation

* Infra: support shell carrier allow-always approvals

* refactor: centralize bootstrap profile handling

* refactor: reuse canonical setup bootstrap profile

* fix(plugin-sdk): resolve hashed diagnostic events chunks

* fix(plugin-sdk): normalize hashed diagnostic event exports

* test: fix ci env-sensitive assertions

* fix(gateway): fail closed on unresolved discovery endpoints

* feat: add slash plugin installs

* fix(media): block remote-host file URLs in loaders

* fix(media): harden secondary local path seams

* test: harden no-isolate reply teardown

* docs(changelog): add Windows media security fix

* refactor(gateway): centralize discovery target handling

* test: narrow live transcript scaffolding strip

* test: fix ci docs drift and bun qr exit handling

* fix(browser): enforce node browser proxy allowProfiles

* refactor(media): share local file access guards

* test: stabilize ci test harnesses

* test: harden no-isolate test module resets

* fix(plugins): preserve live hook registry during gateway runs

* test: fix channel summary registry setup

* test: harden isolated test mocks

* chore(plugins): remove opik investigation checkpoints

* ACPX: align pinned runtime version (openclaw#52730)

* ACPX: align pinned runtime version

* ACPX: drop version example from help text

* test: stop leaking image workspace temp dirs

* fix(android): gate canvas bridge to trusted pages (openclaw#52722)

* fix(android): gate canvas bridge to trusted pages

* fix(changelog): note android canvas bridge gating

* Update apps/android/app/src/main/java/ai/openclaw/app/node/CanvasActionTrust.kt

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix(android): snapshot canvas URL on UI thread

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* test: isolate base vitest thread blockers

* fix: sync agent and autoreply e2e updates

* test: harden no-isolate mocked module resets

* docs: reorder unreleased changelog

* fix(changelog): note windows media path guardrails (openclaw#52738)

* fix: alphabetize web search provider listings

* docs: clarify unreleased breaking changes

* test: harden ci isolated mocks

* fix: align websocket stream fallback types

* test: finish no-isolate suite hardening

* style: format image-generation runtime tests

* fix(memory-core): register memory tools independently to prevent coupled failure (openclaw#52668)

Merged via admin squash because current required CI failures are inherited from base and match latest `main` failures outside this PR's `memory-core` surface.

Prepared head SHA: df7f968
Co-authored-by: artwalker <[email protected]>
Reviewed-by: @frankekn

* fix(status): recompute fallback context window (openclaw#51795)

* fix(status): recompute fallback context window

* fix(status): keep live context token caps on fallback

* fix(status): preserve fallback runtime context windows

* fix(status): preserve configured fallback context caps

* fix(status): keep provider-aware transcript context lookups

* fix(status): preserve explicit fallback context caps

* fix(status): clamp fallback configured context caps

* fix(status): keep raw runtime slash ids

* fix(status): refresh plugin-sdk api baseline

* fix(status): preserve fallback context lookup

* test(status): refresh plugin-sdk api baseline

* fix(status): keep runtime slash-id context lookup

---------

Co-authored-by: create <[email protected]>
Co-authored-by: Frank Yang <[email protected]>
Co-authored-by: RichardCao <[email protected]>

* fix(telegram): make buttons schema optional in message tool

The Telegram plugin injects a `buttons` property into the message tool
schema via `createMessageToolButtonsSchema()`, but without wrapping it
in `Type.Optional()`. This causes TypeBox to include `buttons` in the
JSON Schema `required` array.

In isolated sessions (e.g. cron jobs) where no `currentChannel` is set,
all plugin schemas are merged into the message tool. When the LLM calls
the message tool without a `buttons` parameter, AJV validation fails
with: `buttons: must have required property 'buttons'`.

Wrap the buttons schema in `Type.Optional()` so it is not required.

* fix: keep message-tool buttons optional for Telegram and Mattermost (openclaw#52589) (thanks @tylerliu612)

* test: update codex test fixtures to gpt-5.4

* fix: repair runtime seams after rebase

* fix: restore Telegram topic announce delivery (openclaw#51688) (thanks @mvanhorn)

When `replyLike.text` or `replyLike.caption` is an unexpected
non-string value (edge case from some Telegram API responses),
the reply body was coerced to "[object Object]" via string
concatenation. Add a `typeof === "string"` guard to gracefully
fall back to empty string, matching the existing pattern used
for `quoteText` in the same function.

Co-authored-by: Penchan <[email protected]>

* docs: sync generated release baselines

* test: isolate pi embedded model thread fixtures

* fix: restore provider runtime lazy boundary

* fix: preserve Telegram reply context text (openclaw#50500) (thanks @p3nchan)

* fix: guard Telegram reply context text (openclaw#50500) (thanks @p3nchan)

* fix: preserve Telegram reply caption fallback (openclaw#50500) (thanks @p3nchan)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>

* fix: harden gateway SIGTERM shutdown (openclaw#51242) (thanks @juliabush)

* fix: increase shutdown timeout to avoid SIGTERM hang

* fix(telegram): abort polling fetch on shutdown to prevent SIGTERM hang

* fix(gateway): enforce hard exit on shutdown timeout for SIGTERM

* fix: tighten gateway shutdown watchdog

* fix: harden gateway SIGTERM shutdown (openclaw#51242) (thanks @juliabush)

---------

Co-authored-by: Ayaan Zaidi <[email protected]>

* build: prepare 2026.3.22-beta.1

* fix: restore provider runtime lazy boundary

* test: add parallels npm update smoke

* test: split pi embedded model thread fixtures

* fix: stop browser server tests from launching real chrome

* test: stabilize live provider docker probes

* fix: restart windows gateway after npm update

* test: isolate server-context browser harness imports

* test: inject model runtime hooks for thread-safe tests

* test: snapshot ci timeout investigation

* test: target gemini 3.1 flash alias

* test: stabilize trigger handling and hook e2e tests

* build: prepare 2026.3.22

* test: harden channel suite isolation

* test: inject thread-safe deps for agent tools

* test: raise timeout for slow provider auth normalization

* ci: stabilize windows and bun unit lanes

* test: inject thread-safe gateway and ACP seams

* test: isolate pi model and reset-model thread fixtures

* build: prepare 2026.3.23

* test: inject image-tool provider deps for raw threads

* test: stabilize e2e module isolation

* test: decouple vitest config checks from ambient env

* fix: harden parallels smoke agent invocation

* test: avoid repo-root perf profile artifacts

* test: inject thread-safe base seams

* fix: document Telegram asDocument alias (openclaw#52461) (thanks @bakhtiersizhaev)

* feat(telegram): add asDocument param to message tool

Adds `asDocument` as a user-facing alias for the existing `forceDocument`
parameter in the message tool. When set to `true`, media files (images,
videos, GIFs) are sent via `sendDocument` instead of `sendPhoto`/
`sendVideo`/`sendAnimation`, preserving the original file quality
without Telegram compression.

This is useful when agents need to deliver high-resolution images or
uncompressed files to users via Telegram.

`asDocument` is intentionally an alias rather than a replacement — the
existing `forceDocument` continues to work unchanged.

Changes:
- src/agents/tools/message-tool.ts: add asDocument to send schema
- src/agents/tools/telegram-actions.ts: OR asDocument into forceDocument
- src/infra/outbound/message-action-runner.ts: same OR logic for outbound path
- extensions/telegram/src/channel-actions.ts: read and forward asDocument
- src/channels/plugins/actions/actions.test.ts: add test case

* fix: restore channel-actions.ts to main version (rebase conflict fix)

* fix(test): match asDocument test payload to actual params structure

* fix(telegram): preserve forceDocument alias semantics

* fix: document Telegram asDocument alias (openclaw#52461) (thanks @bakhtiersizhaev)

---------

Co-authored-by: Бахтиер Сижаев <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>

* fix: refactor deepseek bundled plugin (openclaw#48762) (thanks @07akioni)

* fix: declare typebox runtime dep for mattermost plugin

* test: reset line webhook mocks between cases

* test: split attempt spawn-workspace thread fixtures

* test: remove replaced spawn-workspace monolith

* refactor: isolate attempt context engine thread helpers

* CI: remove npm release preview workflow (openclaw#52825)

* CI: remove npm release preview workflow

* Docs: align release maintainer skill with manual publish

* Docs: expand release maintainer skill flow

* test: stabilize gateway thread harness

* test: fix status plugin pagination expectation

* test: harden channel suite isolation

* build: sync lockfile for mattermost plugin

* fix: ensure env proxy dispatcher before MiniMax and OpenAI Codex OAuth flows (openclaw#52228)

Verified:
- pnpm install --frozen-lockfile
- NPM_CONFIG_CACHE=/tmp/openclaw-npm-cache-52228 pnpm build
- pnpm check
- pnpm test:macmini (failed on inherited pre-existing plugin contract test: src/plugins/contracts/registry.contract.test.ts missing deepseek in bundled provider contract registry outside this PR surface)

Co-authored-by: openperf <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>

* fix: restore ci gates

* test: stabilize channel ci gate

* docs: refresh generated config baseline

* release: verify control-ui assets are included in npm tarball

* release-check: include stderr/stdout when npm pack fails

* release: add changelog for control UI tarball check

* fix: keep session transcript pointers fresh after compaction (openclaw#50688)

Co-authored-by: Frank Yang <[email protected]>

* fix(msteams): isolate probe test env credentials

* release: automate macOS publishing (openclaw#52853)

* release: automate macOS publishing

* release: keep mac appcast in openclaw repo

* release: add preflight-only release workflow runs

* release: keep appcast updates manual

* release: generate signed appcast as workflow artifact

* release: require preflight before publish

* release: require mac app for every release

* docs: clarify every release ships mac app

* release: document Sparkle feed and SHA rules

* release: keep publish flow tag-based

* release: stabilize mac appcast flow

* release: document local mac fallback

* Update CHANGELOG.md

* Improve PR template regression prompts

* fix(agents): preserve anthropic thinking block order (openclaw#52961)

* fix(release): ship bundled plugins in pack artifacts

* fix(config): keep built-in channels out of plugin allowlists (openclaw#52964)

* fix(config): keep built-in channels out of plugin allowlists

* docs(changelog): note doctor whatsapp allowlist fix

* docs(changelog): move doctor whatsapp fix to top

* Update CHANGELOG.md

* fix(config): keep built-in auto-enable idempotent

* fix(release): preserve shipped channel surfaces in npm tar (openclaw#52913)

* fix(channels): ship official channel catalog (openclaw#52838)

* fix(release): keep shipped bundles in npm tar (openclaw#52838)

* build(release): fix rebased release-check helpers (openclaw#52838)

* fix(gateway): harden supervised lock and browser attach readiness

* fix(matrix): avoid duplicate runtime api exports

* fix(gateway): avoid probe false negatives after connect

* docs(changelog): note release and matrix fixes

* fix(plugins): unblock Discord/Slack message tool sends and Feishu media (openclaw#52991)

* fix(plugins): unblock Discord and Slack message tool payloads

* docs(changelog): note Discord Slack and Feishu message fixes

* fix(channels): preserve external catalog overrides (openclaw#52988)

* fix(channels): preserve external catalog overrides

* fix(channels): clarify catalog precedence

* fix(channels): respect overridden install specs

* fix(gateway): require admin for agent session reset

* fix(voice-call): stabilize plivo v2 replay keys

* fix(gateway): require auth for canvas routes

* feat(context-pruning): cache media to disk during pruning instead of stripping

When cacheMedia is enabled, pruned image blocks are saved to
~/.openclaw/media/cache/ and replaced with a file path reference
so the agent can re-read them on demand. Includes TTL cleanup
and session-scoped cache management.

* feat(media): add media cache module for context pruning

* feat(whatsapp): make block streaming configurable instead of hardcoded off

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: CodeForgeNet <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Martin Garramon <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: François Martin <[email protected]>
Co-authored-by: Josh Lehman <[email protected]>
Co-authored-by: Charles Dusek <[email protected]>
Co-authored-by: Kevin ONeill <[email protected]>
Co-authored-by: Rick_Xu <[email protected]>
Co-authored-by: rcrick <[email protected]>
Co-authored-by: frankekn <[email protected]>
Co-authored-by: oliviareid-svg <[email protected]>
Co-authored-by: oliviareid-svg <[email protected]>
Co-authored-by: Frank <[email protected]>
Co-authored-by: scoootscooob <[email protected]>
Co-authored-by: ruochen <[email protected]>
Co-authored-by: Onur Solmaz <[email protected]>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Frank Yang <[email protected]>
Co-authored-by: artwalker <[email protected]>
Co-authored-by: RichardCao <[email protected]>
Co-authored-by: create <[email protected]>
Co-authored-by: RichardCao <[email protected]>
Co-authored-by: liuyang <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Matt Van Horn <[email protected]>
Co-authored-by: Penchan <[email protected]>
Co-authored-by: Penchan <[email protected]>
Co-authored-by: Julia Bush <[email protected]>
Co-authored-by: Bakhtier Sizhaev <[email protected]>
Co-authored-by: Бахтиер Сижаев <[email protected]>
Co-authored-by: wangchunyue <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: evann <[email protected]>
Co-authored-by: Robin Waslander <[email protected]>
Co-authored-by: Sathvik Veerapaneni <[email protected]>
Co-authored-by: Nimrod Gutman <[email protected]>
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams commands Command implementations gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: openclaw status / openclaw status --json fail to resolve gateway.auth.token env SecretRef even when runtime is healthy and env is present

2 participants