Skip to content

read: codedb_read dumps raw binary files into JSON response #372

@justrach

Description

@justrach

Symptom

`codedb_read path=codedb.snapshot` (or any file with NUL bytes) succeeds and returns the raw byte content in the MCP response. NULs and control bytes corrupt downstream JSON consumers and burn tokens on content that's never useful to a model.

Repro

`codedb_read path="codedb.snapshot"` returns the binary CDB header + body. `xxd` of the response shows control bytes / NULs.

Failing test

`tests.test.issue-bug5: codedb_read returns binary stub instead of dumping bytes`

Fix

Probe the first 8KB for NUL bytes; if found, replace the response with `binary file: bytes hash:`.

Labels

bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions