Skip to content

fix(diagnostics-otel): gateway stalls after every model call when content capture is on - #158145

Closed
amittell wants to merge 37 commits into
openclaw:mainfrom
amittell:fix/otel-content-capture-redaction-cost
Closed

amittell wants to merge 37 commits into
openclaw:mainfrom
amittell:fix/otel-content-capture-redaction-cost

Conversation

@amittell

@amittell amittell commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #158116

What Problem This Solves

Fixes: the Gateway event loop blocks after every model call when diagnostics.otel.captureContent is on and the session's prompts are large.

User Impact

User impact: with content capture on, every channel on the Gateway stops answering while one large session runs, and the stall grows with the prompt, not with the 128 KiB that is exported. #158116 measured ~150 s blocks per call on a live Gateway. With the 1M-token window below, main reaches 1.2 s /readyz latency at 2.1M characters of prompt; this PR stays under 130 ms.

Why This Change Was Made

safeJsonString redacted the whole serialized value only to learn it was over the 128 KiB budget, then retried up to 7 x 9 truncation budgets, redacting every string in full each time. That ran for gen_ai.input.messages, input.value, openclaw.content.input_messages, the output pairs and the tool definitions, on the event loop.

This PR:

  • picks the truncation budget from unredacted sizes and redacts only the candidate it exports;
  • redacts a clipped string through a window that runs past the cut (4,096 characters, or the longest registered secret if longer), so a secret that starts in the exported prefix is still masked;
  • masks a secret the window leaves open (private key without its END line, JWT without its signature, URL password before its @, open quoted value) from where it starts, using findTruncatedSecret in core;
  • keeps whole-value redaction when logging.redactPatterns is set, since a configured rule can need any amount of text;
  • serializes and redacts each mirrored pair (gen_ai.input.messages / input.value, the output pair) once.

Core keeps secret matching and the registered-value registry; the plugin keeps the budgets. Three functions are added to openclaw/plugin-sdk/logging-core: findTruncatedSecret(), getLongestRegisteredSecretLength() and hasConfiguredRedactPatterns().

Evidence

Head ee8f1612a06 = previous head e84c7301e2da + merge of main 2e24ab71b147 + the test-line allocation. The 17 code and test files are byte-identical to e84c7301e2da; the merge only touched docs/plugins/sdk-subpaths.md and the SDK budget lines (main's 3,859 / 2,232 plus these 3).

Gateway, main vs this PR. A real Gateway started through qa-lab with the mock OpenAI provider, diagnostics-otel traces and logs, captureContent: true, model contextWindow 1,000,000 and a local OTLP receiver. 40 turns, each reading a 300,414-character file of log lines with fresh bearer JWTs, a GitLab token and a 5,134-character Atlassian token, while /readyz is probed every 100 ms. Same harness, same host, run back to back:

main 2e24ab71b147 this PR ee8f1612a06
Prompt at turn 40 2,095,827 chars 2,095,643 chars
/readyz max 1,226 ms 126 ms
/readyz probes > 250 ms / > 1 s 49 / 7 of 174 0 / 0 of 181
Reply time, turn 10 / 20 / 30 / 40 586 / 1,024 / 1,797 / 2,373 ms 420 / 425 / 409 / 440 ms
Gateway CPU for the 40 turns 57.5 s 24.3 s
Gateway main-thread stall warnings 8, max 1,240 ms 0
Model-call spans / provider requests 81 / 81 81 / 81
OTLP requests not 200 0 of 55 0 of 22
Largest content attribute 131,049 chars 129,287 chars
Leak needles in any accepted OTLP body (of 10) 0 0

The secrets were in every turn's model input on both trees, and a plain marker reached the export on both. With the default context window, compaction keeps the same session under 315K characters and main's /readyz max is 108 ms, which is why the comparison sets 1M. Not covered: image payloads, a real collector, a real channel, Linux; one run per tree on a busy host.

Fail without the fix. With main's service-content-normalization.ts restored and everything else at this head, the two diagnostics-otel test files give 10 failed, 101 passed: both redaction-work bounds, the URL-password and database-URL cut cases, and redacts line-start assignments in content that fits without truncation, where main's normalizer exports the planted secret unmasked (JSON escaping turns the line break into \n, which hides a line-start assignment from the text rules). At this head the six changed test files pass 148 of 148; src/logging plus extensions/diagnostics-otel pass 1,027 with 4 skipped.

Checks. pnpm tsgo:all passes. plugin-sdk:surface:check measures 3,862 / 2,235 public exports against those budgets, and fails with each budget lowered by one. oxlint, oxfmt, and the line-cap, max-lines, assertion-safety, database-dialect, timeout-race and mock-export ratchets pass against 2e24ab71b147.

Test-line ratchet. This PR adds 977 test lines and allocates exactly 977 (normalization 772, open-secret 66, registered-secret consumer 63, emitted-body capture 36, registry 31, logging config 9). Main f5f27c3ef6e is 10 lines over its own ceiling (6,421,662 vs 6,421,652), and the script fails any change that adds lines while the tree is over, so test-lines here fails by exactly those 10 (over by: 10; net delta: +977). An allocation of 987 is rejected (credit 987 exceeds added test lines 977). It clears when main is back under its ceiling.

CI on ee8f1612a06: running at the time of this edit. Expect test-lines red by main's 10 lines (above); every other job is judged on its own.

Simplification pass. I ran the repo's pr-simplify pass over the whole diff and removed nothing: the log and JSON export paths share one bounded-redaction function, each core fact sits with its existing owner, and every test group fails for a distinct reason (the control above shows the work-bound and boundary groups failing on main). Against 2e24ab71b147: production TypeScript +426 code / +125 comment lines, -51, in 12 files; tests net +977 in 6 files. One alternative is in the decisions below.

Decisions this needs from a maintainer

  1. Capture completeness: accept that some large values export a truncated prefix or the max_redaction_work summary where main (slowly) exported more, as listed under limits below.
  2. SDK surface: accept findTruncatedSecret(), getLongestRegisteredSecretLength() and hasConfiguredRedactPatterns() in openclaw/plugin-sdk/logging-core. The alternative is one core operation that redacts a prefix safely and owns all four concerns; I can switch to that if you prefer it, at the cost of redoing this qualification.
  3. Security review of this head: src/logging/*redact*.ts and *secret*.ts are in the redaction category of .github/security-review-policy.yml.

Capture and security limits

  • Whole-value handling covers JSON up to 4x the attribute budget, and eligible open-secret cases within the 8x redaction-work budget. Larger values can be truncated even when their masked form would fit.
  • The bounded retry can export less text while any registered value exists. A longer registered value widens every window and leaves fewer items under the work cap; a window larger than the cap exports the max_redaction_work summary.
  • Configured logging.redactPatterns keep whole-value work and can still block on very large captures. The shared configured-pattern path processes long strings in 16,384-character chunks without overlap, a pre-existing limit.
  • Identifier prefixes in SG. keys, Slack webhook URLs, Telegram bot tokens and FlyV1 fm<digits>_ would need to exceed the lookahead before their secret part; not covered. A JWT header longer than the lookahead can export header parameters up to the cut.
  • URL handling is conservative: a database port/path or web URL port that runs to the window end without /, whitespace or @ can be dropped where main keeps it.
  • The new SDK helpers return positions, lengths or configuration presence, never registered values.

…ribute exports

With diagnostics.otel.captureContent enabled, safeJsonString redacted the
full serialized value just to learn it was too long, then redacted every
string in full on each of up to 63 truncation attempts, for gen_ai.* and
openclaw.content.* separately. A model call whose context carries megabytes
of tool output blocked the gateway event loop for minutes.

Truncation budgets are now chosen from unredacted sizes, and only the
exported candidate is redacted. A clipped string is redacted over its kept
prefix plus 4,096 characters of lookahead, and a private key block cut off
before its END line is dropped. Redaction input per JSON candidate is capped
at 8x the attribute budget. normalizeOtelLogString uses the same bounded
prefix, and mirrored gen_ai keys (input.value, output.value) reuse one
serialization.

Content that fits without truncation now also redacts each string before
serialization; JSON escaping hid line-start assignments such as
password=... from the text rules.
Copilot AI lite review requested due to automatic review settings September 25, 2026 14:01
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

Copilot review overview

🟡 Changes recommended

A critical redaction-boundary issue remains unresolved and could expose sensitive content.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

This PR improves OTEL content capture performance for large model payloads by bounding redaction work and reusing serialized content.

Changes:

  • Adds bounded redaction lookahead and truncation safeguards.
  • Reuses serialized GenAI values across mirrored attributes.
  • Adds performance and redaction-boundary tests.

A critical redaction-boundary issue remains unresolved: unterminated sensitive assignments may expose secrets (2 votes).

File Summary
extensions/​diagnostics-otel/​src/​service-genai-content.ts Reuses serialized values for mirrored GenAI attributes.
extensions/​diagnostics-otel/​src/​service-content-normalization.ts Implements bounded JSON/log normalization and redaction.
extensions/​diagnostics-otel/​src/​service-content-normalization.test.ts Tests bounded work and sensitive-content handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR bounds OpenTelemetry content-redaction work and reuses serialized values across mirrored attributes.

Example: A 40-turn session reaches roughly 2.1 million prompt characters with content capture enabled.

  • Before: The contributor measured maximum /readyz latency of 1,226 ms on main.
  • After: The same Gateway workload measured 126 ms on this PR, with no planted secret needles found in accepted OTLP bodies.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, behaviorally demonstrated repair with no concrete new finding; unresolved product choices cap overall readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The contributor exercised this head through a running Gateway with capture enabled, a mock provider, large growing prompts, real OTLP requests, readiness probes, and planted secrets; all turns completed with substantially lower latency and no planted leak needles in accepted exports. The prepared images were inspected and are unrelated UI material, so they supply no capture proof. The Gateway comparison covers one run per tree on macOS, not images, Linux, or a production collector.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: With content capture enabled, one large session can stop replies and health checks across the Gateway.
Reason: The performance repair has clear user value, but reduced capture completeness and three public helpers are explicit, unresolved owner decisions.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open: it addresses a confirmed Gateway stall still present on main, with no new concrete code finding; capture semantics, SDK shape, and current-head security approval remain unresolved.

Priority: P1
Reviewed head: ee8f1612a06c0d1712226b794a681fedd1e26896
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should this PR ship the documented capture-completeness limits and three logging-core helpers, or should the repair use a narrower API or implementation?
  • Recommendation: Accept this bounded-capture design: Approve the documented truncation tradeoffs and the three helpers, retaining plugin-owned budgets and core-owned matching.
  • Why: The current implementation materially improves responsiveness, but intentionally changes some large exports and adds supported SDK surface; no maintainer approval of those choices is recorded.

Before merge

  • Await maintainer action - A maintainer must review the sensitive redaction changes and satisfy the security approval gate for head ee8f161.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

The diagnostics-otel plugin receives model, tool, and log events, normalizes and redacts captured content synchronously, then sends bounded attributes and log bodies to telemetry exporters.

flowchart LR
  A[Model and tool events] --> C[OTel content normalization]
  B[Diagnostic log events] --> C
  C --> D[Core redaction matchers]
  E[Registered secret owner] --> D
  D --> F[Bounded attributes and log bodies]
  F --> G[OTLP or stdout exporter]
Loading

Technical review

Best possible solution:

Land one maintainer-approved capture strategy that keeps the Gateway responsive while core retains ownership of secret matching.

Do we have a high-confidence way to reproduce the issue?

The source exposes repeated whole-value redaction, corroborated by the incident profile and contributor's real-Gateway comparison; this read-only review did not rerun the workload.

Is this the best way to solve the issue?

The patch addresses repeated work at its owner and shares core matchers rather than copying secret grammar; its bounded completeness and SDK design still require an owner choice.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0a09e1ad0a87.

Provenance checked

  • OTel serialization and truncation changes intended behavior with a stated reason (0665c16: The helper extraction preserved telemetry keys, capture defaults, bounded serialization, and redaction semantics.)
  • Shared secret-matching semantics keeps the original intent (39b4bdb: Whole-text linear matchers repaired boundary leaks, quadratic scans, and oversized-value failures; bounded prefix redaction was deferred to owners.)
  • Registered-secret state ownership keeps the original intent (b6db30f: One process singleton owns registrations and matcher invalidation across module copies; the new cached length uses that owner and invalidation lifecycle.)
  • Mirrored content attributes keeps the original intent (12d398d: The prior refactor preserved content and telemetry privacy while simplifying capture policy; sharing one serialization retains the mirrored values.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Agustin Rivera: Raw commit 39b4bdb adds src/logging/redact-linear-matchers.ts:224 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 39b4bdbb6427; files: src/logging/redact-linear-matchers.ts)

PR surface

Source +518, Tests +977, Docs +17, Other +4. Total +1516 across 20 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 11 567 49 +518
Tests 6 979 2 +977
Docs 1 17 0 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 2 6 2 +4
Total 20 1569 53 +1516

Review metrics

Metric Value Why it matters
Public SDK additions 3 callable exports findTruncatedSecret, getLongestRegisteredSecretLength, and hasConfiguredRedactPatterns become supported logging-core surface requiring owner acceptance.

Labels

Label changes:

  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove status: ⏳ waiting on author: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P1: Opt-in content capture can block every channel on an affected Gateway during large sessions, with an independent multi-instance confirmation.
  • merge-risk: 🚨 compatibility: The patch intentionally changes large-value capture completeness and introduces three public SDK helpers.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-09T22:32:37.555Z sha a98c2d5 :: needs real behavior proof before merge. :: [P1] Preserve complete masked exports above the 4× cutoff | [P1] Mask registered values before cutting an open-secret prefix | [P1] Preserve the connection-string redactor's slash handling
  • reviewed 2026-10-10T13:03:38.217Z sha 4e5f4e1 :: needs real behavior proof before merge. :: [P1] Mask suffix-dependent vendor tokens before exporting their prefixes | [P2] Preserve the shared JWT matcher's case-insensitive prefix semantics
  • reviewed 2026-10-11T14:40:27.763Z sha 93f2f34 :: blocked before merge. :: none
  • reviewed 2026-10-11T14:53:13.189Z sha 93f2f34 :: blocked before merge. :: [P1] Detect form secrets when the following key is partially clipped
  • reviewed 2026-10-13T00:01:01.705Z sha 807dd94 :: blocked before merge. :: none
  • reviewed 2026-10-13T00:13:29.331Z sha 807dd94 :: blocked before merge. :: none
  • reviewed 2026-10-19T20:45:57.032Z sha 1cdda4a :: blocked before merge. :: none
  • reviewed 2026-10-20T21:54:52.016Z sha 6f80531 :: blocked before merge. :: none

Reviewed November 3, 2026, 6:19 AM ET / 11:19 UTC (Revision 18).

The bounded redaction window only matched a secret whose closing
delimiter fell inside the 4,096-character lookahead. Two cases still
exported the start of a secret:

- A quoted value whose closing quote lies past the window, such as
  {"password": "<5,000+ characters>"} in a text part, tool result or log
  body. The JSON secret-key, quoted-assignment, quoted-field, CLI-flag and
  escaped-env rules all need the closing quote, and JSON escaping hides
  the value from the second pass over the serialized attribute.
- Masks shorten the redacted window, so the export cut can reach into the
  lookahead. A fixed-length secret (an AWS secret key, a registered secret
  value) cut by the window end was then exported unmasked.

The window now checks the last quote of each kind: it asks the redactor
whether the text before that quote, a stand-in value and the closing
quote would be masked. If so, or if a private key has no END line, the
export ends with *** and the closing delimiter from where the value
starts. A window whose masks shorten it is redacted once more, widened by
twice the shortfall. If masks removed more than half of it, the export
keeps a full lookahead of redacted text after it and comes out shorter
than its budget.

Content without secrets exports the same bytes as before.
The probe that asks the redactor whether a quote opens a secret missed
three shapes and could grow large:

- It read "not open" whenever the redacted probe still contained the
  24-zero stand-in anywhere, so zeros in the key context (a push
  webhook's null commit id before "password") hid a secret.
- It took the 256 characters before the quote as the key context. The
  secret rules allow any whitespace between a key and its quote, so
  "password:" followed by 260 spaces lost the key.
- It carried the whole escape run before the quote twice, so 7,000
  backslashes made one probe over 14,000 characters.

The probe now checks only that its own stand-in and closing quote come
back unmasked, walks back over the separator before taking the key
context, collapses separator whitespace to one space and caps escapes at
64, the redactor's own limit for serialized quotes. Each probe stays
under 512 characters.

A quote before the last line break is now probed with a value that
crosses a line, so only rules for values spanning lines (JSON strings)
mask it. This applies to every quote kind, and stops text after an
unclosed quote at a line end from being masked when no rule would mask
it in the whole text.

Tests cover the 128K tool input and output paths. Their cut falls on
the core redactor's 16,384-character chunk boundary, which already
misses a token crossing it in the whole text, so the token-crossing test
skips them.
…word end

The probe's key context began exactly 256 characters before the
separator. When that cut fell inside a word such as `xtoken="`, the
probe began with `token="`, a quoted assignment the text does not have.
Its value ran to the quote after a later `password:`, so the stand-in
came back unmasked and a secret straddling the export cut was exported.

The context now starts on the first non-word character at or before the
cut, so the probe's start adds no boundary the text lacks. A context that
is one word throughout keeps its cut.

State the real redaction bound: masks and quote probes can make a
clipped string cost up to five windows, so a JSON attribute's work can
exceed the 8x window budget it is picked by. Cost tests now cover a
model call full of masked secrets, a log body full of quoted secrets
(probes and widening both run), and a long separator before a quote.
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 25, 2026
…action lookahead

Registered secrets only match as whole values. A registered value longer
than the 4,096-character lookahead that started just before an
attribute's cut ended past the redaction window, so its prefix reached
the exported attribute unmasked; the whole-value pass on main masked it.

Core now reports the longest registered secret length through
`getLongestRegisteredSecretLength()` in `openclaw/plugin-sdk/logging-core`,
cached with the matcher and reset on every membership change. The
lookahead is the longer of 4,096 characters and that length, for both the
redaction window and the 8x per-candidate work count, so a registered
secret that starts before the cut ends inside the window and is masked
whole. Without a registered secret over 4,096 characters every exported
attribute and redaction count is unchanged.

The new function adds one public export and one callable to the SDK
surface budgets.
A JSON value whose smallest truncation fit the attribute but not the 8x
redaction cap was exported as {"truncated":true,"reason":"max_attribute_size"}.
The cap dropped it, not its size, so the summary now says
`max_redaction_work`. An object of 512 strings of 5,000 characters reaches
it with no registered secret, and a registered surface form of about 1M
characters reaches it for a model call whose first message holds a longer
string.

The lookahead comment now states what a long registered secret costs:
every clipped string's window grows by its length, and JSON attributes keep
fewer items as it grows. A new test registers a 65,536-character secret and
keeps a 200 x 100,000 model call's redaction work under the model-call
bound. Counting only the 4,096-character minimum against the cap fails it
at 26,667,962 characters.

The core eviction test pins getLongestRegisteredSecretLength() across
registration, eviction and reset. The plugin imports redactSensitiveText
from openclaw/plugin-sdk/logging-core instead of the deprecated
security-runtime barrel, and the SDK docs paragraph moves after the matcher
contract and says the length counts the URL-encoded and JSON-escaped forms.
Main now imports redactSensitiveText in service-content-normalization.ts
straight from the SDK; this branch keeps the ../api.js import, which the
redaction-cost tests wrap. Main's plugin SDK public export and callable
budgets (4590 and 2694) rise by one each for
getLongestRegisteredSecretLength().
src/logging/redact.test.ts is over the 1,000-line cap, and the line-cap
ratchet rejects the five lines the longest-length assertions added. The
two eviction tests move, with those assertions, to
secret-redaction-registry.test.ts, the registry's own test file; nothing
else in them changes.

The summary-reason fixture no longer shadows `_` in nested callbacks
(oxlint no-shadow).
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts labels Sep 27, 2026
@amittell

Copy link
Copy Markdown
Contributor Author

Updated the branch and Evidence section at 6f8053117fe3750c77010510be39036ca39d1f6d. The merge preserves the shared content-attribute helper and bounded normalization. Fresh checks passed: 182 tests across four files, SDK surface 3,813/2,211, core and extension types, typed lint and format. Both historical CI reference arms also passed their five original cases; that is non-reproduction, with the hardware and cache limits recorded in the body. Current CI is queued. Exact-head security approval and acceptance of the capture bounds and three-function SDK surface remain required.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Main and this branch both raised the plugin SDK public export budgets.
Keep both justifications and sum the increments: publicExports
3810 + 5 (main) + 3 (this branch) = 3818, publicFunctionExports
2208 + 3 (main) + 3 (this branch) = 2214.

Copy link
Copy Markdown
Contributor Author

Updated the description for 34a5fbe2e58dba058699b45074fabf1cb18b4545; the October 20 test and Gateway results are now explicitly historical.

CI 39795491565 is still failing. Its executed merge 0173c137fdeb87a73f8c99bc6e794d3616d82906 has the same Twitch outbound, config-agent test-support and node-worker e2e blobs as exact base 3cd9bddb36d93d43b50595dfd0d5b18a4478a0c9. That source comparison does not establish that the config-revision or workspace-hash failures reproduce on the base; matched runtime controls remain outstanding. The missing Twitch helpers already have an upstream repair.

No source change or CI rerun in this update. The latest source review reports no findings at 6f805311; acceptance of reduced capture completeness and the three logging SDK methods, plus security approval for 34a5fbe2, remain maintainer decisions.

…penclaw#180713

openclaw#180713 moved MAX_OTEL_LOG_BODY_CHARS out of service-constants.ts into its
only production consumer, service-logs.ts, as a module-private const. This
branch's test-api.ts and service-content-normalization.test.ts still
imported it from service-constants.js. The merge with main applied without a
textual conflict, but tsgo reported TS2305 in both files, and at run time the
cap read as undefined: 14 content-normalization tests and the 2 root
registered-secret tests failed.

Export the constant from service-logs.ts, which owns it, and import it from
there. The value (4 KiB) and its production use are unchanged.
Integrate main and keep clipped open-secret results unsettled while registered values exist so the bounded retry masks newly exposed prefixes.

Add registry and emitted-body regressions. Validate 198 focused cases, fail-before controls, work/lookahead mutations, and touched format/type/lint checks. SDK surface overages match an executed exact-main control; maintainer capture, SDK and security decisions remain open.
Integrate the exact hosted base and set the test-line ceiling to the verified
6,311,628 total: 977 regression lines plus 91 lines already above the base
ceiling. Keep all cases and assertions unchanged.

Validate 235 focused cases, touched-file format, and the ratchet's pass,
one-line failure, and restored-pass controls.
Resolve the concrete baseline conflict with upstream openclaw#186980 while retaining
its SQLite regression coverage and all 977 telemetry regression lines.
Measure the pinned base at 6,310,907 lines and the combined tree at 6,311,884;
set that exact ceiling without extra allowance.

The ratchet passes, rejects one added line, and passes after restoration.
Touched-file format, source identities and 13 integration cases pass.
Integrate main through 0ded0ed while retaining all 977 telemetry regression lines and the upstream 6,320,000-line ceiling.

The code and test blobs match tree 7b0e0d5cd879f427cccce76255dae5b3f19ca272, where 25 focused cases passed. The final tree changes only the upstream baseline; its ratchet positive, over-ceiling negative and restored controls exit 0, 1 and 0. Formatting and diff checks pass.
Resolve scripts/plugin-sdk-surface-report.mts by keeping main's budget notes
and this branch's note, and setting the public budgets to main's 3,859
exports and 2,232 callable exports plus this branch's three logging-core
functions: 3,862 and 2,235, which plugin-sdk:surface:check measures on the
merged tree.
Record the 977 test lines this branch adds over main 2e24ab7 (normalization 772, open-secret 66, registered-secret consumer 63, emitted-body capture 36, registry 31, logging config 9) as a separate allocation, as the test-line budget requires for justified growth.
@amittell

amittell commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@amittell

amittell commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #186666, which fixed #158116 on main with a different approach: a per-export redaction memo, a 4x bound on whole-JSON redaction, and dropping oversized inline image bytes.

I re-ran this PR's own 1M-window Gateway harness against main cada32bb050: /readyz max 225 ms with 0 of 160 probes over 250 ms, against 1,226 ms with 7 probes over 1 s on the main this PR was measured on. Thanks for landing it.

@amittell amittell closed this Nov 6, 2026
amittell added a commit to amittell/openclaw that referenced this pull request Nov 11, 2026
…law#186666's oversized-image drop

v2026.11.2 carries upstream openclaw#186666 (bc871e7), which superseded openclaw#158145 upstream. The fork
keeps its openclaw#158145 normalizer: with the tag's two content files in its place, 11 of the fork's
own content-normalization tests fail (231/242 against 240/242 at 3eefd13, on the M4).

Two of 11.2's new tests in service-genai-content.test.ts failed on the fork's normalizer:

- "drops image bytes too large to export whole and keeps smaller images": the fork exported a
  truncated prefix of the bytes. Take openclaw#186666's drop in redactInternalReasoningParts as is, and
  export MAX_OTEL_CONTENT_ATTRIBUTE_CHARS from the normalizer for it.
- "redacts each string of a large transcript once and masks it in every attribute (openclaw#158116)":
  the spy sat on plugin-sdk/security-runtime, but the fork's normalizer reaches
  redactSensitiveText through plugin-sdk/logging-core (its api.ts), so it saw no calls. The mock
  now targets logging-core. The fork redacts bounded windows of what it exports rather than
  memoizing whole strings, so no call ever equals a whole tool output; "once per string" becomes
  the same bound on total work: redacted characters <= transcript characters. Measured on this
  transcript: 248 calls, 662,311 characters for 800,590, largest call 84,803 (<= 4x budget),
  98 ms, no secret in any attribute. Redacting each string per attribute would be about 3x the
  transcript. The masking assertions are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: diagnostics-otel Extension: diagnostics-otel merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-review-required security-sensitive-changed size: XL status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: diagnostics-otel content capture blocks the gateway for ~150 s after each model call on large sessions

2 participants