Repository navigation
Description
Summary
Pi emits a role: "system" message (its prompt sections and tool declarations) when a session starts and again whenever sections or tools change, each time as a message_start and a message_end event. provider-pi doesn't recognize the system role, so both events fall through to provider/unhandled with the whole raw payload. That gives two identical copies of a 10–130 KB prompt snapshot that nothing reads. I expected bb to treat a pi system message as known, either dropping it or storing it once.
This issue covers only that subtype: rawType sdk/message_start or sdk/message_end with rawEvent.params.message.message.role = "system". Other provider/unhandled rows (unscoped thinking, tool calls, model fallbacks, legacy image results) are used elsewhere and are not part of this issue.
Versions and environment
- bb 0.49.0 (desktop app), macOS 27.2 arm64
- provider
pi, pi CLI 1.5.0 - local data dir
~/.bb, no remote machine
Steps to reproduce
bb thread spawn --project <project> --provider pi --prompt "Reply only with ok."bb thread wait <thread>-
bb thread log <thread> --json --limit 20 | jq -c '.[] | select(.type=="provider/unhandled") | {seq, rawType: .data.rawType, role: .data.rawEvent.params.message.message.role, chars: (.data|tostring|length)}'
I reproduced this in a new thread on 0.49.0, not on a clean data dir. The size depends on the skills, plugins and tools installed, so expect a smaller number on a fresh install. There are still two rows.
Expected vs actual
{"seq":9,"rawType":"sdk/message_start","role":"system","chars":123522}
{"seq":10,"rawType":"sdk/message_end","role":"system","chars":123518}
Expected: no provider/unhandled row for a pi system message, or at most one compact row. Actual: two adjacent rows whose rawEvent.params.message.message is byte-for-byte the same. A trimmed, made-up example:
{"providerId":"pi","rawType":"sdk/message_start","rawEvent":{"jsonrpc":"2.0","method":"sdk/message",
"params":{"message":{"type":"message_start","message":{"role":"system","content":"",
"sections":{"tools":"…","skills":"…"},"toolsAdded":[{"name":"read","description":"…","parameters":{}}],
"timestamp":0}}}}}Evidence
Size, measured on one install (37 days, about 2,900 threads, all pi). I took a consistent copy of ~/.bb/bb.db with SQLite .backup and measured it with dbstat. Event content is sum(length(data)) grouped by event type, and for this subtype by rawType and message role.
- Pi system-message snapshots: 13,107 rows, 0.66 GB, about 50 KB per row. Of that, prompt sections for skills are 0.28 GB, tool schemas 0.23 GB, and other appended sections 0.10 GB. Half of it is the second copy.
- For scale,
provider/unhandledas a whole is 67,655 rows and 0.75 GB. This issue is about the 0.66 GB subtype only. Theeventstable is 4.21 GB of a 5.35 GB file. - In one long thread there were 235 system messages over 969 turns, 40 of them ≥ 40 KB. All 235
message_start/message_endpairs were adjacent and identical. I checked this with read-only indexed queries on one thread. - No pruning policy covers these rows (docs/events-table-pruning.md: "No other event types are deleted"), so they stay for the life of the thread.
Code (the same at desktop-v0.49.0 and at current main; neither file changed between them):
toPiMessageBoundaryRolemaps onlyassistant,custom,toolResultanduser.systembecomesunknown: tag, main.- A message boundary with an
unknownrole gets coverageunknown, notnoise: tag, main. translatereturns nothing for the boundary (neither the assistant nor the custom schema matches), so the envelope goes tounhandledDeltaswith the full raw event: tag, main. ForunhandledDeltasitself: tag, main.- Pi documents this message type as
SystemMessage(role: "system",sections,toolsAdded,toolsRemoved) in itsdocs/message-types.md.
Suggested fix: recognize system as a message-boundary role and classify it as noise. If bb wants a record of prompt changes, keep one compact row from message_end, with section names, sizes and tool names. The fix should be specific to this role, because other provider/unhandled rows are read (for example model-fallback rows in packages/db/src/data/events.ts).
What you ruled out
- Not Bound rejected extension payloads in fallback diagnostics #6025. That issue is about oversized extension payloads persisted in
provider/unhandleddiagnostics: the same storage pattern, but a different payload and code path. A byte cap from Bound rejected extension payloads in fallback diagnostics #6025 would trim these rows but still write two of them. - Related to bb's database grows without limit, and archiving doesn't shrink it #5730 (the database grows without limit) but not a duplicate. bb's database grows without limit, and archiving doesn't shrink it #5730 proposes compacting archived threads, and this is a write-side duplicate.
- No issue found for "system prompt snapshot", "provider/unhandled", "message_start", "systemPrompt", "pi system prompt" or "unhandled events" (open and closed).
- Still present on
mainat88cf8f6.
Suggested priority and effort (optional)
Medium: it hits every pi thread and grows with prompt size and session restarts. No data is lost, and there is no user workaround short of deleting threads. Effort is probably Low.
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report. (It ends with the marker. The investigation report is a private local analysis, summarized above.)
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 13, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,provider-pi, andconfirmed-repro.provider/unhandledevents.Treat Pi system message boundaries as internal noise (get-bb#7525)
Prune duplicated command output and started file-change diffs (#7806)