Skip to content

fix(session): check conditional append capability on streams - #568

Open
senamakel wants to merge 2 commits into
mainfrom
7964-tinyagents-append-capability
Open

senamakel wants to merge 2 commits into
mainfrom
7964-tinyagents-append-capability

Conversation

@senamakel

@senamakel senamakel commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What

Conversation append validates two capabilities from their owning storage ports:
ValidatedBatch on documents and ConditionalStreamAppend on streams. SQLite
advertises conditional append on its stream store, so checking it on documents
incorrectly rejects real host conversations.

The regression test masks ConditionalStreamAppend only on the document port
while leaving it available on streams, matching the production port split.

Refs tinyhumansai/openhuman#7964.

Validation

  • cargo test -p tinyagents-session: 507 passed, 0 failed; doctest passed
  • cargo test -p tinyagents-session threads::driver::append_tests: 19 passed
  • cargo clippy -p tinyagents-session --all-targets -- -D warnings
  • cargo fmt --all -- --check

Summary by CodeRabbit

  • Bug Fixes
    • Message appends now correctly recognize conditional stream support when it is available, even if the document store does not report that capability.
    • Unsupported capability errors now distinguish between missing document validation and missing conditional stream support.

senamakel and others added 2 commits October 23, 2026 12:02
Add a fixture that hides the conditional stream append capability on the
document port and a test asserting that append still succeeds when the
stream port advertises it, so capability checks are verified to consult
the stream port rather than the document port.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The append preflight validated both ValidatedBatch and
ConditionalStreamAppend against the document store, so a backend whose
stream store supports conditional appends could be rejected. Each
capability is now checked against the store that provides it, with a
separate error message for each.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@tinysweeper

tinysweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: 4da7a23fdddb8f52c9afbbca9c041c1b3f1b8163

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 3 of 3 files.
Pull request purpose (title): fix(session): check…

Diagnostics and supporting details

Full summary

Pull request purpose (title): fix(session): check conditional append capability on streams. The pull request fixes a capability-routing bug in conversation append: the `ValidatedBatch` check stays on the document port while `ConditionalStreamAppend` is now read from the stream port, which is the port that actually owns and implements that capability. This matters because SQLite advertises conditional append on its stream store, so the previous document-port check incorrectly rejected real host conversations.

Review snapshot

Change surface Files Review signal Count
Production 1 Active findings 0
Tests 2 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

Append admission in `crates/tinyagents-session/src/threads/driver/append.rs` no longer iterates a combined capability list against the document port. It validates `ValidatedBatch` via `self.docs.capabilities()` and separately validates `ConditionalStreamAppend` via `self.streams.capabilities()`, each with its own scoped error message. Test fixtures in `crates/tinyagents-session/src/threads/driver_append_fixtures.rs` gain a `hide_conditional_stream_append` flag on the `Documents` wrapper so that the capability can be masked on the document port only, plus a new `hide_document_conditional_stream_append` helper that builds a store whose docs wrapper hides the bit and whose streams are unchanged. A new regression test in `crates/tinyagents-session/src/threads/driver_append_tests.rs` asserts that append still succeeds when the document port lacks the capability but the stream port advertises it.

Features

  • Modified — Split append admission capability check per owning port: Conditional-append capability is now validated against the stream port rather than the document port, aligning admission with the port that actually supports conditional streams and removing false rejection of backends such as SQLite that advertise the bit only on streams. `ValidatedBatch` remains checked on the document port. Every other line of admission is unchanged, so the error surface narrows to the per-capability scoped messages. (crates/tinyagents-session/src/threads/driver/append.rs impl DriverConversationStore {)
  • Added — Document-port capability masking fixture: The `Documents` test wrapper can now hide `ConditionalStreamAppend` from its advertised capabilities while leaving the underlying store intact, and the new `hide_document_conditional_stream_append` helper produces a store configured that way for tests. Existing fixture construction passes the flag as false, so prior test behavior is unaffected. (crates/tinyagents-session/src/threads/driver_append_fixtures.rs impl Fault {, crates/tinyagents-session/src/threads/driver_append_fixtures.rs pub(super) fn faulted()
  • Added — Regression test for stream-port capability lookup: Pins that append succeeds when only the document port lacks `ConditionalStreamAppend`, exercising the newly routed check and guarding against reintroducing the document-port lookup. (crates/tinyagents-session/src/threads/driver_append_tests.rs async fn reconstructed_memory_prepared_append_reopens_and_preserves_classic_dupl)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The capability check now sits with the port that owns the bit, and the existing driver test asserting the failure originates from the stream port is consistent with the new direction; nothing in the diff breaks a caller or a test.
  • Lane summary: The change moves the `ConditionalStreamAppend` capability check from the document port's capabilities to the stream port's capabilities, which is the correct owner of that bit (the plan doc notes `StreamStore` carries no separate capability method, and the driver's existing test at line 274 already asserts the failure originates from the stream port). The fixture's `Documents::capabilities` hides the bit on the document port, and the new test asserts that append still succeeds, which is the right direction. The production path and test are consistent; nothing in the diff breaks a caller or a test. _The code index is behind this pull request (indexed at `f4e620d663ad`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane reports that the capability routing matches where each capability belongs, no deterministic-scanner evidence required adjudication, and no defect was introduced by the three changed files.
  • Lane summary: The change splits the append admission capability check so that ValidatedBatch is read from the document port and ConditionalStreamAppend from the stream port, and adds a fixture-backed test for the stream-port path. The capability routing matches where each capability belongs, no deterministic-scanner evidence was supplied that needs adjudication, and I found no defect introduced by these three files. _The code index is behind this pull request (indexed at `f4e620d663ad`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change splits the append admission check so `ConditionalStreamAppend` is read from the stream port (`self.streams`) rather than the document port, which matches the documented contract that `StreamStore` owns that capability, and it adds a fixture plus a test pinning that the check consults the stream port. No behavioural regression is visible: every other line of `admit_append` is unchanged, and the capability now comes from the port that actually implements conditional append. _The code index is behind this pull request (indexed at `f4e620d663ad`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane found no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `f4e620d663ad`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The description lane found the change consistent with the stated bug and the fixture that masks the capability only on documents, with no reportable defect; it could not locate the storage-kit definitions of the capabilities helper and document store capability method to fully confirm compilation, but nothing in the diff contradicts the description.
  • Lane summary: The change splits an append-admission capability check so that `ConditionalStreamAppend` is validated against the stream port instead of the document port, which matches the described bug (SQLite advertises conditional append on the stream store) and the test fixture that masks the capability only on documents. I could not see `Capabilities::without` or `DocumentStore::capabilities` in the reviewed tree (the storage-kit/harness definitions were not returned by the search), so I cannot fully confirm the fixture's helper compiles, but nothing in the diff contradicts the description; no reportable defect found. _The code index is behind this pull request (indexed at `f4e620d663ad`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.009482
  • Tokens: 291374 input · 4706 output · 59776 cached · 170 embedding
  • Updated: 2026-10-23T12:05:51Z
Head State Pass summary
4da7a23fdddb ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-23T12:05:51Z)

tinysweeper 0.1.2

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T12:06:46.288933Z 4da7a23 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 700f7d62-bb71-4fc3-aa5c-777187b847a5
📥 Commits

Reviewing files that changed from the base of the PR and between 8dd8f3f and 4da7a23.

📒 Files selected for processing: 3
  • crates/tinyagents-session/src/threads/driver/append.rs
  • crates/tinyagents-session/src/threads/driver_append_fixtures.rs
  • crates/tinyagents-session/src/threads/driver_append_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The append driver now checks ValidatedBatch on the document store and ConditionalStreamAppend on the stream store. A test fixture can hide the document store’s conditional-stream capability, and a test verifies that append succeeds through the stream port.

Changes: Append capability validation

Layer / File(s) Summary
Capability-hiding test fixture
crates/tinyagents-session/src/threads/driver_append_fixtures.rs
The fixture can hide ConditionalStreamAppend from the document store while retaining the stream store.
Port-specific append admission
crates/tinyagents-session/src/threads/driver/append.rs, crates/tinyagents-session/src/threads/driver_append_tests.rs
admit_append checks each capability on its respective store and returns a separate unsupported-capability error for each. A test verifies that append succeeds when the stream port exposes ConditionalStreamAppend.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: tinysweeper

Merge Risk: ⚪ Minimal · up to 4da7a

The append capability checks and their regression test appear ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: checking conditional append capability on the stream store.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the stream-side gate,
Then sends a message, small and straight.
The docs port hides one capability,
The stream port keeps its ability.
The message comes back safe and neat,
And thumps a happy rabbit beat.

Comment @coderabbitai help to get the list of available commands.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0095

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant