Repository navigation
fix(tts): preserve unread preferences during updates - #175847
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c546df99e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| update: (tts: TtsUserPrefs["tts"]) => TtsUserPrefs["tts"], | ||
| ): void { | ||
| const prefs = readTtsPrefs(prefsPath); | ||
| const prefs = readTtsPrefs(prefsPath, { forUpdate: true }); |
There was a problem hiding this comment.
Surface unread-pref failures to slash-command users
When the preference file is malformed or unreadable, this new { forUpdate: true } path throws from every setter. The text-command path invokes these setters directly (for example, handleTtsCommands at commands-tts.ts:300), and handleCommands awaits handlers without translating exceptions (commands-core.ts:72-75); the dispatch layer then rethrows a pre-agent-run failure before sending any reply. Consequently, /tts on, /tts provider, /tts persona, /tts limit, and /tts summary provide no repair instruction to the user. Catch this expected refusal at the TTS command boundary and return its guidance as a command reply.
AGENTS.md reference: AGENTS.md:L82-L82
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in signed4ff1e9faaf3bcb2c5902280aaee21e6ea6964184: all six preference setter sites now use one TTS command-boundary adapter that logs the actual failure and returns a terminal repair reply. Validation, authorization and success replies are unchanged. A real-file /tts limit 2000 regression invokes the actual writer, checks that the command replies with repair guidance, and confirms the malformed bytes remain untouched. Fresh independent complete six-file review found no actionable P0–P2 defects; runtime proof and file timing remain for the repaired exact-head CI. The previous green head does not qualify this repair.
|
Codex review: blocked before merge. What this changesThis PR prevents TTS preference updates from overwriting unreadable settings and returns repair guidance to slash-command users. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR fixes a current preference-preservation bug, and the previous command-reply finding is resolved with no further concrete defects found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherTTS commands, Gateway methods, and CLI operations share a preference writer that reads local overrides before atomically saving a changed setting. flowchart TD
A[TTS command] --> B[Authorized command handler]
B --> C[Preference mutation owner]
C --> D[Shared preference reader]
D --> E[Local preference file]
D --> F[Refusal on unread settings]
F --> G[Terminal repair reply]
C --> E
Technical reviewBest possible solution: Retain the shared-reader refusal and command reply adapter, with verified preservation of existing preferences across upgrade. Do we have a high-confidence way to reproduce the issue? Current-main source directly establishes malformed-file fallback followed by destructive replacement; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is the smallest complete repair: distinguish missing files in the existing reader, refuse unsafe mutations in the existing writer, and translate refusal at the command boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f0abcb4213ae. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +36, Tests +55, Docs +5. Total +96 across 6 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 17, 2026, 5:44 PM ET / 21:44 UTC (Revision 2). |
|
@clawsweeper re-review The signed preference-file preservation repair now also returns terminal repair guidance from every slash-command setter. Complete six-file review and focused static proof are current in the PR body; runtime proof awaits exact4ff1e9faaf3bcb2c5902280aaee21e6ea6964184 CI. |
|
🦞👀 Re-review progress:
|
Prevent TTS preference setters from replacing unread or malformed existing preferences. Optional reads warn and retain configured defaults; mutations refuse before the unchanged atomic write, and all six slash-command setter sites translate that refusal into a terminal repair reply. Quiet missing-file first-run behavior and valid updates remain. Fresh independent complete six-file review scoped-clean P0-P2/0.97. The initial hosted P2 was accepted and repaired at the real command boundary, with actual-file preservation proof. Exact repaired-head CI39071870338 succeeded: tts-config9PASS/6.76s (new cases3ms/1ms/5ms), commands-tts12PASS/4.03s (new repair reply4ms). All126 checks accounted66success/59skip/1neutral; all three statuses success, no failed/cancelled/missing suite. Focused lint, formatting, docs and14 suppression checks passed. Local dependency-declaration gap remains disclosed.36 net production lines added for the real data-preservation fix, not cleanup credit. No rerun, rebase or confirmation push.
What Problem This Solves
An unreadable or malformed TTS preference file is silently treated as empty. Preference-changing commands can then replace that existing file with defaults plus one changed setting.
User Impact
Read-only TTS operations warn with repair guidance and continue using configured defaults. Preference updates refuse before writing when the existing file cannot be read, preserving it for repair. Slash-command setters return a terminal repair reply instead of letting that refusal escape without a response. A genuinely missing file remains a quiet first-run default and can still be created by a setting command.
Why This Change Was Made
Keep one file-read owner with an internal update context, rather than a competing reader or a blanket throw on normal reply paths. The existing mutation owner requests refusal before its unchanged private atomic write. Public setter signatures, valid-file updates, preference JSON shapes, config keys, permissions and durability remain unchanged.
This is a real silent-failure/data-preservation fix, not cleanup-floor credit: 36 net production lines added,55 net test lines added,5 documentation lines added. The lightweight config module uses a generic warning without logging preference contents or adding a heavy logger import. The existing command adapter shares one error-to-reply boundary across its six setter sites and logs through its existing subsystem logger plus the canonical error formatter.
Best-effort tradeoffs accepted
Evidence
Release-note context: TTS preference commands no longer overwrite an existing file after a read/JSON parse failure; optional reads report fallback with repair guidance. No live channel/provider or operator-state proof claimed.
Exact repaired-head CI39071870338 completed successfully. Both changed suites actually executed: tts-config9PASS/6.76s (new filesystem cases3ms/1ms/5ms) in job117511300621; commands-tts12PASS/4.03s (repair-reply regression4ms) in job117511300666. All126 exact-head check runs accounted:66success/59skip/1neutral, no failed/cancelled/unfinished suite; all three commit statuses success. This closes the hosted runtime/test-cost gap, not the disclosed local dependency-declaration gap. No CI rerun, confirmation push or freshness rebase.