Skip to content

fix(window): reject transient restore thumbnail bounds - #345

Merged
steipete merged 1 commit into
mainfrom
codex/fix-restore-output-bounds
Aug 10, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-restore-output-bounds

Conversation

@steipete

Copy link
Copy Markdown
Collaborator

Summary

  • reject post-restore refresh metadata unless its exact window ID, owner process generation, restored state, and bounds match the verified restore receipt within one point
  • retain the verified original receipt while public inventory is missing or exposes a Dock-animation thumbnail; omit bounds only when the original receipt itself is unverifiable
  • cover the observed 40x81 Dock-thumbnail frame, identity drift, bounded rounding tolerance, inventory misses, and idempotent visible restore
  • clarify the restore-output guarantee in both changelogs

Root cause

After a verified background restore, public window inventory can briefly expose the exact CG window ID at its animated Dock-thumbnail frame. The CLI's best-effort display refresh accepted that same-ID descriptor without checking its owner-generation and bounds receipt, so a successful restore could report a tiny Dock-positioned new_bounds value.

Proof

  • swift test --package-path Apps/CLI --filter WindowRestoreOutputTests --no-parallel — 6/6
  • pnpm run test:safe — 718 unit tests and 72 runtime tests passed
  • strict SwiftLint and SwiftFormat on changed Swift files
  • signed CLI through the explicit GUI Bridge with a distinct signed Playground fixture: 10/10 restore receipts retained the verified 1200x852 frame while 4 immediate public listings were transient
  • source-blind GUI-Bridge validation: 6/6 restores, including 2 immediate inventory misses; every receipt retained verified bounds and the target stayed inactive
  • missing exact-ID probe failed without changing the controlled target
  • final autoreview clean with no accepted/actionable findings

No AppleScript path is involved.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 8:54 PM ET / August 10, 2026, 00:54 UTC.

ClawSweeper review

What this changes

The PR makes background window restore retain its verified bounds unless refreshed public inventory confirms the same window, owner process generation, restored state, and near-identical frame.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Current main still accepts any same-ID post-restore inventory record, while this branch checks the verified receipt before allowing refreshed metadata. The focused collaborator-authored patch has no actionable correctness or security finding and needs ordinary maintainer approval.

Priority: P2
Reviewed head: e1fab201bc6b65ee48458ee4e6634a648cbb3484
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, source-aligned repair with concrete native after-fix evidence and regression coverage; only ordinary collaborator approval and a pending check remain.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies after-fix signed GUI-Bridge runs showing verified bounds survive transient inventory records and misses; the focused tests and safe suite are supplemental.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies after-fix signed GUI-Bridge runs showing verified bounds survive transient inventory records and misses; the focused tests and safe suite are supplemental.
Evidence reviewed 5 items Current-main defect: Current main's restore-output helper returns the first refreshed record without validating its owner generation or frame, so a transient Dock thumbnail can replace the verified bounds.
Patch behavior and regression coverage: The branch accepts refreshed metadata only after window ID, owner generation, restored-state, and frame checks; focused tests cover a 40x81 thumbnail, owner drift, tolerance, missing inventory, and visible idempotent restore.
Feature provenance: The current restore helper dates to the immediately preceding verified-background-restore work, making this a focused follow-up on the same receipt contract.
Findings None None.
Security None None.

How this fits together

The CLI restores a minimized macOS window through the automation service, then refreshes public window inventory for output. The refresh must preserve the verified restore receipt when inventory is delayed or temporarily reports an animated Dock thumbnail.

flowchart LR
  A[CLI restore request] --> B[Verified window receipt]
  B --> C[Native window restore]
  C --> D[Public inventory refresh]
  D --> E{Identity and bounds match?}
  E -->|yes| F[Use refreshed window metadata]
  E -->|no or missing| G[Keep verified restore bounds]
  F --> H[CLI result]
  G --> H
Loading

Decision needed

Question Recommendation
Should the collaborator-authored receipt-pinning fix be approved after the pending PeekabooCore check completes? Approve after CI: Approve the focused repair once the pending PeekabooCore build-and-test check is green.

Why: The change is a focused native-automation reliability repair with strong branch evidence, but collaborator-authored PRs require explicit maintainer judgment before landing.

Before merge

  • Complete next step (P2) - A collaborator-authored focused patch has no actionable repair finding; it needs maintainer approval after the pending required check completes.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Focused patch size 141 added, 16 removed across 4 files The implementation is concentrated in one CLI restore helper with one focused test file and matching release notes.
Production vs test delta production +29, tests +96 The production guard is small relative to the regression coverage for transient inventory cases.

Technical review

Best possible solution:

Land the receipt-pinning check after maintainer approval and the remaining required CI result, preserving verified restore bounds until public inventory reports a matching restored window.

Do we have a high-confidence way to reproduce the issue?

Yes—current main directly replaces the verified result with the first post-restore inventory record, and the branch tests reproduce transient thumbnail, identity-drift, and inventory-miss cases.

Is this the best way to solve the issue?

Yes—the guard preserves the established verified receipt and permits refreshed metadata only when it independently matches the expected window and frame, avoiding a new public API or retry policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6e70b21f5bdb.

Labels

Label justifications:

  • P2: This is a bounded reliability defect in CLI window-restore output, with no evidence of data loss, security impact, or core-runtime unavailability.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix signed GUI-Bridge runs showing verified bounds survive transient inventory records and misses; the focused tests and safe suite are supplemental.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix signed GUI-Bridge runs showing verified bounds survive transient inventory records and misses; the focused tests and safe suite are supplemental.

Evidence

What I checked:

Likely related people:

  • steipete: The current helper was introduced by this contributor in the preceding verified background-restore change, and this branch is a focused follow-up. (role: recent area contributor and original restore-helper author; confidence: high; commits: b59057e3e100, e1fab201bc6b; files: Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+State.swift, Apps/CLI/Tests/CoreCLITests/WindowRestoreOutputTests.swift)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-10T00:31:34.995Z sha 082cff7 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/fix-restore-output-bounds branch from 082cff7 to e1fab20 Compare August 10, 2026 00:50
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 10, 2026
@steipete
steipete merged commit 22508d9 into main Aug 10, 2026
14 checks passed
@steipete
steipete deleted the codex/fix-restore-output-bounds branch August 10, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant