Files
hx/docs/adr/0030-runtime-safety-and-cost.md
johannesandClaude Sonnet 5.5 a94632ea3d chore: delete code comments, add ratchet lint and ADRs
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>
2026-11-21 13:37:32 +01:00

19 lines
1.4 KiB
Markdown

# 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
- `/reload` leaves 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 `@file` completion 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