Skip to content

docs(sessions): draft session control and shared live-events RFC - #6495

Open
mmabrouk wants to merge 65 commits into
mainfrom
agent/session-execution-rfc
Open

docs(sessions): draft session control and shared live-events RFC#6495
mmabrouk wants to merge 65 commits into
mainfrom
agent/session-execution-rfc

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 2, 2026

Copy link
Copy Markdown
Member

Agenta currently ties live output to the browser that started a turn, delivers Stop through delayed coordination state, keeps queued input in browser memory, and has no replay cursor for another reader.

This draft RFC separates session control from session reading. It defines durable commands, direct Stop delivery through a replaceable runner adapter, warm cancellation, shared temporary live frames, durable replay, and server-held pending input.

Confirmed direction

  • Use direct authenticated API-to-runner Stop delivery in version one.
  • Keep runner-initiated long polling as parked future work in Linear AGE-4253.
  • Keep expected_execution_id optional publicly. First-party clients must send it when known.
  • Keep current Redis ownership in the first release.
  • Separate temporary live frames from durable facts.
  • Preserve the sandbox and native harness session after Stop.
  • Keep Stop separate from Delete.

Open decisions

  • Repair records into immutable session history or add a separate session_events table.
  • Choose the durable per-session cursor mechanism.
  • Define running and alive after warm Stop against current liveness consumers.
  • Reject or quarantine output that arrives after watchdog terminal settlement.
  • Set live-frame retention and client buffer limits.
  • Finalize Queue, Steer, approval races, and public endpoint names.

Evidence and implementation branches

Spikes and code are in #6496 through #6506. The tracking board is https://trello.com/b/O9N0MioN/sesssions. The RFC remains AI-generated, low weight, and unapproved.

How to review

  1. Read requirements.md for bugs and required behavior.
  2. Read decisions.md for confirmed direction and provisional choices.
  3. Read rfc.md for the complete design.
  4. Read status.md for current implementation and reviewer gates.
  5. Review Spike D in test(sessions): characterize record IDs before immutable history #6499 before selecting the durable-history storage model.

Review round of 2026-09-03

Three reviewers read the RFC head 3a3374df02 against review-standard.md: a Claude Fable subagent, Codex GPT-5.6 sol at high effort, and a Claude Opus subagent for repository practices and interface design. An Opus QA audit graded every row of qa.md. The four files sit under reviews/, with the decision list the edit followed. Commit 949577a563 applies the agreed changes; 4d07bdd96d and 014e9381c8 fix the contradictions a second Opus review found. Everything is agent-generated and low weight.

What changed:

  • The public Send command route is cut from version one. Invoke and /cancel stay; the error envelope from api/AGENTS.md and one error table are in contracts/public-api.md.
  • The plan is seven increments, each with a switch and a rollback: AGENTA_SESSIONS_DURABLE_STOP, AGENTA_SESSIONS_HISTORY_WRITES, AGENTA_SESSIONS_SHARED_READER, and AGENTA_SESSIONS_LATE_OUTPUT.
  • The per-session sequence leaves the ownership row. Session records live on the analytics database, so a cursor owned by the records domain is proposed (open question O1).
  • Retention separation from the tracing quota is the first task and a completion gate of the history package.
  • Temporary frames reuse the records ingest stream with kind and frame_index; six durable events are frozen with payloads; the rest wait for their package. Measured stream: 10 to 75 frames per second, 63-byte median frame (live-frame-envelope.md).
  • Stop: pending commands redeliver while the session beats, one terminal outcome is a database compare-and-set, settlement is atomic where stores are shared, the watchdog is the second writer, sweep passes are bounded, and the desktop shows "stopping" until the server accepts.
  • Event authorization is re-checked over the connection lifetime; frame ingress is bound to the owner claim; logs carry identifiers only.
  • qa.md has a proven column (13 proven, 17 partly, 26 not run before tonight) and ten new race and failure rows.

Seven decisions wait for Mahmoud in open-questions.md, each as Option 1 / Option 2 with a recommendation: sequence home, quarantine or reject, Codex reap or pin bump, rollout granularity, Stop verb, runner grace period, and not_running versus lost.

The plain-English protocol for the night: https://claude.ai/code/artifact/8712db25-719d-45bc-a67b-f47014ab0eb8

https://claude.ai/code/session_01GAqSs7fw6QRi2n1ZJ2tmAV

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 4, 2026 10:25pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Summary

Summary by CodeRabbit

  • Documentation
    • Added comprehensive design documentation covering session control and live events.
    • Defined contracts for Stop actions, live output, event delivery, session history, replay, snapshots, and public APIs.
    • Documented recovery, retention, authorization, rollout controls, rollback procedures, and quality requirements.
    • Added staged implementation plans and work packages for recovery, durable history, live sharing, approvals, Queue, and Steer.
    • Added research, review findings, decisions, QA evidence, and implementation status.

Walkthrough

This PR adds a documentation baseline for session control and live events. It defines contracts, architecture, durable history, live delivery, recovery, rollout increments, work packages, review decisions, and QA evidence.

Changes

Session control and live events

Layer / File(s) Summary
Design foundation and review criteria
docs/design/session-control-and-live-events/README.md, context.md, research.md, review-standard.md, reviews/*
Adds the design scope, research findings, review framework, independent reviews, simplifications, and release recommendations.
Control and public API contracts
contracts/commands.md, contracts/public-api.md, requirements.md, tonight-handoff.md
Defines private command states, Stop delivery, idempotent admission, execution guards, snapshots, SSE behavior, recovery states, and deferred operations.
Events, frames, and durable history
contracts/events.md, contracts/persistence.md, live-frame-envelope.md, records-invariants.md
Defines versioned frame and event envelopes, six durable events, Redis retention, replay handoff, cursor-based sequencing, immutable records, terminal settlement, and late-output quarantine.
Architecture and staged delivery
architecture.md, rfc.md, decisions.md, plan.md, work-packages/*, handoff.md, open-questions.md
Connects the runtime components and paths, records settled decisions, defines feature switches and rollback, and stages seven delivery increments.
Status and QA evidence
status.md, qa.md, evidence/README.md
Records implementation readiness, known evidence gaps, provider coverage, validation invariants, release metrics, and timing requirements.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🟡 Moderate · up to f6533

This RFC defines session Stop, recovery, live-event, and durable-history behavior, but conflicting and incomplete contract details could lead implementations to use inconsistent recovery, replay, and validation behavior. Resolve the documented inconsistencies before treating this baseline as merge-ready.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the draft RFC for session control and shared live events, which matches the main changeset.
Description check ✅ Passed The description directly explains the proposed session-control, Stop-delivery, live-frame, replay, and rollout changes documented in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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 agent/session-execution-rfc

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.

… 2026-09-04

Sequence cursor on the analytics database, quarantine for late output, the Codex
reap now and the pin bump as its own PR, one global switch per increment, keep
/cancel, a 30 s runner grace period, keep not_running past teardown.

Claude-Session: https://claude.ai/code/session_01GAqSs7fw6QRi2n1ZJ2tmAV
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

📘 Docs preview

Status ✅ Ready
Preview https://pr-6495-agenta-docs-preview.mahmoud-637.workers.dev/docs
Inspect Actions run
Commit f653399acbb6ad558505cf9b5ae6fc759af10750

This comment updates in place on every push.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 12


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: c7a94f4d-ae79-48e6-bb5c-40f27ed83ee4

📥 Commits

Reviewing files that changed from the base of the PR and between b57de39 and 42ed944.

📒 Files selected for processing (32)
  • docs/design/session-control-and-live-events/README.md
  • docs/design/session-control-and-live-events/architecture.md
  • docs/design/session-control-and-live-events/context.md
  • docs/design/session-control-and-live-events/contracts/commands.md
  • docs/design/session-control-and-live-events/contracts/events.md
  • docs/design/session-control-and-live-events/contracts/persistence.md
  • docs/design/session-control-and-live-events/contracts/public-api.md
  • docs/design/session-control-and-live-events/decisions.md
  • docs/design/session-control-and-live-events/evidence/README.md
  • docs/design/session-control-and-live-events/handoff.md
  • docs/design/session-control-and-live-events/live-frame-envelope.md
  • docs/design/session-control-and-live-events/open-questions.md
  • docs/design/session-control-and-live-events/plan.md
  • docs/design/session-control-and-live-events/qa.md
  • docs/design/session-control-and-live-events/records-invariants.md
  • docs/design/session-control-and-live-events/requirements.md
  • docs/design/session-control-and-live-events/research.md
  • docs/design/session-control-and-live-events/review-standard.md
  • docs/design/session-control-and-live-events/reviews/codex-gpt-5.6-sol-2026-09-03.md
  • docs/design/session-control-and-live-events/reviews/decision-list-2026-09-03.md
  • docs/design/session-control-and-live-events/reviews/fable-2026-09-03.md
  • docs/design/session-control-and-live-events/reviews/opus-practices-interfaces-2026-09-03.md
  • docs/design/session-control-and-live-events/reviews/qa-audit-2026-09-03.md
  • docs/design/session-control-and-live-events/rfc.md
  • docs/design/session-control-and-live-events/status.md
  • docs/design/session-control-and-live-events/tonight-handoff.md
  • docs/design/session-control-and-live-events/work-packages/README.md
  • docs/design/session-control-and-live-events/work-packages/durable-approvals.md
  • docs/design/session-control-and-live-events/work-packages/durable-history.md
  • docs/design/session-control-and-live-events/work-packages/live-relay.md
  • docs/design/session-control-and-live-events/work-packages/queue-steer.md
  • docs/design/session-control-and-live-events/work-packages/stop-and-recovery.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment on lines +45 to +47
The runner wraps invoke frames in the shared envelope and posts them through the existing records
ingest stream. A relay consumer reads temporary frames and forwards them through Server-Sent Events
(SSE). The records worker ignores temporary frames and persists durable events.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- architecture excerpt ---'
sed -n '35,125p' docs/design/session-control-and-live-events/architecture.md
printf '%s\n' '--- records invariants ---'
sed -n '1,220p' docs/design/session-control-and-live-events/records-invariants.md
printf '%s\n' '--- related files ---'
git ls-files 'docs/design/session-control-and-live-events/*'

Repository: Agenta-AI/agenta

Length of output: 18523


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions

Length of output: 21940


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- recovery and durable-delivery references ---'
rg -n -i -C 3 'outbox|reconstruct|recovery source|durable incompleteness|bounded.*retry|drop|message\.completed|tool\.completed|records ingest|record ingest|turn-end drain|terminal outcome' \
  docs/design/session-control-and-live-events \
  -g '*.md'

Repository: Agenta-AI/agenta

Length of output: 50374


Define recovery for durable events lost before Redis acceptance.

The runner can drop a durable record after bounded ingest retries. The records worker can recover only records that entered the ingest stream. Define a durable runner outbox, a watchdog or API reconstruction path, or an explicit durable incompleteness outcome. Add failure-injection coverage.

Comment on lines +59 to +63
```text
pending -> claimed -> applied
-> obsolete
-> lost
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Complete the command recovery state machine.

claim_expires_at and the lease-expiry rule require a claimed -> pending transition for redelivery. The diagram also omits the documented pending -> lost path when the runner is gone. Define these transitions, their compare-and-set predicates, and the behavior after bounded attempts. Without these rules, an accepted Stop can remain claimed or pending without a deterministic recovery outcome.

Comment on lines +20 to +23
frame_or_event_id
entity_id
type
payload

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

printf '%s\n' '--- target contract ---'
cat -n docs/design/session-control-and-live-events/contracts/events.md
printf '%s\n' '--- related identity contracts ---'
cat -n docs/design/session-control-and-live-events/contracts/persistence.md
printf '%s\n' '--- invariant files ---'
fd -i 'records-invariants' . -t f -x sh -c 'cat -n "$1"' sh {}
printf '%s\n' '--- identity references ---'
rg -n -C 3 'frame_or_event_id|record_id|event_id|frame_index|dedup|idempot' docs/design/session-control-and-live-events

Repository: Agenta-AI/agenta

Length of output: 50375


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 9275


🏁 Script executed:

printf '%s\n' '--- envelope specification ---'
cat -n docs/design/session-control-and-live-events/live-frame-envelope.md | sed -n '30,55p'
printf '%s\n' '--- requirements around durable identity ---'
cat -n docs/design/session-control-and-live-events/requirements.md | sed -n '88,104p'
printf '%s\n' '--- decisions around ingest and ordering ---'
cat -n docs/design/session-control-and-live-events/decisions.md | sed -n '128,148p'
printf '%s\n' '--- exact identity declarations in this design ---'
rg -n -C 2 --glob '*.md' 'frame_or_event_id|producer-generated stable|stable (record|event) ID|event_id|record_id' docs/design/session-control-and-live-events

Repository: Agenta-AI/agenta

Length of output: 14968


Define the durable deduplication identity mapping.

Specify whether frame_or_event_id, record_id, and event_id are identical, how each identifier is scoped, and which identifier becomes the Postgres key. The current contracts define retry stability but no cross-contract mapping, so ingress deduplication and durable idempotency can diverge.

Comment on lines +41 to +42
Ingress accepts an identical retry and rejects conflicting reuse of an ID or index. It records a
frame gap. Clients order frames by `(execution_id, frame_index)` and durable events by `sequence`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

printf '%s\n' '--- events.md ---'
sed -n '1,125p' docs/design/session-control-and-live-events/contracts/events.md
printf '%s\n' '--- related contract files ---'
find docs/design/session-control-and-live-events -maxdepth 3 -type f -print | sort
printf '%s\n' '--- references to frame_index and execution_id in the design scope ---'
rg -n -C 3 'frame_index|execution_id|sequence|frame_or_event_id' docs/design/session-control-and-live-events

Repository: Agenta-AI/agenta

Length of output: 50375


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 10657


🏁 Script executed:

printf '%s\n' '--- architecture execution and live-path sections ---'
sed -n '1,115p' docs/design/session-control-and-live-events/architecture.md
printf '%s\n' '--- requirements and public event contract ---'
sed -n '65,110p' docs/design/session-control-and-live-events/requirements.md
sed -n '113,132p' docs/design/session-control-and-live-events/contracts/public-api.md
printf '%s\n' '--- live envelope and records invariants ---'
sed -n '1,180p' docs/design/session-control-and-live-events/live-frame-envelope.md
sed -n '1,75p' docs/design/session-control-and-live-events/records-invariants.md
printf '%s\n' '--- execution/frame ordering statements outside events.md ---'
rg -n -C 2 'one execution|current execution|late output|stale|frame.*order|order.*frame|frame_index|execution_id' docs/design/session-control-and-live-events --glob '!reviews/**'

Repository: Agenta-AI/agenta

Length of output: 50374


🏁 Script executed:

printf '%s\n' '--- stop/recovery rules for stale frames and execution transitions ---'
sed -n '1,180p' docs/design/session-control-and-live-events/work-packages/stop-and-recovery.md
printf '%s\n' '--- decisions around frame ordering and late output ---'
sed -n '115,150p' docs/design/session-control-and-live-events/decisions.md
printf '%s\n' '--- event and client behavior requirements ---'
sed -n '1,90p' docs/design/session-control-and-live-events/contracts/events.md
sed -n '116,130p' docs/design/session-control-and-live-events/contracts/public-api.md

Repository: Agenta-AI/agenta

Length of output: 10652


Define ordering across executions.

frame_index resets for each execution_id, and the contract provides no session-level order for temporary frames. If a session receives frames from multiple executions, (execution_id, frame_index) does not establish their temporal order. Define a per-session live order, or state that clients accept only the current execution and discard stale frames.

Comment on lines +39 to +44
The runner sends frames and events through the existing Redis records ingest stream. The relay
consumer reads frames. The records worker ignores frames and stores durable events.

The worker acknowledges an entry only after the analytics Postgres transaction commits. A storage
failure leaves it pending for retry. One invalid record cannot discard unrelated valid records in
the same batch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings

Length of output: 9717


🏁 Script executed:

#!/bin/bash
set -eu
file='docs/design/session-control-and-live-events/contracts/persistence.md'
printf '%s\n' '--- target contract ---'
cat -n "$file" | sed -n '1,90p'
printf '%s\n' '--- related session-control/live-events files ---'
git ls-files | rg '(^|/)(session-control-and-live-events|.*session.*control.*|.*live.*event.*)' | sed -n '1,160p'
printf '%s\n' '--- Redis stream and consumer-group references ---'
rg -n -i --glob '!node_modules' --glob '!dist' '(records ingest|ingest stream|consumer group|xgroup|xreadgroup|redis.*stream|stream.*redis|relay consumer|records worker)' . | sed -n '1,240p'

Repository: Agenta-AI/agenta

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -eu
target='docs/design/session-control-and-live-events'
printf '%s\n' '--- persistence contract ---'
cat -n "$target/contracts/persistence.md" | sed -n '1,90p'
printf '%s\n' '--- design files ---'
git ls-files "$target" | sed -n '1,160p'
printf '%s\n' '--- stream-related text in the design ---'
rg -n -i '(redis|stream|consumer|acknowledge|pending|relay|records worker|fan.?out|broadcast)' "$target" | sed -n '1,240p'
printf '%s\n' '--- repository-owned matching implementation/config references, excluding generated/vendor trees ---'
rg -n -i --glob '!**/openapi.json' --glob '!**/openapi.yaml' --glob '!**/package-lock.json' --glob '!**/pnpm-lock.yaml' --glob '!**/yarn.lock' --glob '!**/poetry.lock' --glob '!**/uv.lock' --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/.venv/**' '(records ingest|ingest stream|consumer group|xreadgroup|xgroup|redis.*stream|stream.*redis|records worker|relay consumer)' services api web docs | sed -n '1,260p'

Repository: Agenta-AI/agenta

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -eu
base='docs/design/session-control-and-live-events'
printf '%s\n' '--- architecture stream path ---'
cat -n "$base/architecture.md" | sed -n '38,58p'
printf '%s\n' '--- event routing and retention ---'
cat -n "$base/contracts/events.md" | sed -n '68,88p'
printf '%s\n' '--- decisions on temporary frames ---'
cat -n "$base/decisions.md" | sed -n '128,148p'
printf '%s\n' '--- live relay work package ---'
cat -n "$base/work-packages/live-relay.md" | sed -n '1,75p'
printf '%s\n' '--- records invariants acknowledgement sections ---'
cat -n "$base/records-invariants.md" | sed -n '100,125p'
cat -n "$base/records-invariants.md" | sed -n '190,205p'
printf '%s\n' '--- all explicit group/fan-out/independent-delivery terms in this design ---'
rg -n -i '(consumer group|separate group|independent delivery|fan.?out|broadcast|shared consumer|shared reader|acknowledg)' "$base" | sed -n '1,220p'

Repository: Agenta-AI/agenta

Length of output: 19251


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- candidate record worker and stream files ---'
fd -i -t f '(records|stream|relay|watch)' api services | rg -i '(record.*worker|worker.*record|redis.*stream|stream.*redis|relay|watch)' | sed -n '1,180p'
printf '%s\n' '--- record ingest route and worker symbols ---'
rg -n -i --glob '*.py' --glob '!**/openapi*' '(records_worker|append_many|processed_ids|records/ingest|xreadgroup|xack|consumer_group|consumer group|group_name)' api | sed -n '1,240p'

Repository: Agenta-AI/agenta

Length of output: 16293


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- records stream wiring ---'
cat -n api/entrypoints/worker_streams.py | sed -n '70,100p'
cat -n api/entrypoints/worker_streams.py | sed -n '155,175p'
printf '%s\n' '--- records worker contract and processing ---'
cat -n api/oss/src/tasks/asyncio/sessions/records_worker.py | sed -n '40,105p'
cat -n api/oss/src/tasks/asyncio/sessions/records_worker.py | sed -n '145,190p'
cat -n api/oss/src/tasks/asyncio/sessions/records_worker.py | sed -n '220,285p'
printf '%s\n' '--- shared Redis consumer read and acknowledgement ---'
cat -n api/oss/src/tasks/asyncio/shared/consumer.py | sed -n '88,160p'

Repository: Agenta-AI/agenta

Length of output: 13496


🌐 Web query:

Redis Streams XREADGROUP consumer groups distribute messages within a group and XDEL deletes entries globally official documentation

💡 Result:

Redis Streams provides powerful mechanisms for message distribution and stream management through consumer groups and specific deletion commands. Message Distribution with XREADGROUP When using XREADGROUP, Redis streams enable server-side load balancing of messages to a group of consumers [1][2]. - Distribution: Within a consumer group, messages are distributed among consumers [3][2]. While a specific message has a single owner at any given time, the group tracks which consumer is processing which message [3][4]. - Pending Entries List (PEL): When a consumer reads a message via XREADGROUP, that message is added to the consumer's Pending Entries List (PEL) [3][4][2]. The message remains in the PEL until the consumer explicitly acknowledges it using the XACK command [3][2]. - Message Ownership: If a consumer fails to process a message, other consumers in the group can use XCLAIM or XAUTOCLAIM to take ownership of those pending messages [2]. Message Deletion: XDEL vs. XDELEX The behavior of deleting messages depends on the command used and your Redis version: 1. XDEL (Standard Deletion) - XDEL removes entries from the stream itself [5][6]. - Crucially, XDEL does not clean up references to the deleted message in consumer group PELs [7][8]. If a message was already delivered to a consumer and added to its PEL, it will persist in the PEL even after an XDEL operation until an XACK is issued [7][8]. This can lead to memory growth if not managed [8]. 2. XDELEX (Advanced Deletion, available since Redis 8.2) - To address the limitations of XDEL regarding consumer groups, Redis 8.2 introduced XDELEX [9][10]. - XDELEX provides fine-grained control: - KEEPREF (Default): Functions like XDEL, leaving PEL references intact [9]. - DELREF: Deletes the entries from the stream AND removes all associated references from all consumer group PELs, effectively cleaning up all traces of the messages [9]. - ACKED: Only deletes entries that have already been read and acknowledged by all consumer groups [9]. In summary, while XREADGROUP facilitates distributed consumption, XDEL is a stream-level operation that does not automatically synchronize with consumer group state. For scenarios requiring simultaneous cleanup of stream entries and PEL references, XDELEX is the recommended command in supported versions [9][8][10].

