Skip to content

fix(persist): the storage boundary guarantees valid UTF-8 - #67

Merged
wolfy-j merged 1 commit into
masterfrom
fix/persist-utf8-boundary
Aug 8, 2026
Merged

fix(persist): the storage boundary guarantees valid UTF-8#67
wolfy-j merged 1 commit into
masterfrom
fix/persist-utf8-boundary

Conversation

@wolfy-j

@wolfy-j wolfy-j commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

A research run that scraped invalid-UTF8 bytes could not persist anything containing that content: Postgres rejected the encoding, every commit of the node's data failed (including its failure), and the run stranded — observed in production as 'pq: conversion between UTF8 and SQL_ASCII is not supported' killing an agent node's terminal commit.

The persist layer now owns an encoding boundary (persist/encoding.lua, pure byte-walk — the sandbox has no utf8 stdlib): every content, payload, and metadata string written by ops, commit, and commit_repo is validated; invalid sequences are replaced with U+FFFD in place. Valid UTF-8 (including 3- and 4-byte sequences) passes through untouched; overlongs, surrogates, and truncated tails are repaired, never dropped wholesale.

Tests: 968 sqlite green (5 new boundary cases).

Scraped pages and model output carry arbitrary bytes; Postgres rejects
an invalid sequence, which failed the whole commit and stranded the run.
Every persisted content, payload, and metadata string now passes the
encoding boundary: invalid sequences become U+FFFD in place, the record
persists, and the damage stays visible and local.
@wolfy-j
wolfy-j merged commit 3a371c0 into master Aug 8, 2026
8 checks passed
@wolfy-j
wolfy-j deleted the fix/persist-utf8-boundary branch August 8, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant