Skip to content

feat(session): add conformance checker and pluggable storage resolution #341#345

Open
mmpouya wants to merge 3 commits into
huggingface:mainfrom
mmpouya:feat/pluggable-session-storage
Open

feat(session): add conformance checker and pluggable storage resolution #341#345
mmpouya wants to merge 3 commits into
huggingface:mainfrom
mmpouya:feat/pluggable-session-storage

Conversation

@mmpouya

@mmpouya mmpouya commented Jul 12, 2026

Copy link
Copy Markdown

Implements steps 2 and 3 from #341
treats SessionStorage as a stable public extension point.

Changes:

Step 2 — Conformance checker (tau_agent.session.conformance)

  • verify_session_storage() — a pytest-ready helper that validates any SessionStorage implementation against the storage contract: fresh storage is empty, appends are durable and repeatable, all entry types round-trip, and reopen preserves data.
  • SessionStorageConformanceError — raised on the first violation with a clear message.
  • conformance_entries() — produces one linked chain of every entry type, including edge cases (float timestamps, None fields, nested JSON).
    Third-party packages (like tau_hub) can self-certify in one test:
from tau_agent.session import verify_session_storage

async def test_my_storage_conforms(tmp_path):
    await verify_session_storage(
        lambda: MyStorage(tmp_path / "db", session_id="one"),
        reopen=lambda: MyStorage(tmp_path / "db", session_id="one"),
    )

Step 3 — Pluggable storage resolution (tau_coding.session_storage)

  • create_session_storage(record, factory=None) is the new joint between tau_coding and storage backends.
  • Resolution order: explicit factory > TAU_SESSION_STORAGE env var (package.module: attribute) > default JSONL at record.path.
  • SessionStorageResolutionError with pointed messages for bad specs, missing modules/attributes, and non-callable factories.
    No changes to existing behaviour when nothing is configured.

Resolves #341

Note:

But still not updated the documentation (first step from #341).

@mmpouya
mmpouya requested a review from alejandro-ao as a code owner July 12, 2026 09:08
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.

Treat SessionStorage as a stable public extension point (and allow custom session storage in tau_coding)

1 participant