Repository navigation
Peek reads fold history as plain text without provider metadata - #15
Merged
Merged
Conversation
Issue #12: after #11 dropped thinking blocks, content_filter refusals still followed peek far more often than other tool results. Peek returned the stored Pi messages as JSON, carrying model, provider, api, usage, responseId and stopReason, which reads like exported model output. Peek now renders a deterministic plain-text history: one labelled section per message with visible text, tool calls and arguments, and tool results verbatim. Thinking blocks and provider metadata are left out. Verification against the stored SHA-256 and exact expand restoration are unchanged. sourceFormat is now "history-text".
The peek change alters extensions/, so the published result's runtimeTreeSha256 and its extractSha256 move with it.
shaneconner
added a commit
that referenced
this pull request
Oct 26, 2026
Peek reads fold history as plain text without provider metadata
Merged
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.
Fixes #12.
Why
After #11 dropped thinking blocks,
content_filterrefusals right afterpeekbecame rarer but still ran far above the rate for other tool results.peekstill returned the stored Pi messages as JSON, withmodel,provider,api,usage,responseIdandstopReasonon each assistant turn. A JSON array like that looks like exported model output, which is what the refusal text describes.What changed
peeknow renders a deterministic plain-text history (renderHistoryText): one labelled section per message (### user,### assistant,### tool result: read (call_1)), with visible text, tool calls with their arguments, and tool results verbatim.peekcall that opens them.sourceFormatis now"history-text", so before and after rates can be compared.omittedThinkingBlocksis still reported.expandrestoration are unchanged.The second request in #12 (logging peek metadata next to a refusal) is not included: each peek's tool result already stores id, kind, view, bytes,
omittedThinkingBlocksandsourceSha256directly before the refused turn.Tests
npm test: 82/82 gates pass. Gate 187 now checks the read is not JSON, carries no provider metadata, keeps text, tool calls and results verbatim, and still restores exactly.npm run lintis clean.