Citations:


Define independent delivery and coordinated deletion for streams:records.

RecordsWorker uses XREADGROUP with worker-records, then calls XACK and XDEL. Redis distributes entries within a consumer group, and XDEL removes entries from the stream for all groups. Define separate consumer groups and a deletion rule that preserves entries until both consumers finish. Specify handling for ignored kinds and mixed frame/event batches.

Comment on lines +67 to +68
Deploy #6496 on main, #6503 on #6496, #6501 on #6503, and #6504 on #6503 after the pure fixes.
Run control, failure, provider, harness, retry, settlement, and rollback rows in `qa.md`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

printf '%s\n' '--- plan.md ---'
sed -n '1,110p' docs/design/session-control-and-live-events/plan.md
printf '%s\n' '--- status.md ---'
sed -n '1,180p' docs/design/session-control-and-live-events/status.md
printf '%s\n' '--- durable-approvals.md ---'
sed -n '1,220p' docs/design/session-control-and-live-events/work-packages/durable-approvals.md

Repository: Agenta-AI/agenta

Length of output: 13332


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions

Length of output: 18447


🏁 Script executed:

printf '%s\n' '--- references to `#6504`, approvals, and increment 6 ---'
rg -n -C 3 '`#6504`|increment 6|durable approval|approval|continuation' docs/design/session-control-and-live-events \
  -g '*.md' | head -n 260
