Skip to content

fix(gateway): honor requested session preview length - #125201

Merged
steipete merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-session-preview-length
Aug 23, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-session-preview-length

Conversation

@Alix-007

@Alix-007 Alix-007 commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Refs #124997

What Problem This Solves

Fixes an issue where sessions.preview callers requesting more than 240 characters would still receive only 240 after the shared display projection landed in #124997. Browser Talk also requests 800 characters per initial context item, so the same cap silently discarded context there.

Why This Change Was Made

The shared projection treated 240 as an unconditional ceiling even though its maxChars option represents a caller-owned budget. The projection now uses 240 only when the option is omitted and honors an explicit valid budget at the canonical owner.

This deliberately does not address the separate first-user title-source finding from #124997. Alternatives rejected: raising the global default, compensating in the RPC handler, or creating a second preview projection would change unrelated consumers or duplicate policy.

Credit to @steipete for #124997 and to its exact-head ClawSweeper review for identifying the remaining preview-budget regression.

User Impact

Session preview consumers can request the amount of visible context they need. Existing callers that omit maxChars keep the 240-character default, while Talk and RPC callers using an explicit larger budget receive it without losing UTF-16 safety or visibility filtering.

Evidence

  • Parent-red, before the owner fix: node scripts/run-vitest.mjs src/gateway/session-display-projection.test.ts src/gateway/server.sessions.preview-resolve.test.ts ran 15 tests; the new unit and real SQLite RPC regressions were the only two failures, each receiving 240 instead of 800.
  • Green on current base 076a8cc616366: the projection unit, SQLite RPC, and Talk sibling suites pass together, 3 files and 81 tests.
  • Existing controls cover the omitted-option 240 default, UTF-16-safe truncation, visible-only projection, and Talk's explicit 800-character request.
  • Targeted type-aware oxlint, oxfmt check, git diff --check, dirty autoreview, and an independent read-only Codex review are clean with no actionable P0/P1 findings.
  • Changed gate passed formatting, boundary, ratchet, dead-export, and other pre-type stages. Its core typecheck reached two unrelated untouched checkout/dependency errors (packages/terminal-core/src/ansi.ts and the missing local @openclaw/session-url-contract/parse link); exact-head CI is the authoritative full type gate.
  • Production LOC: +3/-5 (net -2). Tests: +38/-0.

Real SQLite and Gateway preview proof

  • Tested the unchanged PR head bd69181013ac983d934da5945825cf0b9335be3e in proof run 32030179825, which completed successfully on Node 24 in 8m09s.
  • The proof harness creates the real per-agent SQLite database through production session APIs, seeds two sessions and four transcript rows, starts a real child Gateway, and uses an authenticated operator.read WebSocket client for sessions.preview.
  • Observed after the fix: { maxChars: 800 } returned one visible assistant item with exactly 800 UTF-16 code units; omitting maxChars retained the 240-unit default; the surrogate-boundary fixture returned 239 units without an unpaired surrogate. The seeded tool-result rows remained excluded.
  • Inspectable artifact: pr125201-session-preview-real-gateway-proof-32030179825-1, archive digest sha256:c7c89446013f9428cfd8ac507bbfd0ae2fedb5c716214ad2240e1e444d0b4573. Downloaded hashes independently revalidated: result.json 543d573525f2f2682358137f0dce256ef86eb581b957df1f02f8cd589e68f1ed; full rpc-responses.json 34c44ea8c464f3ca10cc87cbeeb7f430a0bd723a063ff45ec8717d9eb79429cc; run.log 008c2cf66761915a3bde0c54ed97c97e5ec72164cdfd176f0b318b6320547984.
  • The proof is evidence-only on alix/proof-125201; the PR code/head was not changed.

Oversized preview-budget exact-head proof

Exact repair head: 218fd13185c3945cf8c371a6c6ed4a81a7de5053 (unchanged).

On 2026-08-21, the exact head passed a clean, isolated direct-local-Docker fallback run on Node 24.19.0. The container used the default seccomp profile, had no host mounts, and received no credential-bearing environment variables. This is local Docker evidence, not AWS/Testbox remote proof.

The one-shot harness used production upsertSessionEntryCore and persistSessionTranscriptTurn writers to create the real per-agent SQLite database, verified the SQLite format 3\0 header at agents/main/agent/openclaw-agent.sqlite, started a real child Gateway, completed token-authenticated WebSocket hello as operator with operator.read, and invoked sessions.preview through the public RPC path.

Observed result:

  • Oversized request maxChars: 50000: exactly 800 UTF-16 code units, one visible assistant item, tool-result row excluded, no unpaired surrogate.
  • Explicit ceiling control maxChars: 800: exactly 800 code units.
  • Omitted-budget control: exactly 240 code units.
  • Repo-native run: 1 file / 1 test passed; behavior portion 34.5s.
  • Sanitized artifact SHA-256: 6782691da61336d6e876477dd50c3412da4e5fd9e0b767607168c1138a514d95.
  • Production LOC remains +6/-4 (net +2). Tests remain +53/-5 (net +48). The PR branch/head was not changed.
Sanitized exact-head result.json
{
  "schemaVersion": 1,
  "verdict": "PASS",
  "head": "218fd13185c3945cf8c371a6c6ed4a81a7de5053",
  "runtime": {
    "node": "v24.19.0",
    "platform": "linux"
  },
  "storage": {
    "engine": "SQLite",
    "agentId": "main",
    "databaseRelativePath": "agents/main/agent/openclaw-agent.sqlite",
    "sqliteHeader": "SQLite format 3\\0",
    "seededSessionEntries": 1,
    "seededTranscriptRows": 2
  },
  "gateway": {
    "childProcess": true,
    "bind": "loopback",
    "transport": "WebSocket",
    "authMode": "token",
    "authenticatedHello": true,
    "clientRole": "operator",
    "scopes": [
      "operator.read"
    ],
    "method": "sessions.preview"
  },
  "oversizedRequest": {
    "requestedMaxChars": 50000,
    "sourceCodeUnits": 1600,
    "returnedCodeUnits": 800,
    "expectedCap": 800,
    "visibleItems": 1,
    "excludedToolRows": 1,
    "utf16Safe": true,
    "returnedTextSha256": "cc1d624a46c2851322146c60f5260b4feae912d4716daae54512d4065cfa1fda",
    "response": {
      "key": "agent:main:proof:preview-cap",
      "status": "ok",
      "items": [
        {
          "role": "assistant",
          "text": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..."
        }
      ]
    }
  },
  "controls": {
    "explicit800ReturnedCodeUnits": 800,
    "omittedBudgetReturnedCodeUnits": 240
  },
  "redaction": {
    "omitted": [
      "gateway token",
      "port",
      "pid",
      "hostname",
      "absolute paths"
    ]
  }
}

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Aug 17, 2026
@Alix-007
Alix-007 marked this pull request as ready for review August 17, 2026 09:53
@Alix-007

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 1:36 AM ET / 05:36 UTC.

ClawSweeper review

What this changes

The PR changes shared session-preview truncation so explicit caller budgets can reach a bounded 800 characters while omitted budgets retain the 240-character default.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking findings. Current main still unconditionally caps explicit preview budgets at 240, while the PR repairs that at the shared projection owner and preserves the default; refresh the clean merge result and required checks against current main before landing.

Priority: P2
Reviewed head: 218fd13185c3945cf8c371a6c6ed4a81a7de5053

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The patch is a focused owner-boundary repair with strong direct, RPC, sibling-path, and real-Gateway evidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Exact-head proof uses production SQLite writers, a real child Gateway, and authenticated sessions.preview RPC to show explicit 800, default 240, bounded oversized input, filtering, and UTF-16 safety.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Exact-head proof uses production SQLite writers, a real child Gateway, and authenticated sessions.preview RPC to show explicit 800, default 240, bounded oversized input, filtering, and UTF-16 safety.
Evidence reviewed 6 items Current-main defect: Current main clamps every projected message to 240 even when a caller supplies a larger budget, so the requested value cannot reach the observable preview output.
RPC caller and protocol contract: The public sessions.preview schema accepts maxChars from 20 upward, and the Gateway handler forwards that validated budget to the transcript reader.
Invariant-sharing Browser Talk caller: Browser Talk requests 16 context items at 800 characters each and separately enforces its total startup-context byte ceiling, so repairing the shared per-item projection covers the sibling path without duplicating policy.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/session-display-projection.test.ts src/gateway/server.sessions.preview-resolve.test.ts

