Skip to content

[feat] Add sessions (mounts, transcripts, states, streams, interactions)#4916

Draft
junaway wants to merge 30 commits into
big-agentsfrom
feat/add-sessions
Draft

[feat] Add sessions (mounts, transcripts, states, streams, interactions)#4916
junaway wants to merge 30 commits into
big-agentsfrom
feat/add-sessions

Conversation

@junaway

@junaway junaway commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

jp-agenta and others added 15 commits June 28, 2026 17:39
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>
Copilot AI review requested due to automatic review settings June 28, 2026 18:24
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 28, 2026 11:20pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a43234a-975b-4e30-a133-817f1b4e6ef1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-sessions

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.

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

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

jp-agenta and others added 4 commits June 28, 2026 20:58
…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>
Copilot AI review requested due to automatic review settings June 28, 2026 20:25

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

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

Copilot AI review requested due to automatic review settings June 28, 2026 21:37

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

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

jp-agenta and others added 2 commits June 29, 2026 00:32
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>
Copilot AI review requested due to automatic review settings June 28, 2026 22:39

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

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

@junaway junaway marked this pull request as ready for review June 28, 2026 22:56
Copilot AI review requested due to automatic review settings June 28, 2026 22:56
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Backend feature labels Jun 28, 2026

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

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

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

Labels

Backend feature size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants