Skip to content

fix: replace silent .catch(() => {}) with structured logging in prompt history#792

Open
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-history-logging
Open

fix: replace silent .catch(() => {}) with structured logging in prompt history#792
MrRealORG wants to merge 1 commit into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-0616-history-logging

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Replace 3 silent .catch(() => {}) patterns in prompt/history.tsx with proper log.error() calls using the structured Log utility.

Changes

Location Before After
Self-heal rewrite (line ~54) .catch(() => {}) .catch((error) => { log.error("Failed to rewrite history file during self-heal", ...) })
Trim rewrite (line ~100) .catch(() => {}) .catch((error) => { log.error("Failed to trim history file", ...) })
Append (line ~104) .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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant