pstack: bug-fix playbook gets a flake-triage rule - #359
Open
chesley-veko wants to merge 1 commit into
Open
Conversation
A test that failed once is a bug until proven otherwise. Capture the assertion before any rerun, treat fails-in-suite / passes-alone as shared state, and require a reproduction or tracker entry before calling it a flake. Privacy and security assertions never get the flake label. Co-authored-by: Cursor <cursoragent@cursor.com>
GitTim2Day
reviewed
Sep 11, 2026
GitTim2Day
left a comment
There was a problem hiding this comment.
A lot of these can be mitigated by saving the flawed-unverified in a log or archive then rerun the code using BASIC and Python or other logic. Like:
GO_SUB
Do_until nearly flawless
Run (code/program/process)
error test-mitigate, retest, mitigate as the nest inside the do_until loop then
RETURN
And let the AI fix it
Works as NLP.
|
mitigate until nearly flawless |
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.
What
Adds one paragraph to
pstack/skills/poteto-mode/playbooks/bug-fix.md: how to treat a test that failed once.Why: the case that produced it
Running the bug-fix playbook over a 67-failure pytest suite, one privacy-boundary test (
test_export_has_owner_only_initial_generation_audit_without_private_payloads, asserting an account export contains only the owner's calibration audit rows and no private payloads) failed once in a 239-test subset, then passed alone and passed on the identical subset rerun. The agent labelled it a flake and moved on without saving the assertion. The playbook had nothing to say about that decision, so nothing stopped it.The user rejected the verdict. Rerunning with full capture and forcing the suspected race showed it was a real bug:
Mechanism: earlier tests in the same module instantiated a module-scoped app client whose lifespan runs a calibration scheduler polling
claim_nextevery second. The failing test enqueues a job by hand and then claims it itself. When a scheduler tick lands in the gap between the enqueue and the test's ownclaim_next, the scheduler owns the job and the test seesNone. Running the test alone never fails because nothing requests the app-client fixture, so the scheduler never exists. That is exactly the fails-in-suite / passes-alone signature.Evidence: with the scheduler interval tightened to 0.5s the module failed 1 in 12 runs. After idling the scheduler for the duration of the test, 0 in 20. The cross-process variant (any live backend sharing the dev database) went to the project's tracker as a per-worker database isolation item.
Every sentence in the new paragraph maps to a step that was skipped: capture before rerun, name the shared resource, reproduction or tracker entry before closing, and no flake label on a privacy assertion.
Style
Follows #331: no semicolons, em dashes, or connector colons in the prose.
Note
Low Risk
Documentation-only change to an internal playbook; no runtime or product code paths.
Overview
Extends the bug-fix playbook with a short flake / intermittent-failure triage block so agents do not dismiss a one-off test failure without evidence.
The new prose sets defaults and guardrails: treat a single failure as a real bug until disproven, save full failure output before any rerun, read fails-in-suite / passes-alone as order-dependent shared state (name the resource), and only allow a flake call with a captured assertion plus reproduction or a tracker entry—never on privacy or security assertions from one green rerun.
Reviewed by Cursor Bugbot for commit 790d899. Bugbot is set up for automated code reviews on this repo. Configure here.