fix: six small bugs from a codebase read#96
Open
ixchio wants to merge 1 commit into
Open
Conversation
- 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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Went through the whole codebase. Found six things, fixed all of them in one commit.
statusline.sh / statusline.ps1 — both hardcoded
$HOME/.claudeinstead of readingCLAUDE_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 offcommand branch AND thestop ponytailregex (e.g./ponytail off, normal mode), both branches fired and wrote two JSON objects to stdout back to back. Invalid JSON. Added ahandledflag so the regex branch only runs when the command branch didn't already deal with it.ponytail-activate.js —
JSON.parse('null')returnsnull, thennull.statusLinethrows. 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...coercesundefinedto the string"undefined", which then shows up at the top of every agent system prompt. The Pi test suite always passessystemPrompt: '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.stdoutto the real stdout inside the except block, then the very next line called.getvalue()on it (which doesn't exist onTextIOWrapper). So any exception in the generated code caused a secondaryAttributeErrorthat completely hid the original error. Switched to afinallyblock to restore stdout and put the actual exception message in the FAIL output.All 47 tests pass.