[feat] Add sessions (mounts, transcripts, states, streams, interactions)#4916
Draft
junaway wants to merge 30 commits into
Draft
[feat] Add sessions (mounts, transcripts, states, streams, interactions)#4916junaway wants to merge 30 commits into
junaway wants to merge 30 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…, retention Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The durable table is one row per session ACP STREAM (session_streams, PK = stream_id), a control/ownership handle for the session's event stream. Transcripts are the stream's persisted contents (tracing DB); this row holds the live facts (attached, sandbox_live, last_seen_at, status). Runner-internal writes (heartbeat, detach) sit behind admin auth (request.state.admin) at /admin/sessions/streams; user-facing invoke/query/liveness stay on RUN_SESSIONS/VIEW_SESSIONS RBAC. Heartbeat has no acting user — the row is system-authored (lifecycle *_by_id NULL). replica_id is the runner/container id (which container owns the stream now) — ephemeral routing state kept only in the Redis owner-lock and the heartbeat input, never persisted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # api/entrypoints/routers.py
# Conflicts: # api/oss/src/core/sessions/dtos.py # api/oss/src/core/sessions/service.py
# Conflicts: # api/entrypoints/routers.py
Restructure the five session-related features into a consistent layout:
- core/sessions/{mounts,states,streams,transcripts,interactions}/
- dbs/postgres/sessions/{states,streams,transcripts,interactions}/
- apis/fastapi/sessions/ (one SessionsRouter composing all sub-domains)
- mounts stays a standalone top-level domain (core/mounts, dbs/postgres/mounts,
apis/fastapi/mounts); sessions/mounts is a thin core layer delegating to it,
with /sessions/mounts routes folded into the sessions router.
- EE transcripts retention moved under ee/.../sessions/transcripts/ to mirror OSS.
- Consistent filenames everywhere (dtos/types/interfaces/service, dao/dbes/dbas/mappings).
- No DB/table renames, no behavior change. 76/76 unit tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ssions/ Group transcripts/states(was sessions-persistence)/streams(was runner-scalability)/ interactions under docs/designs/sessions/ to mirror the code layout; mounts stays top-level. Add a sessions design index README. OpenAPI tags already deduped (one Sessions, one Mounts, one Interactions). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…interactions) Design-only: make streams' detached invoke real (the flag is currently inert), route triggers + interactions respond through it, and investigate/recommend whether the triggers + interactions workers can be retired (kept for now). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Transport = runner keeps session alive (PoC model), not backgrounding the blocking invoke. 'Started' signal = alive-lock-acquisition handshake, not a new event. Records the three verified runner-side gaps that land in THIS branch (real _start_run dispatch, runner owns/refreshes alive + heartbeats, producer-driven persistence). Workers: DELETE interactions, KEEP triggers (durable queue load-bearing + network-bound detach handshake off the API). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…icting specs.md) tasks.md said DELETE interactions worker; specs.md said KEEP both. Decision is KEEP both (detach is seconds-long + network-bound; stays off the API). Align tasks.md to specs.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stage 1 (API): POST /admin/sessions/transcripts/ingest endpoint (Redis stays behind the API); run_id/project_id threaded through the wire contract (Python wire.py + golden fixture); dispatch_fn seam on TriggersDispatcher + InteractionsWorker (kept, not deleted); triggers writes 'dispatched' delivery. Stage 2 (runner TS): alive-lock watchdog (heartbeat with run_id), producer-driven transcript persistence (POSTs to the ingest endpoint, retrying + coalescing), session-owned runs survive client disconnect; protocol.ts runId/projectId + wire contract fixture in sync. dispatch_fn is NOT yet injected — the detached workflow-service-hop path is the next slice (see specs: stream-through-the-hop early-return). Verified green: 107 Python + 334 TS unit tests, ruff + typecheck clean. Live round-trip validated post-merge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
invoke_workflow_detached reuses the same revision-derived {service_url}/invoke as
the batch path (shared _prepare_invoke prelude: project + sign_secret_token +
ensure_revision + service_url — so auth/ref-resolution can't drift), but consumes
via _stream_service_started: streams NDJSON, returns on the FIRST record (the
started/accepted handshake), closes the connection. The runner owns the run
(alive watchdog) + persists independently thereafter. No batch await, no
create_task shortcut, no direct-to-runner bypass.
dispatch_fn (_dispatch_detached_run) injected into BOTH TriggersDispatcher and
InteractionsWorker in the entrypoint. Interactions respond now routes through the
worker (off the API request thread), re-authorizing stored refs at fire time.
run_id/project_id ride request.meta for the workflow service to thread onto the
runner wire.
150 unit tests pass. Live first-frame timing + workflow-service meta-forwarding
validated post-merge on the stack.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rename the session domain to a consistent Session* family at the DTO/model level: SessionTranscript*, SessionInteraction*, SessionMount, SessionState, SessionStream. SessionMount subclasses Mount with a required session_id, and the session-mounts API models are defined from the DTO rather than subclassing the standalone mount models. Session-native storage is session-prefixed: the interactions DAO/DBE/table become SessionInteractionsDAO / SessionInteractionDBE / session_interactions (transcripts and mounts keep their shared tables). All session operation_ids are now verb-first (<verb>_<sub>), resolving the query_mounts collision with the standalone mounts router via query_session_mounts. The /sessions/mounts/query endpoint now requires session_id (422 otherwise), matching the session-scoped contract; the acceptance test is updated to supply it and to cover the missing-session_id rejection. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Regenerated Python (agenta_client) and TypeScript (agenta-api-client) clients to match the unified Session* schemas and verb-first session operation_ids. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.