Result: FAIL (partial) — step 2 expect_output passed: expected terminal output was not visible within 30 seconds: "passed"

node scripts/run-vitest.mjs src/gateway/session-display-projection.test.ts src/gateway/server.sessions.preview-resolve.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-125201-vnXeFm/target$ node scripts/run-vitest.mjs src/gateway/session-display-projection.test.ts src/gateway/se
rver.sessions.preview-resolve.test.ts
node scripts/run-vitest.mjs src/gateway/session-display-projection.test.ts src/gateway/server.sessions.preview-resolve.test.ts
[test] starting test/vitest/vitest.gateway.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-125201-vnXeFm/target

 ✓  gateway-core  ../../src/gateway/session-display-projection.test.ts (5 tests) 56ms










































Assertions:

  • FAIL expect_output: passed

How this fits together

Gateway converts persisted session transcripts into filtered, UTF-16-safe snippets for session-preview RPC calls and Browser Talk startup context. Callers supply a per-item budget, and the shared projection returns bounded visible text to those consumers.

flowchart LR
  A[Persisted session transcript] --> B[Transcript reader]
  C[RPC or Browser Talk budget] --> B
  B --> D[Shared display projection]
  D --> E[Visibility filtering]
  E --> F[UTF-16-safe bounded text]
  F --> G[Session preview RPC]
  F --> H[Browser Talk context]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; GitHub reports a clean merge, but maintainers should refresh the merge result and required checks on the landing head.
  • Complete next step (P2) - No repair task remains; refresh the current-main merge result and exact-head required checks for normal maintainer landing.
Agent review details

Security

None.

PR surface

Source +2, Tests +48. Total +50 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 4 +2
Tests 2 53 5 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 59 9 +50

Review metrics

Metric Value Why it matters
Production versus test LOC production +2, tests +48 The small production increase distinguishes the preserved 240 default from the shared 800 ceiling; focused tests cover direct and RPC behavior.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/session-display-projection.test.ts, unknown-data-model-change: src/gateway/session-display-projection.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared-owner repair after a current-main merge and exact-head gate refresh, keeping the 240 default, the 800 per-item ceiling, and Browser Talk’s independent total-byte ceiling.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the shared-owner repair after a current-main merge and exact-head gate refresh, keeping the 240 default, the 800 per-item ceiling, and Browser Talk’s independent total-byte ceiling.

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

Yes. Current main forwards explicit maxChars through sessions.preview and Browser Talk but the shared projection caps it at 240; the PR also supplies after-fix Gateway proof.

Is this the best way to solve the issue?

Yes. Repairing the shared projection is the narrow canonical fix because both RPC and Browser Talk reach it; changing either consumer would duplicate truncation policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f5553a8fee0e.

Labels

Label justifications:

  • P2: This repairs bounded session-preview context loss without evidence of an urgent availability or security impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Exact-head proof uses production SQLite writers, a real child Gateway, and authenticated sessions.preview RPC to show explicit 800, default 240, bounded oversized input, filtering, and UTF-16 safety.
  • proof: sufficient: Contributor real behavior proof is sufficient. Exact-head proof uses production SQLite writers, a real child Gateway, and authenticated sessions.preview RPC to show explicit 800, default 240, bounded oversized input, filtering, and UTF-16 safety.

Evidence

What I checked:

  • Current-main defect: Current main clamps every projected message to 240 even when a caller supplies a larger budget, so the requested value cannot reach the observable preview output. (src/gateway/session-display-projection.ts:70, f5553a8fee0e)
  • RPC caller and protocol contract: The public sessions.preview schema accepts maxChars from 20 upward, and the Gateway handler forwards that validated budget to the transcript reader. (src/gateway/server-methods/sessions-read.ts:524, f5553a8fee0e)
  • Invariant-sharing Browser Talk caller: Browser Talk requests 16 context items at 800 characters each and separately enforces its total startup-context byte ceiling, so repairing the shared per-item projection covers the sibling path without duplicating policy. (src/gateway/server-methods/talk-client.ts:253, f5553a8fee0e)
  • Canonical branch repair: The branch separates the 240-character omitted-option default from an 800-character shared maximum, clamps explicit values at the owner, and adds direct and Gateway-RPC regression coverage. (src/gateway/session-display-projection.ts:68, 218fd13185c3)
  • Current-path provenance: Blame ties the current unconditional clamp lines on main to the recorded current-main commit; the related merged projection refactor is commit 4e1f26d. (src/gateway/session-display-projection.ts:71, a4dbe235f846)
  • After-fix behavior proof: The PR body and current maintainer verification report exact-head real SQLite, child-Gateway, authenticated WebSocket proof for explicit 800, omitted 240, oversized-input capping, filtering, and UTF-16 safety. (218fd13185c3)

