Skip to content

fix: correct searchEntries arg order and add missing bashExecution normalization#8

Merged
sting8k merged 2 commits into
sting8k:masterfrom
monotykamary:fix/bash-and-search-entries-bugs
May 18, 2026
Merged

fix: correct searchEntries arg order and add missing bashExecution normalization#8
sting8k merged 2 commits into
sting8k:masterfrom
monotykamary:fix/bash-and-search-entries-bugs

Conversation

@monotykamary

@monotykamary monotykamary commented May 17, 2026

Copy link
Copy Markdown
Contributor

Bug Fixes

1. searchEntries called with wrong argument order in report.ts

File: src/core/report.ts

searchEntries has the signature (entries, messages, query), but probesOf called it as searchEntries(rendered, query) — passing the query string as the messages array. This meant messages[i] was always undefined, causing the fallback text path, and query itself was undefined, so search never actually ran. Recall hit counts in benchmark reports were meaningless.

Fix: Pass messages as the second argument: searchEntries(rendered, messages, query).

2. bashExecution messages silently dropped during compaction

Files: src/types.ts, src/core/normalize.ts, src/core/brief.ts

normalizeOne handled user, assistant, and toolResult roles, but any other role (including bashExecution, which Pi uses for ! command results) fell through to return []. Shell command context was completely invisible in compacted summaries.

Fix:

  • Added { kind: "bash"; ... } to NormalizedBlock union.
  • Added bashExecution case in normalizeOne that extracts command, output, and exitCode.
  • Added case "bash" in buildBriefSections so bash commands render under [user] like $ ls -la (#N).

Test update

Replaced the test in tests/normalize.test.ts that asserted bashExecution was skipped with one asserting it is correctly normalized. Added a test for truly unknown roles to preserve the safety net.

monotykamary and others added 2 commits May 18, 2026 02:04
…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.
@sting8k sting8k merged commit 7b57160 into sting8k:master May 18, 2026
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.

2 participants