Repository navigation
fix(quota-tracker): narrow bare except Exception to ImportError (closes #1062) - #1165
Closed
bassilkhilo-ag2 wants to merge 6 commits into
Closed
bassilkhilo-ag2 wants to merge 6 commits into
bassilkhilo-ag2 wants to merge 6 commits into
Conversation
Before: "multiple processes (2 PIDs: 25023,25065)" — no way to tell if this is expected app-bundle + dev-repo coexistence or a zombie duplicate. After: "multiple processes (2 PIDs: 25023:/Applications/Sutando.app/.../ discord-bridge.py, 25065:/Users/.../sutando/src/discord-bridge.py)" — immediately actionable, confirms the two instances are different source files running in parallel, not the same script spawned twice. 5 tests in tests/health-check-bridge-multi-pid.test.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…andoff.sh invariants (sonichi#1121) 17 checks: no e.message/String(e) in res.end() calls, static error strings at the 3 scrubbed sites, ≥3 console.error('[web-client]') server-side logs, no instanceof/e?.message patterns; session-handoff.sh: STATE_FILE→session-state.md, SUTANDO_REPO_DIR for repo, SUTANDO_WORKSPACE for quota+sentinel, personal_path() for pending-questions, TRANSCRIPT="$1" from PreCompact hook. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reparent (closes sonichi#1088) Mode A (EPIPE-on-dead-reader): replace `echo` with `printf || exit 0` in the fswatch loop so a broken consumer pipe triggers an immediate exit on the first failed write, not after ~100 buffered events (~hours of silence on real DM traffic). Root cause of 2026-05-23 4h task-drop. Mode B (PPID=1 reparent): add a PPID watchdog background subshell that polls `kill -0 $_PARENT_PID` every 5s and SIGTERMs this script when the parent (Monitor wrapper) is gone, so the watcher doesn't live indefinitely under launchd. Stop hook + startup PID-file reaper cover clean exits; this covers SIGKILL / Monitor teardown without signal delivery. 15 structural tests in tests/watch-tasks-stream-orphan.test.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sonichi#1062) The broad except Exception: around the workspace_default import swallowed any non-ImportError raised by status_read_path(), silently falling through to the misleading "No quota-state.json found" message instead of surfacing the real error. Narrowed to ImportError so only the module-not-on-path case is suppressed; all other exceptions propagate to cron pass logs. 5 structural tests in tests/quota-bare-except.test.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
Collaborator
Author
VasiliyRad
reviewed
May 26, 2026
VasiliyRad
left a comment
Contributor
There was a problem hiding this comment.
The one-line fix in skills/quota-tracker/scripts/read-quota.py is correct — except ImportError: is the right scope and the logic is preserved.
However, this PR bundles significant unrelated changes that should be separate PRs:
build_log.md(114 lines added) — workspace state file, should not be in a code PRsrc/health-check.py(14 additions, 2 deletions) — multi-bridge source-path warn feature, unrelated to quota-trackersrc/watch-tasks-stream.sh(15 additions, 1 deletion) — unrelatedtests/health-check-bridge-multi-pid.test.py(88 lines, new file) — tests for the health-check change, not the quota fixtests/watch-tasks-stream-orphan.test.py(201 lines, new file) — unrelatedtests/web-client-security-scrub.test.py(210 lines, new file) — unrelated
Only skills/quota-tracker/scripts/read-quota.py and tests/quota-bare-except.test.py belong here. Please strip the rest and resubmit.
bassilkhilo-ag2
added a commit
to bassilkhilo-ag2/sutando
that referenced
this pull request
May 26, 2026
…chi#1062) 5 structural tests verifying the `except ImportError` constraint in skills/quota-tracker/scripts/read-quota.py. Companion tests to the 1-line fix in the same commit — extracted from the bundled PR sonichi#1165 (which mixed in unrelated changes). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Closed
4 tasks done
Collaborator
Author
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.
Summary
One-line fix: narrow
except Exception:toexcept ImportError:inskills/quota-tracker/scripts/read-quota.pyaround theworkspace_defaultimport block.Why
The broad handler swallowed any non-ImportError exception raised by
status_read_path(), silently setting_canonical = Noneand emitting the misleading"No quota-state.json found"fallback instead of surfacing the real error. The original #1055 bug was anImportError— but if a future refactor makesstatus_read_path()raise something else (e.g. a config error, a permission issue), we want it to propagate to cron pass logs, not disappear.Per Chi's issue #1062 and Lucy's original #1055 review comment.
Change
Test plan
python3 tests/quota-bare-except.test.py→ All 5 tests passedexcept Exception:present,except ImportError:present, import block structure intact,_canonical = Nonefallback preservedCloses #1062.
🤖 Generated with Claude Code