Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1.4 KiB
1.4 KiB
Safety and cost guards in reload, lens polling, revert and completion
Status: accepted
Context
Several UI paths touch shared state or expensive resources: /reload rewrites the system prompt (which invalidates the provider prompt cache); the lens poll takes the LSP manager lock, which a starting server can hold; /diff revert writes to user files that may have been edited by hand; @file completion needs a large file list; the keyboard-protocol query must precede the alternate screen.
Decision
/reloadleaves the agent's prompt untouched when it is unchanged, since a rewrite would drop the prompt cache.- The lens poll uses a 200 ms timeout on the status call because the manager lock can be held while a server starts.
- Reverting a file refuses when its content is not what the agent left, so manual edits are never overwritten; files the agent created are deleted.
- Command/argument completion is live, but
@filecompletion waits for Tab because the file list is big; Enter on an empty or complete token passes through and submits. - The keyboard-enhancement support query runs before entering the alternate screen.
Consequences
Prompt cache stays warm, the UI never blocks on a slow server, and user edits are protected. Status can be stale by one poll when the lock is busy.
Code: crates/hx-tui/src/lib.rs (reload handler, lens_tick, completion), crates/hx-tui/src/review.rs:revert, crates/hx-tui/src/popup.rs