Skip to content

fix: six small bugs from a codebase read#96

Open
ixchio wants to merge 1 commit into
DietrichGebert:mainfrom
ixchio:fix/six-bugs
Open

fix: six small bugs from a codebase read#96
ixchio wants to merge 1 commit into
DietrichGebert:mainfrom
ixchio:fix/six-bugs

Conversation

@ixchio

@ixchio ixchio commented Jun 16, 2026

Copy link
Copy Markdown

Went through the whole codebase. Found six things, fixed all of them in one commit.

statusline.sh / statusline.ps1 — both hardcoded $HOME/.claude instead of reading CLAUDE_CONFIG_DIR. The runtime got this fix in #37 but the statusline scripts weren't updated. Anyone with a custom Claude config dir would see a permanently blank badge.

ponytail-config.js writeDefaultMode — was doing a full overwrite of config.json with just {defaultMode}, so any other keys the user had in there were gone. Now reads first, spreads, writes.

ponytail-mode-tracker.js — if a prompt matched the /ponytail off command branch AND the stop ponytail regex (e.g. /ponytail off, normal mode), both branches fired and wrote two JSON objects to stdout back to back. Invalid JSON. Added a handled flag so the regex branch only runs when the command branch didn't already deal with it.

ponytail-activate.jsJSON.parse('null') returns null, then null.statusLine throws. The outer catch swallowed it silently and the statusline nudge never appeared. Added a null + typeof check before the property access.

pi-extension/index.js${event.systemPrompt}\n\n... coerces undefined to the string "undefined", which then shows up at the top of every agent system prompt. The Pi test suite always passes systemPrompt: 'BASE' so this never got caught. Fall back to empty string when it's absent.

benchmarks/correctness.js CSV harness — the try/except restored sys.stdout to the real stdout inside the except block, then the very next line called .getvalue() on it (which doesn't exist on TextIOWrapper). So any exception in the generated code caused a secondary AttributeError that completely hid the original error. Switched to a finally block to restore stdout and put the actual exception message in the FAIL output.

All 47 tests pass.

- statusline.sh/ps1: use CLAUDE_CONFIG_DIR when set (same fix as DietrichGebert#37 for
  the runtime; statusline scripts were missed)
- ponytail-config.js writeDefaultMode: read-modify-write so existing keys
  survive a mode change
- ponytail-mode-tracker.js: track 'handled' so the deactivation regex
  doesn't double-write stdout when command branch already fired
- ponytail-activate.js: guard settings against JSON null before property
  access (TypeError was swallowed, statusline nudge silently skipped)
- pi-extension index.js: event.systemPrompt can be absent; fall back to
  empty string instead of letting the template literal coerce it to
  the string 'undefined'
- benchmarks/correctness.js CSV harness: use finally to restore stdout
  and surface the actual exception in the FAIL message — the previous
  code restored stdout in the except block then called .getvalue() on it
  (AttributeError), losing the original error entirely
Lakshya77089 added a commit to Lakshya77089/ponytail that referenced this pull request Jun 18, 2026
DietrichGebert#148)

settings.json written by Notepad or VS Code on Windows can carry a
UTF-8 BOM. JSON.parse then throws SyntaxError, the outer catch swallows
it, hasStatusline stays false, and the statusline setup nudge is never
emitted.

Strip the leading BOM before parsing, matching the existing handling in
ponytail-mode-tracker.js. (DietrichGebert#96 added a null guard but not BOM stripping.)
DietrichGebert pushed a commit that referenced this pull request Jun 18, 2026
#148) (#151)

settings.json written by Notepad or VS Code on Windows can carry a
UTF-8 BOM. JSON.parse then throws SyntaxError, the outer catch swallows
it, hasStatusline stays false, and the statusline setup nudge is never
emitted.

Strip the leading BOM before parsing, matching the existing handling in
ponytail-mode-tracker.js. (#96 added a null guard but not BOM stripping.)
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