printf '%s\n' '--- package files ---'
find docs/design/session-control-and-live-events/work-packages -maxdepth 1 -type f -print | sort

Repository: Agenta-AI/agenta

Length of output: 34003


Define the approval scope of #6504 before the Stop checkpoint.

#6504 is described as covering “approvals,” while increment 6 separately owns durable answer acceptance and continuation delivery. Distinguish approval cancellation and execution guards from increment-6 behavior. If #6504 includes durable approvals, add the required switch, QA rows, and rollback path.

Comment on lines +56 to +60
## Dependency to verify early

Another design review reports that the vendored sandbox-agent cannot cancel an execution while
preserving the harness session, and that a patch would require a Daytona snapshot rebuild. This
has not yet been verified in this workspace. It is the first research task for the Stop track.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- changed hunk ---'
git diff -- docs/design/session-control-and-live-events/research.md
printf '%s\n' '--- research context ---'
sed -n '1,100p' docs/design/session-control-and-live-events/research.md
printf '%s\n' '--- related requirements and review guidance ---'
find . -iname 'requirements.md' -o -iname '*review*standard*' -o -iname '*review*'
printf '%s\n' '--- vendored sandbox-agent references ---'
rg -n -i --glob '!node_modules' --glob '!dist' 'sandbox-agent|warm.?stop|preserv(e|ing).*harness|cancel.*execution|Daytona|snapshot rebuild|continuation' .

Repository: Agenta-AI/agenta

Length of output: 50373


🤖 get_repo_knowledge executed:

get_repo_knowledge Agenta-AI/agenta /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/learnings /tmp/coderabbit-repo-knowledge/agenta-ai-agenta-4b53879a/conventions

Length of output: 24647


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- changed hunk ---'
git diff --no-ext-diff --unified=30 -- docs/design/session-control-and-live-events/research.md
printf '%s\n' '--- research document ---'
sed -n '1,110p' docs/design/session-control-and-live-events/research.md
printf '%s\n' '--- scoped design files ---'
find docs/design/session-control-and-live-events -maxdepth 2 -type f -print
printf '%s\n' '--- requirements and warm-stop claims in scoped docs ---'
rg -n -i 'warm|stop|continu|release|guarantee|sandbox-agent|Daytona|snapshot|harness|cancel' docs/design/session-control-and-live-events docs -g 'requirements.md' -g '*.md'
printf '%s\n' '--- runner sandbox-agent implementation map ---'
find services/runner/src/engines/sandbox_agent services/runner/tests -maxdepth 3 -type f -print 2>/dev/null | head -200
printf '%s\n' '--- runner references ---'
rg -n -i 'warm|stop|continu|cancel|snapshot|harness|sandbox-agent|daytona' services/runner/src/engines/sandbox_agent services/runner/src/engines/sandbox_agent.ts services/runner/tests 2>/dev/null

Repository: Agenta-AI/agenta

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- design scope files ---'
find docs/design/session-control-and-live-events -maxdepth 2 -type f -print | sort
printf '%s\n' '--- exact research excerpt ---'
nl -ba docs/design/session-control-and-live-events/research.md | sed -n '45,70p'
printf '%s\n' '--- scoped design claims ---'
rg -n -i 'warm|stop|continu|release|guarantee|sandbox-agent|Daytona|snapshot|harness|cancel' docs/design/session-control-and-live-events -g '*.md' || true
printf '%s\n' '--- requirements files near the design ---'
find docs/design -iname 'requirements.md' -print | sort
printf '%s\n' '--- sandbox-agent source files ---'
find services/runner/src/engines/sandbox_agent -maxdepth 1 -type f -print | sort
printf '%s\n' '--- directly relevant source matches ---'
rg -n -i 'warm|stop|continu|cancel|snapshot|harness|daytona' \
  services/runner/src/engines/sandbox_agent/engine.ts \
  services/runner/src/engines/sandbox_agent/run-turn.ts \
  services/runner/src/engines/sandbox_agent/session-pool.ts \
  services/runner/src/engines/sandbox_agent/acp-http-client.ts \
  services/runner/src/engines/sandbox_agent/daemon.ts 2>/dev/null || true

Repository: Agenta-AI/agenta

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -e
line_range() { awk -v a="$1" -v b="$2" 'NR>=a && NR<=b {printf "%6d %s\n", NR, $0}' "$3"; }
printf '%s\n' '--- research lines 50-65 ---'
line_range 50 65 docs/design/session-control-and-live-events/research.md
printf '%s\n' '--- requirements lines 1-42 ---'
line_range 1 42 docs/design/session-control-and-live-events/requirements.md
printf '%s\n' '--- review standard lines 55-82 and 185-212 ---'
line_range 55 82 docs/design/session-control-and-live-events/review-standard.md
line_range 185 212 docs/design/session-control-and-live-events/review-standard.md
printf '%s\n' '--- status lines 50-90 ---'
line_range 50 90 docs/design/session-control-and-live-events/status.md
printf '%s\n' '--- evidence README ---'
cat docs/design/session-control-and-live-events/evidence/README.md
printf '%s\n' '--- QA warm-stop rows ---'
rg -n -i -C 3 'warm|daytona|codex|cancel|continu' docs/design/session-control-and-live-events/qa.md
printf '%s\n' '--- diff summary and research diff ---'
git diff --stat -- docs/design/session-control-and-live-events
git diff --no-ext-diff --unified=8 -- docs/design/session-control-and-live-events/research.md

Repository: Agenta-AI/agenta

Length of output: 26715


Update this section to match the release evidence.

status.md and qa.md record warm Stop and continuation passes for Daytona. The remaining gaps are the full Codex 1.1.7/1.8.0 comparison, Daytona Codex child cleanup, and the final combined qa.md run. Remove the blanket “not verified” statement and the snapshot-rebuild claim unless they have specific evidence paths.

Comment on lines +22 to +27
A4. Collapse the six milestones to increments in this order: (1) pure fixes #6502 and #6500;
(2) Stop and recovery behind the flag; (3) history producer plus retention separation, no
client change; (4) shared reading for secondary readers (relay + sequence + snapshot +
one reducer, sender stays on invoke); (5) sender on the shared path; (6) durable approvals;
(7) Queue, then Steer. Merge work-packages/shared-client-reader.md into live-relay.md.
Split approvals out of queue-steer-approvals.md as the earlier increment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the rollout count consistent.

A4 says “six milestones” but lists seven increments. This conflicts with the seven-increment structure in README.md and requirements.md. Clarify whether six refers to the former milestone count. Otherwise change it to “seven increments” so implementation order and rollback references use one count.

Comment on lines +99 to +111
## Part 2: open for Mahmoud (write as Option 1 / Option 2 with recommendation in open-questions.md)

O1. Sequence home: cursor table on the analytics engine (recommend) vs move records to core.
O2. Late output: quarantine (Fable, Opus recommend: built, keeps usage and tool result, one
predicate on reads) vs reject (Codex recommends: fail closed, no second class of rows).
Code stays quarantine behind the flag until decided.
O3. Codex child: ship the reap from #6496 now, pin bump 1.1.7 -> 1.8.0 as a separate PR
(recommend) vs bump first.
O4. Rollout granularity: global env switch per increment (recommend for version one, simpler)
vs kill switch plus project allowlist plus capability advertisement (Codex).
O5. Stop verb: keep /cancel (recommend) vs add /stop.
O6. Runner stop grace period in the shared compose file (needs a number above 15 s).
O7. `not_running` vs `lost` past teardown on the `running` key (multi-runner only).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Synchronize the open-question status with the settled contracts.

The PR objective and the final baseline state that the remaining design questions are settled, but this file still labels O1-O7 open. commands.md still makes the obsolete versus lost behavior depend on O7, while public-api.md already specifies not_running after teardown. Keep one authoritative decision state before implementation branches consume these contracts.

  • docs/design/session-control-and-live-events/reviews/decision-list-2026-09-03.md#L99-L111: close O1-O7 or record the settled option for each.
  • docs/design/session-control-and-live-events/README.md#L37-L37: keep the reading guide consistent with the authoritative question status.
  • docs/design/session-control-and-live-events/contracts/commands.md#L75-L76: replace the O7-dependent transition with the settled teardown behavior.
  • docs/design/session-control-and-live-events/requirements.md#L151-L152: align package status with the actual decision state.
  • docs/design/session-control-and-live-events/contracts/public-api.md#L85-L86: keep the not_running result consistent with the closed teardown decision.
📍 Affects 5 files
  • docs/design/session-control-and-live-events/reviews/decision-list-2026-09-03.md#L99-L111 (this comment)
  • docs/design/session-control-and-live-events/README.md#L37-L37
  • docs/design/session-control-and-live-events/contracts/commands.md#L75-L76
  • docs/design/session-control-and-live-events/requirements.md#L151-L152
  • docs/design/session-control-and-live-events/contracts/public-api.md#L85-L86

Comment on lines +107 to +108
| 3 | `AGENTA_SESSIONS_HISTORY_WRITES` | Flip off. Nullable fields remain and old record writes stay mounted. |
| 4 and 5 | `AGENTA_SESSIONS_SHARED_READER` | Flip off. Clients return to invoke or watch-and-refetch. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Make history rollback preserve sequence semantics.

Flag-off behavior keeps old record writes mounted, but the compatibility contract also requires every post-migration durable write to receive a sequence and disables paths that cannot allocate one. These rules permit incompatible outcomes. If rollback writes null-sequence rows, the snapshot/replay contract can leave new history outside ordered replay. Keep rollback writes sequence-aware, or define null-sequence handling and re-enable behavior explicitly.

Also applies to: 118-119

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 31c97950-3931-40d6-a4cd-5e4f81d4b639

📥 Commits

Reviewing files that changed from the base of the PR and between 42ed944 and ad680b7.

📒 Files selected for processing (2)
  • docs/design/session-control-and-live-events/contracts/events.md
  • docs/design/session-control-and-live-events/contracts/public-api.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment on lines +57 to +58
not wait for a contiguous sequence. After applying an event, they advance their reconnect cursor to
the greater of `sequence` and `watermark`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Use a delivery-safe reconnect cursor rule.

A client can receive sequence 10 with watermark 11, disconnect before sequence 11, and reconnect after 11. That skips event 11. Advance only to the largest delivered event sequence until ready confirms delivery through the watermark.

  • docs/design/session-control-and-live-events/contracts/events.md#L57-L58: change the durable-event cursor rule.
  • docs/design/session-control-and-live-events/contracts/public-api.md#L138-L139: apply the same rule to public client behavior.
📍 Affects 2 files
  • docs/design/session-control-and-live-events/contracts/events.md#L57-L58 (this comment)
  • docs/design/session-control-and-live-events/contracts/public-api.md#L138-L139

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 6da3bb43-e6a4-492e-a258-f0f3f97bb558

📥 Commits

Reviewing files that changed from the base of the PR and between ad680b7 and fc01a8f.

📒 Files selected for processing (1)
  • docs/design/session-control-and-live-events/status.md

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment on lines +104 to +105
- Increments 1 to 3 (pure fixes, the Stop package, the history producer) are on PRs #6496, #6503,
#6501, #6517, #6504, and #6518. A merged head of these lanes runs on an integration stack. The

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Complete the pull request role and base mapping.

Lines 104-105 reference #6517 and #6518. Lines 110-113 reference #6522, #6524, #6531, and #6530. The “Pull request roles and bases” table at Lines 88-100 has no rows for these pull requests. Add each purpose and base, or remove the references until they are recorded. Without this mapping, readers cannot verify the increment dependency order from this status document.

Also applies to: 110-113

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖 The AI agent says:

This design establishes durable session control, shared history, and the later Queue/Steer lifecycle.

Focused simplification review using the new simplify skill: one non-blocking suggestion below. This is a static design/code review, not a rerun of the live release gate or a replacement for existing correctness reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 5e891816-5d37-4974-a472-2b20cfd612a4

📥 Commits

Reviewing files that changed from the base of the PR and between fc01a8f and f653399.

📒 Files selected for processing (3)
  • docs/design/session-control-and-live-events/plan.md
  • docs/design/session-control-and-live-events/status.md
  • docs/design/session-control-and-live-events/work-packages/queue-steer.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/design/session-control-and-live-events/plan.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment on lines +57 to +58
Mahmoud settled all seven open choices on 2026-09-04. No open design questions remain.
The product owner settled the warm park duration and continuation message behavior on 2026-09-05.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep the decision status and date consistent.

Line 57 says that no design questions remain, but the PR objectives still list open decisions for sequence ownership, late-output handling, post-Stop liveness, retention limits, and final Queue, Steer, approval, and endpoint behavior. Line 58 also records a September 5, 2026 decision as settled, while the current date is September 4, 2026. Keep these decisions open until they are resolved, then record the actual settlement date. This prevents the status from being used as an implementation contract before the RFC is approved.

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

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant