fix: properly quote base and pm_agent in write_index calls #194

Merged
shoko merged 1 commits from fix/issue-write-index-quoting into main 2026-04-07 02:50:32 +02:00
Owner

Bug

kugetsu init fails with "write_index would create malformed JSON" error because when base or pm_agent are not null, they were not being quoted properly in write_index calls.

The index JSON was being written as:

{"base": ses_29..., "pm_agent": "ses_29...", "issues": {}}

Note: base is unquoted but pm_agent is quoted - invalid JSON.

Fix

Properly quote base and pm_agent with escaped quotes (\"\") when they are not null in all write_index calls:

  • set_base_in_index: quote pm_agent when not null
  • set_pm_agent_in_index: quote base when not null
  • add_issue_to_index: quote both base and pm_agent when not null
  • remove_issue_from_index: quote both base and pm_agent when not null
## Bug `kugetsu init` fails with "write_index would create malformed JSON" error because when `base` or `pm_agent` are not null, they were not being quoted properly in `write_index` calls. The index JSON was being written as: ```json {"base": ses_29..., "pm_agent": "ses_29...", "issues": {}} ``` Note: `base` is unquoted but `pm_agent` is quoted - invalid JSON. ## Fix Properly quote `base` and `pm_agent` with escaped quotes (`\"\"`) when they are not null in all `write_index` calls: - `set_base_in_index`: quote pm_agent when not null - `set_pm_agent_in_index`: quote base when not null - `add_issue_to_index`: quote both base and pm_agent when not null - `remove_issue_from_index`: quote both base and pm_agent when not null
shoko added 1 commit 2026-04-07 02:48:46 +02:00
When base or pm_agent are not null, they need to be quoted with escaped quotes ("") in write_index calls.
This fixes 'write_index would create malformed JSON' error during init.
shoko merged commit bb2add2e1a into main 2026-04-07 02:50:32 +02:00
Sign in to join this conversation.