land: audit-u17a

Merged
AF
4d ago
+817-63

Accepted agent delivery; branch-keyed search descriptor included.


Summary by cubic

Fixes three OpenCode reliability issues: invalid shared TUI preferences are now preserved instead of overwritten, edited and legacy project configs are re-read correctly, and concurrent update checks no longer race for the orphan lock.

  • Preference writes now only initialize missing files; invalid existing shared preferences are rejected and left untouched.
  • Project acceptance revalidates when config files change, and unchanged rejected configs — including legacy project files — are cached by file identity so a repaired file is reloaded once.
  • Orphan reclamation now claims lock generations: observed locks are renamed to unique claim paths, verified by descriptor-derived inode and exact bytes, and restored without clobbering if they changed; reclaim guards abandoned by crashes are recovered while live owners are preserved, and a newly acquired primary lock survives when the orphan disappears mid-check.
  • The preference watcher now handles watcher errors and suppresses in-flight reads after stop.

RetriggerView in GreptileConfidence Score: 5/5

No new blocking findings were added; the remaining lock race belongs to an existing review thread.

Summary

This PR protects shared preferences, reloads edited project configs, and revises how auto-updaters recover abandoned locks.

  • Only one OpenCode window can take over an abandoned update lock.
  • Project config checks refresh when either config file changes.
  • TUI preference updates leave unreadable shared settings untouched.
  • The release note and search descriptor record this audit delivery.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Try exclusive lock creation] --> B{Lock exists?}
  B -->|No| C[Check timestamp and claim update]
  B -->|Yes| D[Acquire reclaim guard]
  D --> E[Read abandoned lock]
  E --> F[Move lock to unique claim path]
  F --> G{File matches observation?}
  G -->|Yes| H[Remove claimed file and retry creation]
  G -->|No| I[Try restoring without overwriting]

Reviews (3) · Last reviewed commit: "mason: claim updater lock generations be..." · Reviewed by Greptile