Skip to content

feat: spill oversized tool results to tape - #278

Draft
PsiACE wants to merge 7 commits into
mainfrom
feat/tool-result-spill
Draft

feat: spill oversized tool results to tape#278
PsiACE wants to merge 7 commits into
mainfrom
feat/tool-result-spill

Conversation

@PsiACE

@PsiACE PsiACE commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Store oversized string tool results in a sibling spill tape and keep only a bounded preview in the session tape. Models retrieve stored content in bounded pages with spill.read, so large payloads remain available without expanding later model contexts.

Tape sidecars are mounted through the new provide_tape_sidecars hook. The builtin SpillStore is the first provider and reuses the active TapeStore, so SQLite and other storage plugins need no changes. The main tape handles fork, merge, archive, and reset for every mounted sidecar; sidecar failures do not block it.

Spill configuration belongs to its plugin through spill.threshold or BUB_SPILL_THRESHOLD. Setting the threshold to 0 stops new spills while leaving existing handles readable.

Checks

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy src
  • make test (293 passed)
  • Astro website build

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bub 7a18bd0 Commit Preview URL

Branch Preview URL
Aug 14 2026, 04:39 AM

Comment thread src/bub/tools.py Outdated
@frostming
frostming force-pushed the feat/tool-result-spill branch from 801eb6a to 7a18bd0 Compare August 14, 2026 04:37
Comment thread src/bub/hooks/specs.py
@hookspec
def provide_tape_sidecars(self) -> list[TapeSidecar]:
"""Provide capabilities backed by sibling tapes mounted on every session tape."""
raise NotImplementedError

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be implemented multiple times, no need to return a list

Comment thread src/bub/store.py
continue
result.append(filename)
return result
return sorted(file.stem for file in self._directory.glob("*.jsonl"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will count in archives as well, maybe give sidecars some special marks in the filename

Comment thread src/bub/tools.py
"""Runtime context passed to tools that opt into context."""

tape: Tape
tape: Any

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Tape here

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