Skip to content

Improve gateway diagnostics export for support reports - #70324

Merged
gumadeiras merged 21 commits into
mainfrom
codex/gateway-diagnostics-export
Apr 23, 2026
Merged

gumadeiras merged 21 commits into
mainfrom
codex/gateway-diagnostics-export

Conversation

@gumadeiras

@gumadeiras gumadeiras commented Apr 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a support-ready gateway diagnostics export and strengthens the local
stability diagnostics pipeline around it.

This gives users one shareable artifact for bug reports while keeping the
default privacy posture conservative: no raw chats, webhook bodies, tool
outputs, credentials, cookies, hostnames, prompt text, or secret values.

What Changed

  • Add gateway stability inspection:
    • openclaw gateway stability
    • openclaw gateway stability --bundle latest
    • openclaw gateway stability --bundle latest --export
  • Add support diagnostics export:
    • openclaw gateway diagnostics export
    • --output
    • --json
    • bounded log line/byte controls
  • Include support zip sections for:
    • manifest
    • summary
    • diagnostics rollup
    • newest stability bundle
    • config shape/details
    • sanitized log tail
    • best-effort gateway status snapshot
    • best-effort gateway health snapshot
  • Add bounded stability recording and persisted stability bundles for fatal or
    restart-failure paths.
  • Add diagnostic events for memory pressure and oversized payloads.
  • Add a focused gateway stability test script.
  • Enable diagnostics by default while preserving diagnostics.enabled: false
    as the opt-out.
  • Harden support redaction:
    • redact URL userinfo and sensitive query params
    • redact common private identifiers, including Matrix IDs, emails, and long
      numeric IDs
    • redact local state/home paths
    • redact private config maps and secret references
    • omit known payload fields
    • sanitize status/health snapshot failures
  • Improve sanitized logs:
    • preserve useful operational log messages after redaction
    • parse LogTape metadata into safe structured fields
    • keep payload-looking message text omitted with byte/count metadata

Why

Problem reports should be actionable without requiring users to collect five
different command outputs or share unsafe local logs. The export should answer:
what failed, when, on which version/platform, under which gateway/plugin surface,
and whether there were recent stability or payload-pressure signals.

Testing

Validated on Blacksmith:

  • git diff --check && pnpm check:changed
  • pnpm test src/logging/diagnostic-support-export.test.ts
  • targeted gateway CLI/support export tests during the implementation pass

Full pnpm test was intentionally not rerun for this final pass.

Follow-Ups

These are intentionally out of scope for this PR and will not be done here.

  • Add hard byte and entry-count caps for exported snapshot trees.
    Current export has string/depth limits, but status/health/config snapshots
    should also have total byte and object-entry ceilings so unexpected large
    structures cannot bloat support zips.

  • Add per-section included/skipped/failed status plus byte counts in the
    manifest and summary.
    This will let maintainers quickly tell which evidence is present, missing, or
    failed to collect.

  • Expand payload-free diagnostic highlights in summary.md.
    Surface memory pressure, oversized payloads, restart/fatal bundles, and failed
    snapshot collection in human-readable form.

  • Add plugin-level stability attribution.
    Include payload-free per-plugin/channel lifecycle and failure breadcrumbs so
    maintainers can quickly see which plugin or channel was active around a
    crash, restart, or degraded gateway state.

Copilot AI review requested due to automatic review settings April 22, 2026 19:48
@gumadeiras
gumadeiras requested a review from a team as a code owner April 22, 2026 19:48
@aisle-research-bot

aisle-research-bot Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 5 potential security issue(s) in this PR:

# Severity Title
1 🟠 High Symlink race/arbitrary file overwrite when writing stability bundle temp file
2 🟠 High Arbitrary file overwrite via symlink/path abuse in diagnostics export output path
3 🟡 Medium Potential disk-fill DoS via repeated diagnostic stability bundle writes when retention pruning fails
4 🟡 Medium Support export redaction misses sensitive URL query parameters (e.g., session_id) leading to info disclosure
5 🟡 Medium Diagnostics opt-out default enables collection/logging of operational metadata by default
1. 🟠 Symlink race/arbitrary file overwrite when writing stability bundle temp file
Property Value
Severity High
CWE CWE-367
Location src/logging/diagnostic-stability-bundle.ts:358-367

Description

writeDiagnosticStabilityBundleSync writes a JSON bundle to a predictable path under the (env-controllable) state directory using fs.writeFileSync(tmpFile, ...).

  • The directory is derived from OPENCLAW_STATE_DIR (via resolveStateDir) and could be set to a world-writable location.
  • The temporary file name is predictable (${finalFile}.${pid}.tmp).
  • fs.writeFileSync() follows symlinks.

If the process runs with elevated privileges (or as a more-privileged user than the attacker) and the attacker can create files in the target directory, they can pre-create tmpFile as a symlink to an arbitrary file (e.g. /etc/cron.d/...) and cause it to be overwritten with JSON when the bundle is written.

Vulnerable code:

const tmpFile = `${file}.${process.pid}.tmp`;
fs.writeFileSync(tmpFile, `${JSON.stringify(bundle, null, 2)}\n`, {
  encoding: "utf8",
  mode: 0o600,
});
fs.renameSync(tmpFile, file);

Recommendation

Harden file creation against symlink/hardlink attacks when writing into directories that may be attacker-controlled.

Recommended approach:

  1. Create a unique temp file using an exclusive open and write through the file descriptor.
  2. Refuse to write if the temp path already exists.
  3. Optionally validate the bundle directory is not world-writable and is owned by the current user when running in privileged contexts.

Example (exclusive create + write via fd):

import { openSync, writeFileSync, closeSync, renameSync } from "node:fs";

const fd = fs.openSync(tmpFile, "wx", 0o600); // fail if exists
try {
  fs.writeFileSync(fd, `${JSON.stringify(bundle, null, 2)}\n`, "utf8");
} finally {
  fs.closeSync(fd);
}
fs.renameSync(tmpFile, file);

Additionally, consider generating the temp file name with fs.mkdtempSync() in the target dir and/or using lstatSync checks to ensure neither the temp nor destination is a symlink before writing/renaming.

2. 🟠 Arbitrary file overwrite via symlink/path abuse in diagnostics export output path
Property Value
Severity High
CWE CWE-367
Location src/logging/diagnostic-support-export.ts:716-717

Description

writeDiagnosticSupportExport writes the generated zip directly to outputPath (CLI-provided --output or default under OPENCLAW_STATE_DIR) using fs.writeFileSync(outputPath, buffer, ...).

  • outputPath can be user-controlled (--output) and/or indirectly influenced via OPENCLAW_STATE_DIR.
  • Parent directories are created with mkdirSync(..., { recursive: true }), which will traverse symlinks.
  • fs.writeFileSync() follows symlinks and will truncate/overwrite existing files.

If the process runs with elevated privileges and an attacker can control outputPath or create a symlink at that path (or within the state dir), this can be exploited to overwrite arbitrary files on the filesystem.

Vulnerable code:

fs.mkdirSync(path.dirname(outputPath), { recursive: true, mode: 0o700 });
fs.writeFileSync(outputPath, buffer, { mode: 0o600 });

Recommendation

Defend against writing through symlinks / overwriting arbitrary files:

  • Open the destination file with exclusive create (wx) so an attacker cannot pre-create a symlink at the destination.
  • If you intend to overwrite existing exports, verify the existing path is a regular file owned by the current user and not a symlink (lstatSync + isSymbolicLink()), then replace via an atomic rename from a securely-created temp file.

Example (write to temp + atomic rename):

const dir = path.dirname(outputPath);
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });

const tmp = path.join(dir, `.tmp-${process.pid}-${Date.now()}`);
const fd = fs.openSync(tmp, "wx", 0o600);
try {
  fs.writeFileSync(fd, buffer);
} finally {
  fs.closeSync(fd);
}

​// Optional: refuse if outputPath exists and is a symlink
try {
  if (fs.lstatSync(outputPath).isSymbolicLink()) {
    throw new Error("Refusing to write diagnostics export to a symlink");
  }
} catch (e) {
  ​// ignore ENOENT
}

