Skip to content

refactor(quota-tracker): narrow bare except to ImportError (closes #1062) - #1316

Closed
sonichi wants to merge 1 commit into
mainfrom
fix/quota-bare-except-1062
Closed

sonichi wants to merge 1 commit into
mainfrom
fix/quota-bare-except-1062

Conversation

@sonichi

@sonichi sonichi commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

One-line change: except Exception: → except ImportError: on read-quota.py:31.

The broad except Exception: masked the _REPO_ROOT path bug for ~12h in the #1055 incident — a bad path caused ImportError, which was swallowed and produced the misleading "No quota-state.json found" fallback. Only ImportError is expected here (module absent in fresh installs or sandboxed envs). Any other exception from inside status_read_path is a genuine bug and should propagate.

Closes #1062. Flagged in #1055 code review by @liususan091219.

Test plan

  • python3 -m py_compile skills/quota-tracker/scripts/read-quota.py passes
  • python3 skills/quota-tracker/scripts/read-quota.py reports quota correctly

🤖 Generated with Claude Code

)

`except Exception:` on read-quota.py:31 was masking a real path bug for
~12h in the #1055 incident: the wrong _REPO_ROOT value raised ImportError
(module not found), which was swallowed by the broad except and produced
the misleading "No quota-state.json found" fallback message.

Now that _REPO_ROOT is correct (four .parent levels), the only expected
failure mode is `ImportError` — the workspace_default module absent for
fresh installs or sandboxed envs. Any other exception from inside
`status_read_path` is a genuine bug and should propagate so it's visible
in cron pass logs rather than silently turning into a "not found" message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Chi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonichi

sonichi commented May 28, 2026

Copy link
Copy Markdown
Owner Author

Superseded by team PR #1094 (opened earlier, same fix, passes CI). Closing to avoid duplicate merge.

@sonichi sonichi closed this May 28, 2026
@sonichi sonichi reopened this May 28, 2026
@sonichi

sonichi commented May 28, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #1094 (VasiliyRad — same fix, already reviewed and approved).

@sonichi sonichi closed this May 28, 2026
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.

refactor(quota-tracker): narrow read-quota.py:26 bare-except to ImportError

2 participants