Skip to content

fix(claims): settle a hold before it drains, and skip headless gamescope - #358

Merged
T-Crypt merged 1 commit into
mainfrom
T-Crypt/claim-settle
Nov 20, 2026
Merged

T-Crypt merged 1 commit into
mainfrom
T-Crypt/claim-settle

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Stops the drain in #337.

A hold claim starts on the first scan that matches, so a short-lived helper drains the holder and then ends. On the machine where it was reported, a screenshot script ran gamescope --backend headless for about five seconds per frame and drained a foreground Strata lease five times in one day. When the helper exited, the claim was canceled with the card already down.

What changed

  • settle = "5s" on a [[claim]] hold: the matched process must last that long before the hold starts. The clock restarts when the process goes away. The default 0 keeps the current behavior.
  • The built-in gamescope rule ignores --backend headless, the way a capture or CI harness runs it.

Proof

  • TestBuiltinGamescopeSkipsHeadless fails on the old rule, where both gamescopes matched.
  • TestWatcherHoldSettles covers the wait and the clock restart after a gap.
  • TestCompileRejectsSettleOnTrack refuses a settle on a rule that drains nothing.
  • Full proof green, including the Windows build and vet and golangci-lint 2.14.0.

Not fixed

A claim that ends after its grant still leaves the card with the claim's lease released, not back with the drained engine. Restoring a stopped engine is outside what berthd does, so this change prevents the drain instead of reversing it.

Refs #337.

A hold claim drained the holder the moment its process appeared. A screenshot
script that ran `gamescope --backend headless` for five seconds took the card
from a serving engine five times in one day, and when the helper exited the
claim was canceled with the card already down (#337).

- `settle = "5s"` on a hold waits for the match to last that long before it
  drains anyone. The clock restarts if the process goes away. Default 0 keeps
  today's behavior, so only rules that ask for it wait.
- The built-in gamescope rule ignores `--backend headless`, the way a capture
  or CI harness runs it.

Tests: TestBuiltinGamescopeSkipsHeadless fails on the old rule, where both
gamescopes matched; TestWatcherHoldSettles covers the wait and the clock
restart; TestCompileRejectsSettleOnTrack refuses a settle on a rule that
drains nothing.
@T-Crypt
T-Crypt merged commit 1697683 into main Nov 20, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/claim-settle branch November 20, 2026 21:48
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.

1 participant