Skip to content

fix: PostgreSQL sessions fail to load model context when a transcript has an unpaired surrogate escape - #194591

Merged
obviyus merged 8 commits into
openclaw:mainfrom
ylcn91:fix/194517-pg-lone-surrogate-context
Nov 9, 2026
Merged

obviyus merged 8 commits into
openclaw:mainfrom
ylcn91:fix/194517-pg-lone-surrogate-context

Conversation

@ylcn91

@ylcn91 ylcn91 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #194517

What Problem This Solves

On PostgreSQL, a session whose transcript holds a JSON-escaped lone surrogate (for example a tool result or a user message with \ud83d or \udc00 alone) or an escaped NUL broke: the next turn failed with invalid input syntax for type json (22P02), and a user message containing NUL could not be stored at all (22021, the whole append rolled back). SQLite handles the same transcripts.

Why This Change Was Made

PostgreSQL stores each transcript event as its original JSON text. jsonb rejects escaped NUL and unpaired surrogate escapes, while json, SQLite and JavaScript accept them. Several readers cast stored event text to jsonb, some behind jsonValid(), which checks json validity and so lets these rows through. Separately, the transcript full-text index wrote the message text into a PostgreSQL text column, which cannot hold 0x00.

User Impact

PostgreSQL-backed sessions holding these characters keep working: turns complete, chat history shows the original text, search finds the message, and stored rows are not rewritten.

The fix

One guard owns "read stored transcript JSON natively on PostgreSQL": the existing jsonNativeFieldsValid() (pg_input_is_valid(x, 'jsonb'), from #183560). Rows it rejects reach JavaScript unchanged and are decoded there.

  • ylcn91's commits: the per-turn model-context reader routes these rows through the shared JavaScript projection (projectModelContextJson), keeps that classification across cached navigation pages, and moves tree and reset-boundary navigation onto the guard.
  • Added on top:
    • projectModelContextNavigationSql (detached context validation, reset kept-tail window, dependency fallback): guarded, and the cast is fenced so bound writer inputs cannot be constant-folded past the guard.
    • Bounded active-context dependency fallback, chat.history run-input visibility and the transcript mirror run lookup: guarded field reads; undecodable rows are matched in JavaScript with the existing readers.
    • Retained custom-data suffix reads: guarded; undecodable rows keep their data and are rewritten byte for byte, the path SQLite already uses for over-depth rows.
    • Session-entry maintenance: guarded.
    • Full-text index: NUL in the derived search text becomes a space on both engines. The transcript row keeps the original bytes.

No schema change, no migration, no rewrite of stored rows, nothing stripped from the stored transcript.

Follow-ups, not in this PR: the Doctor session-entry rewrite still casts entries to jsonb; readTranscriptMirrorFacts with an empty key list and a sourceRunId emits IN () on PostgreSQL (unrelated, pre-existing).

Evidence

Built Gateway (node 24.22.1, Docker, PostgreSQL 17.11 official image, local fixture model provider), main twice, candidate twice, SQLite once each. Proof comment: #194591 (comment)

scenario main PostgreSQL this PR PostgreSQL SQLite (both)
tool result with lone \ud83d, follow-up turn 22P02 completes completes
user message with lone \udc00, follow-up turn 22P02 completes completes
user message with NUL 22021, message dropped stored, follow-up completes, search finds it same
idle reset keeping a tail with \udc00 22P02 reset written with firstKeptEntryId, follow-ups complete same
chat.history ok ok, characters kept ok
existing rows after follow-ups unchanged unchanged unchanged
schema dump identical identical

Regression: session-transcript-portability.conformance.test.ts "reads, validates and indexes escapes JSONB rejects without rewriting rows" covers the model-context reads (full, bounded twice, async), detached validation, the active-context fallback, the retained-data suffix read, the mirror lookup, run-input visibility and full-text search on both engines. Main: SQLite passes, PostgreSQL fails (22021). This PR: both pass.

Thanks to @ylcn91 for the fix and the cache-classification follow-up, and @reisball for the report and reproduction.

PostgreSQL rejects JSON-escaped unmatched surrogates (\ud800) and NUL when
casting transcript event_json to jsonb (SQLSTATE 22P02), so model-context
reads failed for rows SQLite reads fine. Route those rows through the same
JavaScript projection owner SQLite uses for deep JSON instead of the native
jsonb projection; stored rows stay byte-identical.

Fixes openclaw#194517
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T11:25:17.520667Z 690febf PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 690febf138

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

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 7, 2026
@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR keeps PostgreSQL sessions readable when transcript JSON contains lone surrogate escapes or NUL, while preserving canonical transcript bytes.

Example: A PostgreSQL session stores a tool result containing the escaped lone surrogate \ud83d, then receives another user turn.

  • Before: Model-context loading fails with SQLSTATE 22P02.
  • After: The follow-up turn completes using the JavaScript projection, with the original transcript text preserved.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-level repair with shipped-Gateway evidence, two-engine regression coverage, and no open correctness finding; required current-head CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Collaborator proof exercises the built Gateway against PostgreSQL 17.11 with a local fixture model provider: surrogate and NUL scenarios fail on main and complete on the candidate, including reset continuation, history, search, and unchanged stored rows; SQLite controls pass.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A PostgreSQL conversation can stop accepting useful follow-up turns after a surrogate-bearing transcript entry, and a NUL-bearing message can roll back during search indexing.
Reason: The patch restores the existing transcript-readability contract without new settings, schema changes, or canonical-data sanitization.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete PostgreSQL session failure that remains on current main; no actionable introduced defect was found, and the earlier cache finding is resolved.

Priority: P2
Reviewed head: fc6c19e793cf988c47c4e9771be581fd0791d6d9

Before merge

None.

Findings

None.

Agent review details

How this fits together

Session storage supplies transcript navigation, model context, chat history, and search; native SQL handles decodable rows, while existing JavaScript projectors handle exceptional JSON.

flowchart TD
  A[Transcript append] --> B[Canonical JSON storage]
  A --> C[Derived search text]
  B --> D[Native JSON validity guard]
  D --> E[Native SQL projection]
  D --> F[JavaScript projection]
  E --> G[Model context and history]
  F --> G
Loading

Technical review

Best possible solution:

Land the existing guarded-reader repair after the required checks pass, preserving canonical bytes and the shared projection owners.

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

The pinned main source exposes the rejecting JSONB casts, and the report plus collaborator Gateway proof record the corresponding PostgreSQL failures; this read-only review ran no target code.

Is this the best way to solve the issue?

The repair addresses the native-decoding boundary using existing guards and JavaScript projectors, retains cached classification, and normalizes NUL only in derived search text.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9a26486062c8.

Provenance checked

  • PostgreSQL native model-context projection keeps the original intent (b197b24: Share native JSONB intermediates and exact byte accounting while avoiding repeated parsing.)
  • JavaScript exceptional-row projection keeps the original intent (c7bd622: Keep valid deep transcripts readable without truncating or rewriting canonical payloads.)
  • Native JSON field validity keeps the original intent (90fa9d5: Preserve exceptional JSON semantics across engines by guarding native decoding and retaining original text.)
  • Hidden run-input visibility keeps the original intent (623f22c: Keep child coordination hidden while preserving visible human input and useful replies.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b197b24 adds src/config/sessions/session-model-context-projection.ts:184 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b197b24e1a3b; files: src/config/sessions/session-model-context-projection.ts)
  • jondihaynes: Raw commit c7bd622 adds src/config/sessions/session-model-context-projection.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c7bd622b9502; files: src/config/sessions/session-model-context-projection.ts)

PR surface

Source +123, Tests -4. Total +119 across 22 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 10 214 91 +123
Tests 12 214 218 -4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 428 309 +119

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test changes Production +214/-91; tests +214/-218. Production growth covers native guards and existing-owner fallbacks across affected readers; test consolidation preserves the distinct contracts while adding the two-engine regression.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Specific exceptional transcript contents block PostgreSQL session continuation, with a bounded repair and supporting Gateway evidence.
  • 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.
  • 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 (4 earlier review cycles)
  • reviewed 2026-11-07T11:33:09.812Z sha 690febf :: needs real behavior proof before merge. :: [P1] Preserve exceptional-row classification across cached reads
  • reviewed 2026-11-07T12:27:25.612Z sha 8e262ab :: needs maintainer review before merge. :: none
  • reviewed 2026-11-09T06:52:11.285Z sha 0b5d721 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-09T07:32:25.615Z sha ac12ee1 :: needs maintainer review before merge. :: none

Reviewed November 9, 2026, 3:14 AM ET / 08:14 UTC (Revision 5).

@ylcn91

ylcn91 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 Nov 7, 2026
PostgreSQL jsonb rejects escaped NUL and unpaired surrogate escapes that
stored transcript JSON text may hold. Route every native read of stored
transcript and session JSON through jsonNativeFieldsValid and decode the
rows it rejects in JavaScript: model-context navigation (detached
validation, reset kept tail, dependency fallback), run-input visibility,
mirror run lookup, retained custom-data suffix reads and staging, and
session-entry maintenance. Full-text index text replaces NUL with a space
so a NUL-bearing message no longer aborts its append; stored rows keep
their original bytes.

Builds on ylcn91's model-context reader fix. Drops the test-line
allocation and folds duplicated session test setup into shared helpers.
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Proof on 0b5d721c277b (built Gateway, node 24.22.1 in Docker, official postgres:17 17.11, local fixture model provider; main b59c593cb0b7 twice, this PR twice on PostgreSQL, SQLite once each).

scenario main PostgreSQL (2 runs) this PR PostgreSQL (2 runs) SQLite main / PR
ordinary session, 2 turns ok ok ok / ok
tool result with lone \ud83d, follow-up 22P02 completes, request carries the tool call and result ok / ok
user message with lone \udc00, follow-up 22P02 completes ok / ok
user message with NUL 22021 at the full-text insert, message dropped stored, follow-up completes ok / ok
idle reset keeping a tail with \udc00, 2 follow-ups 22P02 reset written with firstKeptEntryId, both complete ok / ok
chat.history ok ok, \ud83d \udc00 \u0000 kept ok / ok
sessions.search for a nearby word NUL message absent finds it (user nulword tailword) finds it / finds it
existing rows after follow-ups (md5 of event and navigation text) unchanged unchanged unchanged
schema dump main vs PR identical (sha256 b2dbb13975aca037…)

Regression session-transcript-portability.conformance.test.ts "reads, validates and indexes escapes JSONB rejects without rewriting rows" (model context full/bounded twice/async, detached validation, active-context fallback, retained-data suffix read, mirror lookup, run-input visibility, search): main SQLite pass, main PostgreSQL fail (22021); this PR both pass. oxlint, lint:kysely, tsgo, tsgo:test clean; 12 related session test files pass.

@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
…unchanged

The PostgreSQL-only dependency guard leaves SQLite's covered-fact plan as
it was, parent repair of retained data goes back to its single native
statement, and the mirror source marker compares without a conversion.
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
…e path

Rows the native JSON guard rejects keep their custom data instead of being
stripped in JavaScript, so suffix cleanup copies them byte for byte like
SQLite's over-depth rows instead of reaching native parent repair.
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@obviyus
obviyus merged commit 8633af9 into openclaw:main Nov 9, 2026
171 of 173 checks passed
@obviyus

obviyus commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Landed in 8633af9. Thanks @ylcn91 and @reisball. Postgres sessions with lone surrogates or NUL no longer fail.