Likely related people:

  • steipete: The merged shared display-projection refactor is the direct feature predecessor, and the latest PR discussion contains the focused landing verification. (role: feature introducer and recent reviewer; confidence: high; commits: 4e1f26dc1892; files: src/gateway/session-display-projection.ts, src/gateway/server-methods/talk-client.ts)
  • Jason O'Neal: Current-main blame attributes the unconditional projection clamp to the recorded main-path commit, although available local history does not establish broader feature ownership. (role: current-main line author; confidence: low; commits: a4dbe235f846; files: src/gateway/session-display-projection.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-17T10:31:49.225Z sha bd69181 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-17T10:38:53.577Z sha bd69181 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-17T11:54:23.445Z sha bd69181 :: needs real behavior proof before merge. :: [P2] Retain an upper bound for explicit preview budgets
  • reviewed 2026-08-17T13:08:38.957Z sha bd69181 :: needs changes before merge. :: [P2] Retain a finite maximum for preview budgets
  • reviewed 2026-08-17T13:26:03.274Z sha bd69181 :: needs changes before merge. :: [P2] Keep an upper bound on preview budgets
  • reviewed 2026-08-18T02:29:58.625Z sha 218fd13 :: needs real behavior proof before merge. :: [P2] Capture exact-head proof for the new preview ceiling
  • reviewed 2026-08-20T19:06:01.751Z sha 218fd13 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-22T05:09:20.738Z sha 218fd13 :: needs maintainer review before merge. :: none

@wintermute-texture

Copy link
Copy Markdown

Nudge: This PR has been awaiting review for over 3 hours.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 17, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 17, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact head: 218fd13185c3945cf8c371a6c6ed4a81a7de5053. The oversized-budget P2 is repaired at the shared projection owner, with direct, RPC, and Talk focused tests passing 24/24.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 18, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer landing verification for exact contributor head 218fd13185c3945cf8c371a6c6ed4a81a7de5053:

  • Root cause: Browser Talk already requests 800-character session context, but projectSessionDisplayMessage incorrectly reused the 240-character default as an unconditional hard ceiling.
  • Canonical repair: keep the existing 240-character default while honoring explicit requests up to a bounded 800-character maximum in the shared Gateway projection owner; this also repairs the sibling sessions.preview RPC path.
  • Focused exact-head proof: node scripts/run-vitest.mjs src/gateway/session-display-projection.test.ts src/gateway/server.sessions.preview-resolve.test.ts — 15 tests passed across both owner and Gateway boundaries.
  • Real behavior proof: production SQLite transcript writers, a real child Gateway, and authenticated sessions.preview WebSocket RPC verified explicit 800-character previews, the unchanged 240-character default, and oversized input capped at 800.
  • Safety: existing role/control-reply filtering and UTF-16-safe truncation remain unchanged; Browser Talk additionally preserves its independent 8,000-byte total context cap.
  • Fresh structured Codex autoreview and a separate sandboxed independent Codex review both found no actionable issues. The exact-head required openclaw/ci-gate is green; all 274 checks are successful, neutral, or intentionally skipped.
  • ClawSweeper rank-up items: GitHub currently reports a clean merge; positive production delta +6/-4 (net +2) is necessary to represent the distinct preserved default and hard ceiling without duplicating caller policy. Test delta is +53/-5.
  • Before/after screenshots are inapplicable because the repaired value is hidden Browser Talk model context, not a visible browser surface; authenticated Gateway behavior is the direct observable proof.

Contributor credit remains with @Alix-007.

@steipete
steipete merged commit 33abd62 into openclaw:main Aug 23, 2026
463 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
* fix(gateway): honor session preview length

* fix(gateway): cap session preview budgets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants