Skip to content

pi provider: no way to manually compact a thread's context #1103

Closed

Description

@DarrenTsung

⚠ Agent-generated: This issue was drafted by an AI agent, not a human. Facts were gathered from the installed bb app, provider bridges, and CLI; please verify details before acting on them.

Related

#448 “Please add a way to compact threads” (closed as completed) covered /compact working on Claude and not on Codex; the Codex case was fixed. The pi provider was not covered there and the maintainer’s working assumption — “You should be able to /compact” — does not hold for pi threads. This issue is the pi-specific gap.

Summary

BB exposes no way to manually compact a thread's context when the thread runs on the pi provider. Typing /compact in the BB composer does nothing on a pi thread — the text is forwarded to pi's headless agent as an ordinary user message, and pi's RPC mode explicitly does not execute built-in TUI commands sent as prompts. On a claude-code thread, the exact same /compact message does trigger real compaction, because the Claude CLI parses slash commands from any user input. The asymmetry is confusing and undocumented.

Environment

  • bb version: 0.35.1
  • provider / harness: pi (headless via bb-pi-bridge, pi --mode rpc), version 0.83.0; claude-code 2.1.221 for the comparison
  • model (relevant): deepseek v4 flash (large context window — auto-compaction fires rarely)

Repro

  1. Create/open a BB thread with provider pi.
  2. Type /compact in the composer and send it.
  3. Observed: the model receives "/compact" as a prompt and answers conversationally; no "Context compacted" entry appears in the timeline.

Same steps on a claude-code thread: the Claude CLI executes its built-in /compact, and BB records a "Context compacted" timeline entry.

Expected vs actual

  • Expected: a way to manually compact a pi thread (a /compact composer action, a thread action, or a bb CLI command), or at least consistent behavior across harnesses — including /compact autocomplete in the composer, which Please add a way to compact threads #448 noted is missing.
  • Actual: /compact is silently inert on pi threads (not even autocompleted) and works on claude-code threads; the only manual workaround is forking/starting a new thread.

Evidence / root cause

  • BB itself has no native compaction control. There is no composer action named compact for any provider (pi: {kind:"skills"} only; claude-code/codex: skills + /plan + /goal), no thread action, no bb CLI command, and no server endpoint. The server only records provider-initiated compactions — thread/compacted events and contextCompaction items — and renders them as "Compacting context" → "Context compacted" timeline entries (onCompactionBegin/onCompactionEnd in server/dist/start-server.js).
  • pi has the capability but BB never calls it. pi ships a first-class RPC compact command ({"type": "compact"} in pi --mode rpc) plus auto-compaction (threshold/overflow). But pi's docs state built-in TUI commands like /compact are "handled only in interactive mode and would not execute if sent via prompt" — which is exactly what happens when the text is typed in BB's composer. The bb-pi-bridge never sends the RPC compact command.
  • claude-code works by accident of forwarding. bb-claude-code-bridge passes user messages verbatim to the Claude CLI (pushInput({type:"user", message:{role:"user", content}})); the CLI processes slash commands from any user input (disableSlashCommands is false), so /compact reaches Claude's own compaction, surfaced to BB via its PreCompact/PostCompact hooks.

Suggested fix

Add a manual compact surface for pi threads — e.g. a /compact composer action or a thread action that sends pi's RPC compact command through the bridge. The capability exists end-to-end; only the UI trigger is missing. Ideally make it generic per provider: pi → RPC compact; claude-code → send /compact (already works) or use an explicit SDK path; codex → verify what exists before implementing.

Impact

Users of pi-powered threads (e.g. deepseek models with large context windows) cannot manually compact long sessions; they must fork or start new threads or wait for automatic threshold/overflow compaction. Low severity, but a real confusion risk given the claude-code behavior works.

Activity

  1. self-assigned this
    on Aug 7, 2026
  2. added
    bug
    on Aug 7, 2026
  3. ymichael commented on Aug 7, 2026

    @ymichael
    Collaborator

    hi darren - thanks for reporting this! will fix!

  4. added theissue type on Aug 7, 2026
  5. added a commit that references this issue on Aug 11, 2026
    12acc8e
  6. added a commit that references this issue on Aug 14, 2026
    c2ca938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions