fix: validate prompt history/stash entries to prevent JSON display bug#12154
Closed
Ashwinhegde19 wants to merge 4 commits into
Closed
fix: validate prompt history/stash entries to prevent JSON display bug#12154Ashwinhegde19 wants to merge 4 commits into
Ashwinhegde19 wants to merge 4 commits into
Conversation
Add runtime validation to filter out corrupted entries with non-string input fields. Previously, only null values were filtered, allowing objects with corrupted input fields to display as JSON in the input box. Changes: - history.tsx: Validate input is string and parts is array - stash.tsx: Validate input is string, parts is array, and timestamp is number - Add comprehensive tests for validation logic This prevents the input box from showing [object Object] or JSON structures when prompt history/stash files are corrupted. Fixes anomalyco#12151
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Author
|
Note on Test Failure: The CI test failure is in Details:
The app package's E2E tests are known to be flaky in CI. This is a separate issue from the prompt corruption bug fix. |
Ashwinhegde19
force-pushed
the
fix/prompt-corruption-validation2
branch
from
February 4, 2026 17:12
4da805d to
a4ee507
Compare
R44VC0RP
requested review from
rekram1-node
and removed request for
rekram1-node
February 4, 2026 18:23
6 tasks
Contributor
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
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
Fixes a bug where corrupted prompt history/stash entries with non-string input fields would display as JSON in the input box.
Problem
When
prompt-history.jsonlorprompt-stash.jsonlfiles get corrupted, entries with non-stringinputfields (objects, arrays, numbers) would pass through the filter and display as[object Object]or JSON text in the input box, preventing users from typing or reverting messages.Solution
Added runtime validation to filter functions in both
history.tsxandstash.tsx:history.tsx:
stash.tsx:
Testing
test/cli/tui/prompt-corruption.test.tswith 5 test casesbun test test/cli/tui/prompt-corruption.test.tsSelf-Healing
The existing self-healing behavior is preserved - corrupted files are automatically rewritten with only valid entries after loading.
Fixes #12151