fs.renameSync(tmp, outputPath);

Also consider rejecting OPENCLAW_STATE_DIR values that resolve into world-writable locations when running in privileged contexts, or documenting that OPENCLAW_STATE_DIR/--output must not point to shared directories.

3. 🟡 Potential disk-fill DoS via repeated diagnostic stability bundle writes when retention pruning fails
Property Value
Severity Medium
CWE CWE-400
Location src/logging/diagnostic-stability-bundle.ts:294-400

Description

writeDiagnosticStabilityBundleForFailureSync() writes a new JSON file on each failure event (startup failure, shutdown timeout, respawn failure, fatal hook), then calls pruneOldBundles() to enforce retention.

However, pruneOldBundles() silently suppresses all errors (both on directory listing and on deletes). This means retention can be bypassed in real-world failure modes (e.g., directory readable/listing fails, transient FS errors, permission issues), allowing unbounded accumulation of bundle files.

Additionally, the failure path forces includeEmpty: true, so bundles are written even when the snapshot is empty, making repeated failures cheaper to trigger and more likely to happen frequently.

Impact:

  • An attacker who can repeatedly induce gateway failures (or a misbehaving environment causing repeated restarts) can cause unbounded disk growth in the state directory, potentially exhausting disk space and causing a denial of service.

Vulnerable code (retention bypass on errors):

function pruneOldBundles(dir: string, retention: number): void {
  ...
  try {
    const entries = fs.readdirSync(dir, { withFileTypes: true })
      ...
    for (const entry of entries.slice(retention)) {
      try {
        fs.unlinkSync(entry.file);
      } catch {
        ​// Retention cleanup must not block failure handling.
      }
    }
  } catch {
    ​// Retention cleanup must not block failure handling.
  }
}

Failure writer always writes (even empty snapshot):

const result = writeDiagnosticStabilityBundleSync({
  ...options,
  reason,
  error,
  includeEmpty: true,
});

Recommendation

Mitigate disk-fill risk by making bundle creation resilient to pruning failures and adding write throttling:

  1. Add rate limiting / deduplication for failure bundle writes (e.g., at most 1 per reason per N minutes), and/or overwrite a fixed filename like latest-failure.json in addition to (or instead of) timestamped files.

  2. If retention enforcement fails, fail closed (skip writing) or perform a secondary cap mechanism:

    • Track bundle count/bytes via a lightweight index file, or
    • Attempt best-effort deletion by using a bounded glob + stat, and if listing fails, skip writing.
  3. Consider honoring diagnostics enablement (or a config flag) before writing failure bundles.

Example: simple time-based throttle (in-memory):

let lastWriteAt = 0;
const MIN_INTERVAL_MS = 60_000;

export function writeDiagnosticStabilityBundleForFailureSync(reason: string, error?: unknown, options: WriteDiagnosticStabilityBundleForFailureOptions = {}) {
  const now = Date.now();
  if (now - lastWriteAt < MIN_INTERVAL_MS) {
    return { status: "skipped", reason: "empty" as const };
  }
  lastWriteAt = now;
  ...
}

And/or if pruneOldBundles() throws / cannot read directory, do not create a new file until retention can be confirmed.

4. 🟡 Support export redaction misses sensitive URL query parameters (e.g., session_id) leading to info disclosure
Property Value
Severity Medium
CWE CWE-200
Location src/logging/diagnostic-support-redaction.ts:304-311

Description

The support bundle redaction only masks URL query parameter values when the parameter name is in a small allowlist (isSensitiveUrlQueryParamName). Any other sensitive parameters (common examples: session_id, sessionid, sid, code, state, jwt, etc.) are not redacted and can be exported in logs/openclaw-sanitized.jsonl and other sanitized text fields.

In redactUrlSecretsForSupport, query parameters are matched and redacted conditionally:

  • Input: arbitrary string fields that are preserved in support export (e.g., msg, endpoint, target, etc.)
  • Sink: redactSupportString() → redactTextForSupport() → redactUrlSecretsForSupport()
  • Only parameters whose names match the limited SENSITIVE_URL_QUERY_PARAM_NAMES set are replaced with <redacted>

As a result, a log message like:

  • "endpoint": "https://example.com/callback?session_id=ABC123..."

will keep the session_id value unchanged in the exported support zip, despite being a credential/session token.

Vulnerable code:

.replace(URL_PARAM_RE, (match, prefix: string, key: string) =>
  isSensitiveUrlQueryParamName(key) ? `${prefix}${key}=<redacted>` : match,
);

Recommendation

Broaden query-param redaction so common session/authorization parameters cannot slip through.

Options (can be combined):

  1. Expand the sensitive-name list to include common auth/session parameters (session, session_id, sid, state, code, etc.).
  2. Add heuristic redaction for values that look like secrets (length/charset) when the key is unknown.
  3. Consider redacting all query parameter values by default in support exports (safest), keeping only the keys.

Example safer implementation (redact all query params in support export):

function redactUrlSecretsForSupport(value: string): string {
  return value
    .replace(URL_USERINFO_RE, (_m, scheme: string, _u: string, p?: string) =>
      p ? `${scheme}<redacted>:<redacted>@` : `${scheme}<redacted>@`,
    )
    .replace(URL_PARAM_RE, (_match, prefix: string, key: string) =>
      `${prefix}${key}=<redacted>`,
    );
}

If full redaction is too aggressive, at minimum add session, session_id, sessionid, and sid to SENSITIVE_URL_QUERY_PARAM_NAMES and add a value-pattern fallback for long/high-entropy tokens.

5. 🟡 Diagnostics opt-out default enables collection/logging of operational metadata by default
Property Value
Severity Medium
CWE CWE-359
Location src/infra/diagnostic-events.ts:237-239

Description

Diagnostics were changed from opt-in to opt-out:

  • isDiagnosticsEnabled() now returns true unless config.diagnostics.enabled === false.
  • The global diagnostics event system defaults to enabled: true.
  • As a result, diagnostic events (e.g., model.usage, webhook/session metadata, payload size events, memory samples/pressure) can be emitted and recorded in logs/diagnostic snapshots even when the user has not explicitly enabled diagnostics.

This is a privacy/security regression because diagnostic events include identifiers such as sessionKey, sessionId, chatId, and channel, and may be persisted in logs or exported bundles depending on configured listeners.

Vulnerable change:

export function isDiagnosticsEnabled(config?: OpenClawConfig): boolean {
  return config?.diagnostics?.enabled !== false;
}

Recommendation

Restore diagnostics to an explicit opt-in model, or gate all diagnostics emission behind both (1) a process-global flag defaulting to false until config is loaded, and (2) an explicit config enable.

Example (opt-in):

export function isDiagnosticsEnabled(config?: OpenClawConfig): boolean {
  return config?.diagnostics?.enabled === true;
}

function getDiagnosticEventsState(): DiagnosticEventsGlobalState {
  ​// default disabled until config is loaded
  ...
  enabled: false,
}

Also ensure early startup paths set the process-global flag before any potential diagnostic emission, and add regression tests asserting that events are not emitted when diagnostics are unset/disabled.


Analyzed PR: #70324 at commit 3d6ee85

Last updated on: 2026-04-23T00:49:49Z

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Apr 22, 2026
@gumadeiras gumadeiras self-assigned this Apr 22, 2026
@greptile-apps

greptile-apps Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a comprehensive gateway diagnostics export system — CLI commands (openclaw gateway stability, openclaw gateway diagnostics export), in-process stability recording, memory pressure detection, support zip generation, and a multi-layer redaction pipeline. The implementation is well-structured and includes solid tests for the privacy-sensitive paths.

Two P1 concerns need attention before merge:

  • Hostname leak vs. stated privacy guarantee: The stability bundle written into the support zip includes host.hostname from os.hostname() verbatim. The PR description explicitly claims "no hostnames", but no redaction is applied to the bundle before it is zipped.
  • Default-on diagnostics without migration notice: isDiagnosticsEnabled was flipped from opt-in to opt-out; existing users who never set diagnostics.enabled will begin persisting stability bundles (including hostname and PID) to disk on the next upgrade without any explicit consent or changelog warning.

Confidence Score: 3/5

Needs fixes before merge: hostname is included in the support zip despite an explicit 'no hostnames' privacy claim, and the default-on diagnostic change lacks a migration notice.

Two P1 findings: the hostname privacy guarantee is contradicted by the code, and the opt-in→opt-out flip for diagnostics could expose data for users who never consented. The TOCTOU on mtime is P2. The rest of the implementation is well-tested and carefully structured.

src/logging/diagnostic-support-export.ts (hostname not redacted before zipping stability bundle), src/infra/diagnostic-events.ts (default-on change)

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/logging/diagnostic-support-export.ts
Line: 773-775

Comment:
**Hostname written to zip contradicts stated privacy guarantee**

The PR description explicitly lists "no hostnames" as part of the conservative privacy posture, but `stability.bundle.host.hostname` is written directly from `os.hostname()` (set in `writeDiagnosticStabilityBundleSync`) into the zip without any redaction. In a corporate environment, hostnames are often sensitive (they can encode team, location, or user identity). The test only checks that `"support-host"` (a log-record field) is absent, but the real OS hostname from the stability bundle is a different value and is never checked for exclusion.

Either the bundle's `host.hostname` should be redacted (e.g., replaced with a hash or `<redacted-hostname>`) before being included, or the privacy notes in `summary.md` and the PR description should be corrected to acknowledge that hostnames are present.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/infra/diagnostic-events.ts
Line: 237-238

Comment:
**Default-on change may surprise users who never opted in**

`isDiagnosticsEnabled` flipped from `=== true` (opt-in) to `!== false` (opt-out). Any user who never set `diagnostics.enabled` in their config will now have the stability recorder, memory sampler, and support-export machinery active automatically. The PR notes this is intentional, but the change has privacy implications: on upgrade, users who previously had diagnostics silently disabled will begin writing stability bundles (including hostname, PID, and event history) to disk under `$OPENCLAW_STATE_DIR/logs/stability/` without explicit consent. Consider at minimum adding a one-time migration notice or documenting the default-on behavior prominently in the upgrade notes.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/logging/diagnostic-stability-bundle.ts
Line: 213-222

Comment:
**TOCTOU: `statSync` after `readFileSync` can return stale mtime**

`readFileSync` reads the file, then `statSync` is called separately for `mtimeMs`. If the file is replaced between the two calls (e.g., a new bundle written by another process), the returned `mtimeMs` will belong to the new file while `bundle` reflects the old content. For display-only use this is benign, but callers using `mtimeMs` to sort or de-duplicate bundles could see an inconsistency. Consider reading the stat *before* parsing (or deriving mtime from the filename timestamp as a fallback).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat: add gateway diagnostics export" | Re-trigger Greptile

Comment thread src/infra/diagnostic-events.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a support-ready diagnostics export (zip artifact) and a bounded “gateway stability” diagnostics pipeline (recorder + persisted bundles), wiring new memory/payload diagnostics events through the Gateway and CLI surfaces with updated docs/tests.

