Skip to content

Peek reads fold history as plain text without provider metadata - #15

Merged
shaneconner merged 2 commits into
mainfrom
claude/project-thread-y9fygx
Oct 26, 2026
Merged

shaneconner merged 2 commits into
mainfrom
claude/project-thread-y9fygx

Conversation

@shaneconner

@shaneconner shaneconner commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Fixes #12.

Why

After #11 dropped thinking blocks, content_filter refusals right after peek became rarer but still ran far above the rate for other tool results. peek still returned the stored Pi messages as JSON, with model, provider, api, usage, responseId and stopReason on each assistant turn. A JSON array like that looks like exported model output, which is what the refusal text describes.

What changed

  • peek now 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.
  • Thinking blocks and provider metadata are left out. Other own fields (for example a bash command or an error message) are kept.
  • Nested fold placeholders read as a line with their brief and the peek call that opens them.
  • sourceFormat is now "history-text", so before and after rates can be compared. omittedThinkingBlocks is still reported.
  • SHA-256 verification of the stored source and exact expand restoration are unchanged.
  • Tool description and README peek section updated.
  • The published hidden-mass result is rebound to the new runtime tree hash.

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, omittedThinkingBlocks and sourceSha256 directly 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 lint is clean.

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".
@shaneconner shaneconner self-assigned this Oct 26, 2026
The peek change alters extensions/, so the published result's
runtimeTreeSha256 and its extractSha256 move with it.
@shaneconner
shaneconner merged commit 42e5a28 into main Oct 26, 2026
2 checks passed
shaneconner added a commit that referenced this pull request Oct 26, 2026
Peek reads fold history as plain text without provider metadata
@shaneconner shaneconner mentioned this pull request Oct 26, 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.

peek still followed by Anthropic content_filter on 4.2.8 (follow-up to #10)

1 participant