github-actions Bot pushed a commit to tbohda2025/openclaw that referenced this pull request Nov 9, 2026
… has an unpaired surrogate escape (#194591)

fix(sessions): read and index Postgres transcripts that contain escapes jsonb rejects

Fixes #194517.

On PostgreSQL, session transcript JSON that contains an escaped lone surrogate (for example \ud83d) or an escaped NUL cannot be cast to jsonb. Every follow-up turn in such a session failed with 22P02, and a user message containing NUL could not be stored at all, because the full-text index insert failed with 22021 and the message was dropped. SQLite accepts the same text. Every transcript and session-context read now routes stored JSON through the existing jsonNativeFieldsValid guard: rows Postgres can't cast are decoded in JavaScript instead. NUL is replaced by a space only in the derived full-text search text. There is no schema change, no migration, and no rewrite or stripping of stored rows.

Covered: the model-context reader and its navigation cache, tree and reset-boundary navigation, detached-context validation, the reset kept-tail window, the active-context fallback, chat.history run-input visibility, the transcript mirror run lookup, retained custom-data reads, session-entry maintenance, and the full-text index on both engines.

Evidence: built Gateway on node 24.22.1 in Docker with postgres:17 and a local fixture model provider, two runs per build, SQLite once each. On main, a follow-up turn after a tool result with a lone \ud83d or a user message with a lone \udc00 failed with 22P02; a user message with NUL was dropped (22021); an idle reset keeping a tail with \udc00 failed. With this change all of these complete, chat.history returns the messages with the characters kept, search finds the NUL message, existing rows are byte-identical, and the schema dumps are identical. Ordinary sessions and SQLite behave the same. Details: openclaw/openclaw#194591 (comment).

Follow-ups not in this change: Doctor's session-entry rewrite, the SQLite-to-PostgreSQL port of stored NUL full-text rows, and an older IN () bug in readTranscriptMirrorFacts.

Thanks @ylcn91 for the original fix and @reisball for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to u2022Ljw/openclaw that referenced this pull request Nov 9, 2026
… has an unpaired surrogate escape (#194591)

fix(sessions): read and index Postgres transcripts that contain escapes jsonb rejects

Fixes #194517.

On PostgreSQL, session transcript JSON that contains an escaped lone surrogate (for example \ud83d) or an escaped NUL cannot be cast to jsonb. Every follow-up turn in such a session failed with 22P02, and a user message containing NUL could not be stored at all, because the full-text index insert failed with 22021 and the message was dropped. SQLite accepts the same text. Every transcript and session-context read now routes stored JSON through the existing jsonNativeFieldsValid guard: rows Postgres can't cast are decoded in JavaScript instead. NUL is replaced by a space only in the derived full-text search text. There is no schema change, no migration, and no rewrite or stripping of stored rows.

Covered: the model-context reader and its navigation cache, tree and reset-boundary navigation, detached-context validation, the reset kept-tail window, the active-context fallback, chat.history run-input visibility, the transcript mirror run lookup, retained custom-data reads, session-entry maintenance, and the full-text index on both engines.

Evidence: built Gateway on node 24.22.1 in Docker with postgres:17 and a local fixture model provider, two runs per build, SQLite once each. On main, a follow-up turn after a tool result with a lone \ud83d or a user message with a lone \udc00 failed with 22P02; a user message with NUL was dropped (22021); an idle reset keeping a tail with \udc00 failed. With this change all of these complete, chat.history returns the messages with the characters kept, search finds the NUL message, existing rows are byte-identical, and the schema dumps are identical. Ordinary sessions and SQLite behave the same. Details: openclaw/openclaw#194591 (comment).

Follow-ups not in this change: Doctor's session-entry rewrite, the SQLite-to-PostgreSQL port of stored NUL full-text rows, and an older IN () bug in readTranscriptMirrorFacts.

Thanks @ylcn91 for the original fix and @reisball for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
… has an unpaired surrogate escape (openclaw#194591)

fix(sessions): read and index Postgres transcripts that contain escapes jsonb rejects

Fixes openclaw#194517.

On PostgreSQL, session transcript JSON that contains an escaped lone surrogate (for example \ud83d) or an escaped NUL cannot be cast to jsonb. Every follow-up turn in such a session failed with 22P02, and a user message containing NUL could not be stored at all, because the full-text index insert failed with 22021 and the message was dropped. SQLite accepts the same text. Every transcript and session-context read now routes stored JSON through the existing jsonNativeFieldsValid guard: rows Postgres can't cast are decoded in JavaScript instead. NUL is replaced by a space only in the derived full-text search text. There is no schema change, no migration, and no rewrite or stripping of stored rows.

Covered: the model-context reader and its navigation cache, tree and reset-boundary navigation, detached-context validation, the reset kept-tail window, the active-context fallback, chat.history run-input visibility, the transcript mirror run lookup, retained custom-data reads, session-entry maintenance, and the full-text index on both engines.

Evidence: built Gateway on node 24.22.1 in Docker with postgres:17 and a local fixture model provider, two runs per build, SQLite once each. On main, a follow-up turn after a tool result with a lone \ud83d or a user message with a lone \udc00 failed with 22P02; a user message with NUL was dropped (22021); an idle reset keeping a tail with \udc00 failed. With this change all of these complete, chat.history returns the messages with the characters kept, search finds the NUL message, existing rows are byte-identical, and the schema dumps are identical. Ordinary sessions and SQLite behave the same. Details: openclaw#194591 (comment).

Follow-ups not in this change: Doctor's session-entry rewrite, the SQLite-to-PostgreSQL port of stored NUL full-text rows, and an older IN () bug in readTranscriptMirrorFacts.

Thanks @ylcn91 for the original fix and @reisball for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 10, 2026
Release adaptation: Keep the release SQLite planner helper private and omit
agent-port-projections.ts, which does not exist on this release line. Preserve
all baseline assertions by materializing four small test fixtures, and exercise
lazy payload reads through the actual SQLite planner rather than a fake source.
Allocate the exact 64 net test lines. No schema, config, or authority changes.

Later same-path followups through 568d89f: 8633af9 (#194591) is the
non-applicable PostgreSQL surrogate repair; b6ed907 (#193682) is the
non-applicable schema41 hydration migration. Neither is a streaming prerequisite.
Existing #195028 and #196277 repair contracts remain intact.

Verified: baseline lazy-read regression fails; 32 focused tests pass across
five suites, including compiled-worker publication and authority boundaries.
Targeted types, lint, format, and whitespace checks pass. Fresh independent
read-only review found no P0-P2 issues.

(cherry picked from commit 7bc0ae7)

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 10, 2026
Adapt c7bd622 (#186481) to the
2026.11.4 maintenance reader rather than importing paged/cold storage.
Preserve canonical deep JSON, reuse the memory model-entry projector, and
fence exceptional native decoding in existing navigation/read owners.
Reclassify only false-invalid derived predicate fields at admission.

Coupled reference: 8633af9 (#194591).
Native PostgreSQL conformance is an adapter check; candidate agent/session
storage is SQLite and this change does not enable PostgreSQL sessions.

Original-author date: 2026-10-28T19:55:20+11:00.
Primary ledger: hf-audit-c7bd622b950257867ee2a9588e6fbf02fef8a27f (high).
Local preparation checkpoint only; final independent review remains required.

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Doksanbir <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 10, 2026
Adapt the derived-search portion and native conformance evidence from
8633af9 (#194591), retaining canonical
NUL and lone-surrogate escapes and the shared exceptional-row projector.
The preceding coupled checkpoint owns the native decoding guard.

Original-author date: 2026-11-09T11:37:39+03:00.
Primary ledger: hf-main-8633af9341852740eb176d22840a46c521064a1b (high).
The original PostgreSQL session incident is not production-reachable in
this candidate (agent/session owner remains SQLite). No independent
release-severity recommendation is made for this checkpoint.

Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: L 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.

[Bug]: PostgreSQL context readers reject an indexed transcript containing a lone Unicode surrogate

2 participants