Skip to content

fix(kanban): store a comment body as text, whatever the caller passes - #118546

Open
yoyodine-industries wants to merge 76 commits into
NousResearch:mainfrom
yoyodine-industries:fix/kanban-comment-body-text-contract
Open

yoyodine-industries wants to merge 76 commits into
NousResearch:mainfrom
yoyodine-industries:fix/kanban-comment-body-text-contract

Conversation

@yoyodine-industries

@yoyodine-industries yoyodine-industries commented Sep 21, 2026 •

Copy link
Copy Markdown

add_comment is the only writer of task_comments, and every reader of the column is str-based — but sqlite3 binds bytes as BLOB. A caller that passes bytes currently gets one of two failures:

  • A BLOB body comes back as bytes from a raw cursor no matter which text_factory is installed, so the first str operation to touch that row raises TypeError: cannot use a string pattern on a bytes-like object.
  • The write can crash first, because the commented event payload embeds the author and json.dumps refuses bytes (TypeError: Object of type bytes is not JSON serializable).

Both are the same missing contract: the column is TEXT. This normalises body and author once, at the single writer, so the column holds one type instead of every reader tolerating whatever the last caller passed. The reader side is already covered on main by _lossy_text (installed as every board connection's text_factory and applied in the from_row constructors) — this closes the other end.

Evidence

tests/hermes_cli/test_kanban_db.py::test_add_comment_stores_a_bytes_body_as_text

  • Red on main @ 7b3c7ae: TypeError: Object of type bytes is not JSON serializable.
  • Green with this commit.
scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py
-> 55 passed, 1 skipped, 1 failed

The one failure, test_infrastructure_spawn_refusal_never_charges_the_card, fails identically on the base commit with this change stashed — pre-existing on main, unrelated to this diff.

Authored with AI assistance (Hermes Agent); diff verified manually.

Related Issue

Related Issue: none

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I ran the files this change touches, not the full suite — scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py → 55 passed, 1 failed (1 skipped; the failure is pre-existing on the base commit). The full pytest tests/ -q was not run on this host.
  • python scripts/check passes (the blocking lint and code-health checks CI runs)
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features) — new test_add_comment_stores_a_bytes_body_as_text.
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — N/A: the PR body records no documentation update.
  • I've updated cli-config.yaml.example if I added/changed config keys — N/A: the PR body records no cli-config.yaml.example change.
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A: the PR body records no CONTRIBUTING.md or AGENTS.md change.
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — N/A: the PR body records no cross-platform consideration.
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A: the PR body records no tool description or schema change.

`add_comment` is the only writer of `task_comments`, and every reader of both
columns is `str`-based. `sqlite3` binds `bytes` as BLOB, so a caller that passes
bytes got one of two failures:

  - a BLOB body comes back as `bytes` from a raw cursor no matter which
    `text_factory` is installed, so the first `str` operation to touch the row
    raised `TypeError: cannot use a string pattern on a bytes-like object`;
  - the write itself crashed before it got that far, because the `commented`
    event payload embeds the author and `json.dumps` refuses bytes
    (`TypeError: Object of type bytes is not JSON serializable`).

Both are the same missing contract: the column is TEXT. Normalising at the one
writer keeps it one type, instead of each reader tolerating whatever the last
caller passed. `_lossy_text` already covers rows written before this.

Authored with AI assistance (Hermes Agent); diff verified manually.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management labels Sep 21, 2026
yoyodine-industries and others added 26 commits September 22, 2026 00:01
pr-evergreen and others added 30 commits October 13, 2026 07:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants