fix: replace silent .catch(() => {}) with structured logging in prompt history#792
Open
MrRealORG wants to merge 1 commit into
Open
fix: replace silent .catch(() => {}) with structured logging in prompt history#792MrRealORG wants to merge 1 commit into
MrRealORG wants to merge 1 commit into
Conversation
…t history
Replace 3 silent .catch(() => {}) patterns in prompt/history.tsx with
proper log.error() calls using the structured Log utility:
- Self-heal rewrite: log error when rewriting corrupted history fails
- Trim rewrite: log error when trimming history to max entries fails
- Append: log error when appending new history entry fails
The initial Filesystem.readText().catch(() => '') is intentionally
kept as-is since it returns a valid default value for missing files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace 3 silent
.catch(() => {})patterns inprompt/history.tsxwith properlog.error()calls using the structuredLogutility.Changes
.catch(() => {}).catch((error) => { log.error("Failed to rewrite history file during self-heal", ...) }).catch(() => {}).catch((error) => { log.error("Failed to trim history file", ...) }).catch(() => {}).catch((error) => { log.error("Failed to append to history file", ...) })The initial
Filesystem.readText().catch(() => "")is intentionally kept as-is since it returns a valid default value for missing files.Motivation
Prompt history is stored in a JSONL file on disk. If write operations fail silently, users could lose their prompt history without any indication of what went wrong. This makes debugging impossible when users report missing history.