fix: correct searchEntries arg order and add missing bashExecution normalization#8
Merged
sting8k merged 2 commits intoMay 18, 2026
Conversation
…rmalization - Fix report.ts calling searchEntries(rendered, query) instead of searchEntries(rendered, messages, query), which caused recallHits to always return incorrect values (messages array was never passed). - Add 'bash' kind to NormalizedBlock and normalize bashExecution messages so shell command context (e.g. from ! commands) is no longer silently dropped during compaction. - Emit bash lines in brief transcript under [user] section to preserve command history in the compacted summary. - Update normalize test to assert bashExecution is preserved instead of asserting it is skipped.
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.
Bug Fixes
1.
searchEntriescalled with wrong argument order inreport.tsFile:
src/core/report.tssearchEntrieshas the signature(entries, messages, query), butprobesOfcalled it assearchEntries(rendered, query)— passing the query string as themessagesarray. This meantmessages[i]was alwaysundefined, causing the fallback text path, andqueryitself wasundefined, so search never actually ran. Recall hit counts in benchmark reports were meaningless.Fix: Pass
messagesas the second argument:searchEntries(rendered, messages, query).2.
bashExecutionmessages silently dropped during compactionFiles:
src/types.ts,src/core/normalize.ts,src/core/brief.tsnormalizeOnehandleduser,assistant, andtoolResultroles, but any other role (includingbashExecution, which Pi uses for!command results) fell through toreturn []. Shell command context was completely invisible in compacted summaries.Fix:
{ kind: "bash"; ... }toNormalizedBlockunion.bashExecutioncase innormalizeOnethat extractscommand,output, andexitCode.case "bash"inbuildBriefSectionsso bash commands render under[user]like$ ls -la (#N).Test update
Replaced the test in
tests/normalize.test.tsthat assertedbashExecutionwas skipped with one asserting it is correctly normalized. Added a test for truly unknown roles to preserve the safety net.