Skip to content

Require a log when a caught exception is not rethrown - #1209

Closed
EdbertChan wants to merge 4 commits into
mainfrom
fix/always-log-exceptions
Closed

EdbertChan wants to merge 4 commits into
mainfrom
fix/always-log-exceptions

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

A caught exception that is not rethrown still has to be logged.

An empty handler, a comment-only handler, and a discarded error are suppression.

Review Claim

The explicit-errors skill requires a log when a caught exception does not propagate.

Review Lane

behavior

Review Unit

corpus-lesson

Safety Invariant

The skill text matches the hook. Silence is not a way to handle an exception.

Slice Rationale

This slice is only the skill. The hook change is the parent pull request.

Non-goals

No change to the hook detector.

Test Plan

Test Plan
  • python3 -m unittest corpus/skills/principle-explicit-errors/tests/test_void_discard.py -q
  • python3 scripts/ci/check_skill_test_coverage.py --base fix/explicit-failures-log-void --head HEAD
  • python3 scripts/ci/check_skills_three_harnesses.py
  • python3 scripts/ci/check_ecosystem_boundaries.py

Revert Plan

Revert Plan
  • Safe to revert? Yes
  • Revert command: git revert e6e98d49 609c0712
  • Post-revert steps: None
  • Data migration? No

Note

Low Risk
Documentation and corpus tests only; no runtime hook changes in this PR, with low blast radius for agent guidance.

Overview
Tightens the principle-explicit-errors skill so caught exceptions cannot be “handled” by silence: empty/comment-only catches and discard-only handlers (void err, .catch(() => {}), etc.) are explicit suppression, and “Never suppress an exception. Silence is not a policy.”

When an exception must not propagate (diagnostics, metrics, best-effort side paths), the skill now requires logging that names the operation and attaches the original exception—comments and void err do not count. The Grounding section drops PEP 20’s “unless explicitly silenced” as permission to drop errors.

The fires example adds a review-bot scenario where swapping void reportingFailure for catch {} is still wrong. test_void_discard.py asserts the skill’s discard rule matches engine/hooks/explicit-failures’s detect.scan_js (void-only catch flagged; logged catch clean)—hook behavior unchanged in this slice per PR scope.

Reviewed by Cursor Bugbot for commit 0b8dc8d. Bugbot is set up for automated code reviews on this repo. Configure here.

EdbertChan and others added 2 commits September 28, 2026 13:00
A log line, including console.error, still counts as handling the exception.

Co-authored-by: Cursor <cursoragent@cursor.com>
Change-Id: I9440b5b3f39e69c99b032041d0f298b03c5f29f3
An empty catch, a comment-only catch, and void err are suppression.

Co-authored-by: Cursor <cursoragent@cursor.com>
Change-Id: I8409b8f5933df08f9ebf6cd9bffc1f7a32ee3720
@cursor

cursor Bot commented Sep 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_941d6a05-d14e-431d-af4d-f5e1faa29e01)

The skill rule and the failure hook use the same check.

Co-authored-by: Cursor <cursoragent@cursor.com>
Change-Id: Iaa3d592599511b1f6b4e2da117e82965a83741ea
@EdbertChan EdbertChan changed the title Report a catch that only discards its error Require a log when a caught exception is not rethrown Sep 28, 2026
@EdbertChan
EdbertChan changed the base branch from main to fix/explicit-failures-log-void September 28, 2026 05:09
@cursor

cursor Bot commented Sep 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_76147cf2-1d7d-4f55-992a-002013706960)

EdbertChan pushed a commit that referenced this pull request Sep 28, 2026
EdbertChan pushed a commit that referenced this pull request Sep 28, 2026
@EdbertChan
EdbertChan changed the base branch from fix/explicit-failures-log-void to main September 28, 2026 12:14
@mergify

mergify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@EdbertChan
EdbertChan changed the base branch from main to fix/explicit-failures-log-void September 28, 2026 12:20
@cursor

cursor Bot commented Sep 28, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_ae758b4d-dd9f-473d-b18f-71ad7ddc660e)

@EdbertChan
EdbertChan changed the base branch from fix/explicit-failures-log-void to main September 28, 2026 13:04
@EdbertChan

Copy link
Copy Markdown
Owner Author

Mergify repair stopped: required check failed: validate. The retry cap was reached for current head 0b8dc8d.

@EdbertChan

Copy link
Copy Markdown
Owner Author

Replaced by #1222. The hook change is already on main. #1209 still mixed corpus-lesson files with engine-runtime files, so validate could not pass. #1222 is only the skill text and its test.

@EdbertChan EdbertChan closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant