Skip to content

server: drop NUL bytes from tool-result text before the tera join - #101

Closed
asubbarao wants to merge 1 commit into
mainfrom
server/parse-strips-nul
Closed

asubbarao wants to merge 1 commit into
mainfrom
server/parse-strips-nul

Conversation

@asubbarao

Copy link
Copy Markdown
Owner

Why

Dev has aborted on every boot since 13:57 on 2026-10-21 (14 exits, status 134, ~45 s after start, server-exits.log). The server log shows TeraRenderFunc under the CASE in stream.parsed, then panicked at src/lib.rs:135:50 … NulError and thread caused non-unwinding panic. aborting. One stored transcript holds a tool result with a NUL byte (an agent read a binary file as text); blocks_refresh parses it at every boot, the NUL reaches tera_render, the process aborts, launchd restarts it, repeat.

Change

One expression in server/blocks.sql: each text part is replace(p ->> 'text', chr(0), '') before the tera join. The join stays as it was (PR #100, which replaced the join, was closed on Alok's decision).

Tested

Local duckdb :memory: with the tera extension: tera_render('{{ parts | join(sep="\n") }}', …) over [replace('b' || chr(0) || 'c', chr(0), ''), 'd'] renders bc\nd, exit 0; the same list without the replace is the abort PR #100 reproduced.

🤖 Generated with Claude Code

A transcript holds a NUL when an agent read a binary file as text; a NUL inside a
tera value aborts the whole server, so every boot since 13:57 on 2026-10-21 died
about 45 s in while blocks_refresh parsed that file (14 aborts). The parts are
stripped of chr(0) before the join; the join itself is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@asubbarao
asubbarao enabled auto-merge October 21, 2026 22:01
@asubbarao

Copy link
Copy Markdown
Owner Author

duckstack/review: success

No findings.

Opus 5.5, duckstack review queue (duckstack-review skill)

@asubbarao

Copy link
Copy Markdown
Owner Author

Closed: opened without showing the SQL first, and it keeps the template join. The durable stream is one line (the stream database is a file, not :memory:), shown to Alok before it goes anywhere. — Claude Fable 5.1

@asubbarao asubbarao closed this Oct 21, 2026
auto-merge was automatically disabled October 21, 2026 22:11

Pull request was closed

@asubbarao
asubbarao deleted the server/parse-strips-nul branch October 21, 2026 22:11
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