Skip to content

chore(docs): add ADR#0035 session store on NATS JetStream - #500

Merged
yordis merged 4 commits into
mainfrom
yordis/cebu-v1
Jul 24, 2026
Merged

chore(docs): add ADR#0035 session store on NATS JetStream#500
yordis merged 4 commits into
mainfrom
yordis/cebu-v1

Conversation

@yordis

@yordis yordis commented Jul 24, 2026

Copy link
Copy Markdown
Member
  • The platform Session (ADR#0031) has no persistence design, and ADR#0024 explicitly deferred the session stream topology to a separate decision; this records that decision so session persistence is settled rather than improvised per implementer.
  • It builds on the existing decider/JetStream substrate so sessions live on the one event-sourcing pattern the platform already runs, instead of a second bespoke store.
  • It commits to an append-only log because rewind, fork, resume, and audit are inherent to agent sessions and should fall out of the model rather than be bolted on.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Copilot AI review requested due to automatic review settings July 24, 2026 02:25
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only ADR and index entry; no runtime, API, or infrastructure code changes.

Overview
ADR#0035 closes the gap left by ADR#0024 and ADR#0031 by recording how platform Sessions are persisted: each session, subagent, and fork is a decider aggregate on shared JetStream stream SESSION_EVENTS (session.sessions.events.<session_id>), ratifying the prior crates/session domain model while replacing its KV-lease persistence with native expected_last_subject_sequence OCC.

The decision commits to append-only mutation (rewind/compaction/cancel are new events at replay), hybrid write preconditions (Any for commuting transcript facts, default At(head) for lifecycle/delegation invariants, NoStream for create/fork), typed protobuf events with boundary validation, in-stream Compacted markers, fork via shared-prefix replay plus mandatory sealing snapshots, subagent cascade via explicit policies and a reconciler processor, and keep-forever logs with snapshot-bounded replay (no ADR#0029 purge). Listing and model context are projections, not source of truth.

docs/adr/index.md gains a link to the new record.

Reviewed by Cursor Bugbot for commit ee857b4. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yordis, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 70ab9fa9-3d48-4574-9f1d-42e702e9d0f4

📥 Commits

Reviewing files that changed from the base of the PR and between c3fabbb and ee857b4.

📒 Files selected for processing (1)
  • docs/adr/0035-session-store-decider-aggregate.md

Walkthrough

Adds draft ADR 0035 describing a session store as a decider aggregate on NATS JetStream, including stream semantics, concurrency, compaction, forks, cascades, projections, non-goals, consequences, and references. Registers the ADR in the index.

Changes

Session Store Architecture Decision

Layer / File(s) Summary
ADR context and session model
docs/adr/0035-session-store-decider-aggregate.md
Adds ADR metadata, context, substrate requirements, and session-event stream topology.
Decider aggregate decisions
docs/adr/0035-session-store-decider-aggregate.md
Defines append-only JetStream writes, ordering, concurrency, validation, compaction, forks, cascades, projections, replay, and rejected alternatives.
Scope, consequences, and ADR index
docs/adr/0035-session-store-decider-aggregate.md, docs/adr/index.md
Adds non-goals, consequences, references, and the ADR 0035 index entry.

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

Possibly related PRs

Poem

A rabbit reads the streams at night,
Where session events hop into sight.
Forks share paths, snapshots gleam,
JetStream guards the flowing stream.
ADR carrots crunch—what a scheme!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the new ADR#0035 session store decision on NATS JetStream.
Description check ✅ Passed The description directly summarizes the ADR's session persistence decision and append-only JetStream design.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/cebu-v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/adr/0035-session-store-decider-aggregate.md`:
- Around line 20-25: Update the historical-context sentence in ADR#0035 so it
states that the ADR index ran through ADR#0034 before this decision, rather than
asserting that it currently ends at ADR#0034. Preserve the surrounding
references to ADR#0024 and the JetStream topology.
- Around line 76-79: Replace every bare ADR#NNNN occurrence reported in this
document, including the visible references and all additional listed locations,
with relative Markdown links to the corresponding ADR documents. Preserve the
surrounding prose and link each ADR number consistently using the repository’s
existing ADR filename pattern.
- Around line 138-145: The documented Any write path must make idempotency
atomic with append so concurrent deliveries sharing a command key cannot append
duplicate facts. Update the session-store decision flow around the Any-path
events and their idempotency handling to reserve or deduplicate the command
atomically with the append, or route idempotent commands through a guarded write
that replays and returns the existing result on conflict; preserve unguarded Any
behavior only for commands without idempotency requirements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d8e2b348-d8f7-492a-b6b1-17993882c806

📥 Commits

Reviewing files that changed from the base of the PR and between 27d43cf and c3fabbb.

📒 Files selected for processing (2)
  • docs/adr/0035-session-store-decider-aggregate.md
  • docs/adr/index.md

Comment thread docs/adr/0035-session-store-decider-aggregate.md Outdated
Comment thread docs/adr/0035-session-store-decider-aggregate.md Outdated
Comment thread docs/adr/0035-session-store-decider-aggregate.md Outdated
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Copilot AI review requested due to automatic review settings July 24, 2026 02:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 66c7f9a. Configure here.

Comment thread docs/adr/0035-session-store-decider-aggregate.md Outdated
…0035

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Copilot AI review requested due to automatic review settings July 24, 2026 02:35

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Copilot AI review requested due to automatic review settings July 24, 2026 02:51

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yordis
yordis merged commit 78f0fb2 into main Jul 24, 2026
7 checks passed
@yordis
yordis deleted the yordis/cebu-v1 branch July 24, 2026 02:59
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