Changes:

  • Add bounded diagnostic stability recorder, persisted stability bundles (including fatal/restart failure hooks), and a diagnostics.stability Gateway RPC + openclaw gateway stability CLI.
  • Add openclaw gateway diagnostics export to write a shareable diagnostics zip containing manifest/summary, sanitized log tail, config shape/sanitized config, status/health snapshots, and latest stability bundle.
  • Emit new diagnostics events for memory sampling/pressure and oversized payloads, and enable diagnostics by default with an opt-out (diagnostics.enabled: false).

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/logging/diagnostic.ts Gate diagnostic logging by process/config flags; heartbeat now drives memory sampling + stability recorder lifecycle.
src/logging/diagnostic.test.ts Adds coverage for heartbeat lifecycle, recorder wiring, and disabled-diagnostics behavior.
src/logging/diagnostic-support-redaction.ts New support-oriented redaction/sanitization utilities for text, paths, snapshots, and config.
src/logging/diagnostic-support-export.ts New support export builder/writer producing a privacy-conscious diagnostics zip artifact.
src/logging/diagnostic-support-export.test.ts Validates export contents and redaction behavior for secrets/payloads/identifiers/paths.
src/logging/diagnostic-stability.ts New bounded stability recorder and snapshot/query logic for diagnostic events.
src/logging/diagnostic-stability.test.ts Tests recorder projection, bounding, filtering, and summary aggregation.
src/logging/diagnostic-stability-bundle.ts New on-disk stability bundle persistence + retention + fatal hook integration.
src/logging/diagnostic-stability-bundle.test.ts Tests bundle writing/retention/reading and fatal-hook wiring.
src/logging/diagnostic-runtime.ts Skip queue lane diagnostic events when diagnostics are disabled for the process.
src/logging/diagnostic-payload.ts New helper to emit payload.large diagnostics + parse Content-Length.
src/logging/diagnostic-memory.ts New memory sampling + threshold/growth pressure events with throttling.
src/logging/diagnostic-memory.test.ts Tests memory sample and pressure emission/throttling behavior.
src/infra/unhandled-rejections.ts Run fatal error hooks before exiting on unhandled rejections.
src/infra/unhandled-rejections.fatal-detection.test.ts Ensures fatal hook state is reset for tests that install rejection handlers.
src/infra/fatal-error-hooks.ts New minimal fatal hook registry with safe failure reporting.
src/infra/fatal-error-hooks.test.ts Tests message collection and safe hook-failure reporting.
src/infra/diagnostic-events.ts Adds new diagnostics event types; enables diagnostics by default; adds process-level enable switch.
src/infra/diagnostic-events.test.ts Adds tests for process-level disable behavior + updated default-enabled semantics.
src/index.ts Run fatal error hooks on uncaught exceptions and legacy CLI failures.
src/gateway/server/ws-connection/message-handler.ts Emit payload.large when pre-auth WS frames exceed limits.
src/gateway/server/ws-connection.ts Detect WS max-payload errors and emit payload.large with appropriate surface/reason.
src/gateway/server.preauth-hardening.test.ts Asserts oversized pre-auth frames emit payload.large diagnostics.
src/gateway/server.impl.ts Set per-process diagnostics enabled flag from config; start heartbeat if enabled.
src/gateway/server-methods/diagnostics.ts New Gateway RPC method diagnostics.stability.
src/gateway/server-methods/diagnostics.test.ts Tests stability RPC filtering and invalid param handling.
src/gateway/server-methods/chat.ts Emit payload.large when chat history is truncated to fit size budget.
src/gateway/server-methods.ts Registers new diagnostics handlers.
src/gateway/server-methods-list.ts Adds diagnostics.stability to the method listing.
src/gateway/server-broadcast.ts Emits payload.large once per slow client when outbound WS buffer exceeds cap.
src/gateway/method-scopes.ts Adds diagnostics.stability to operator read scope.
src/gateway/method-scopes.test.ts Adds scope coverage for diagnostics.stability.
src/gateway/http-common.ts Emit payload.large when JSON body is rejected as too large (with Content-Length when present).
src/gateway/http-common.test.ts Asserts oversized JSON body emits payload.large diagnostics.
src/gateway/gateway-stability.test.ts New focused “stability lane” regression test for bounded recorder behavior.
src/gateway/gateway-misc.test.ts Adds broadcaster test asserting outbound buffer diagnostics emission is de-duped.
src/config/schema.help.ts Updates docs to reflect diagnostics default-enabled behavior.
src/config/schema.base.generated.ts Updates generated schema help text for diagnostics default-enabled behavior.
src/cli/run-main.ts Run fatal error hooks on CLI uncaught exceptions.
src/cli/gateway-cli/run.ts Persist a stability bundle on gateway startup failure.
src/cli/gateway-cli/run-loop.ts Persist stability bundles on restart failures and shutdown timeouts.
src/cli/gateway-cli/register.ts Adds gateway stability and gateway diagnostics export CLI commands (plus bundle reading/export routing).
src/cli/gateway-cli.coverage.test.ts CLI coverage for stability RPC, bundle output, and diagnostics export behavior.
package.json Adds test:stability:gateway convenience script.
docs/help/testing.md Documents the new stability test lane/script.
docs/gateway/protocol.md Documents payload-limit behavior and payload.large diagnostics.
docs/gateway/health.md Documents default-enabled diagnostics, stability recorder/bundles, and support export workflow.
docs/cli/gateway.md Documents gateway stability and gateway diagnostics export commands/options.
docs/.generated/config-baseline.sha256 Updates config baseline hashes due to schema/help changes.

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

Copy link
Copy Markdown
Contributor

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: db881537f1

ℹ️ 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".

@gumadeiras
gumadeiras force-pushed the codex/gateway-diagnostics-export branch from 978912c to 5d7ce7f Compare April 22, 2026 20:27

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

Copy link
Copy Markdown
Contributor

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: 5d7ce7f013

ℹ️ 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".

@gumadeiras
gumadeiras force-pushed the codex/gateway-diagnostics-export branch 2 times, most recently from 7cb1b6c to ab96802 Compare April 22, 2026 20:46

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

Copy link
Copy Markdown
Contributor

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: ab96802b87

ℹ️ 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".

@gumadeiras
gumadeiras force-pushed the codex/gateway-diagnostics-export branch from 2cc50ff to 40ad7e8 Compare April 22, 2026 21:33

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

Copy link
Copy Markdown
Contributor

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: 40ad7e865f

ℹ️ 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".

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

Copy link
Copy Markdown
Contributor

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: 4e9f895c0a

ℹ️ 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".

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

Copy link
Copy Markdown
Contributor

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: 2ecd0d96c1

ℹ️ 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".

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

Copy link
Copy Markdown
Contributor

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: 171ded0369

ℹ️ 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".

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

Copy link
Copy Markdown
Contributor

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: 08d3a720db

ℹ️ 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".

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

Copy link
Copy Markdown
Contributor

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: 8da37ea281

ℹ️ 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 thread src/cli/gateway-cli/register.ts Resolved

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

Copy link
Copy Markdown
Contributor

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: 255f5ce1fc

ℹ️ 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 thread src/cli/gateway-cli/run.ts Resolved

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

Copy link
Copy Markdown
Contributor

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: b36b1b76b0

ℹ️ 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".

readObject(bundle.process, "process");
readObject(bundle.host, "host");
readStabilitySnapshot(bundle.snapshot);
return bundle as DiagnosticStabilityBundle;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Strip unknown fields when parsing stability bundles

parseDiagnosticStabilityBundle validates required fields but then returns the original object cast to DiagnosticStabilityBundle, so unvalidated extra fields are preserved. Because support exports later serialize the parsed bundle verbatim (stability/latest.json), a hand-edited/tampered bundle (or gateway stability --export --bundle <path>) can smuggle payload/secrets into a file that is advertised as share-safe. Construct and return a sanitized bundle object with only whitelisted fields instead of casting the original input.

Useful? React with 👍 / 👎.

Comment on lines +309 to +310
.replace(URL_PARAM_RE, (match, prefix: string, key: string) =>
isSensitiveUrlQueryParamName(key) ? `${prefix}${key}=<redacted>` : match,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Redact sensitive URL params in fragments

URL secret redaction only handles query parameters that start with ?/&, so fragment-carried credentials like #access_token=... are not scrubbed. OAuth/magic-link style URLs frequently put bearer tokens in fragments, and those strings can flow into logs/status snapshots that are included in diagnostics exports, leaking credentials in bundles intended for sharing. Expand redaction to parse and sanitize sensitive key/value pairs in URL fragments as well.

Useful? React with 👍 / 👎.

ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
@clawsweeper clawsweeper Bot mentioned this pull request May 3, 2026
8 of 20 tasks
zhonghe0615 pushed a commit to zhonghe0615/openclaw that referenced this pull request May 7, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Heetisk pushed a commit to Heetisk/openclaw that referenced this pull request Sep 28, 2026
Merged via squash.

Prepared head SHA: 3d6ee85
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants