Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
a02db95
fix(frontend): union day-of-month and day-of-week in cron next-runs p…
ardaerzin Jun 22, 2026
a333657
feat(sessions): rebase session turns/streams backend onto v0.105.5
mmabrouk Jul 18, 2026
f147874
fix(sessions): model span_id as a 16-hex OTel id, not a UUID
mmabrouk Jul 18, 2026
fa96ba7
fix(sessions): compute turn_index per turn and 409 duplicate appends
mmabrouk Jul 19, 2026
f467b00
feat(sessions): rebase session turns/streams runner onto v0.105.5
mmabrouk Jul 18, 2026
e2e7a9b
test(sessions): pin the record-ingest span_id contract in the runner …
mmabrouk Jul 18, 2026
d9da538
fix(runner): make turn_index a per-conversation-turn counter
mmabrouk Jul 19, 2026
fab413d
feat(sessions): start-of-turn ledger rows with completion, and turn-i…
mmabrouk Jul 21, 2026
4c17153
docs(plan): multiple simultaneous approval requests in one turn
mmabrouk Jul 18, 2026
747024d
feat(runner): allow multiple simultaneous approval requests in one turn
mmabrouk Jul 18, 2026
4a9f917
feat(runner): record every parked gate and iterate the warm resume
mmabrouk Jul 18, 2026
d0f9a10
docs(plan): approvals incident fixes — root cause, Zed comparison, an…
mmabrouk Jul 19, 2026
d467e86
fix(runner): only real executor evidence settles a paused turn's tool…
mmabrouk Jul 19, 2026
0c56892
feat(sessions): scope record ids by execution and add turn_id to the …
mmabrouk Jul 21, 2026
454a3ae
feat(sessions): persist the answer half of every approval gate
mmabrouk Jul 19, 2026
3f04e3e
feat(runner): dispatch each approval independently and accept partial…
mmabrouk Jul 19, 2026
195c031
test(runner): replay the concurrent-approval incident end to end
mmabrouk Jul 19, 2026
5a8305e
fix(runner): close the adversarial-review findings on the approvals t…
mmabrouk Jul 19, 2026
e8b97ae
fix(runner): park immediately when Pi batching blocks an approved call
mmabrouk Jul 19, 2026
7ea9d6f
fix(web): dispatch re-parked approvals and reopen sentinel-sealed car…
mmabrouk Jul 19, 2026
427387b
docs(sessions): takeover architecture, reconciliation, and Arda handoff
mmabrouk Jul 21, 2026
102aa5d
docs(sessions): OpenCode comparison and steer-pattern pointer in the …
mmabrouk Jul 21, 2026
ca104f0
feat(runner): every approval gate leaves a durable interaction row
mmabrouk Jul 21, 2026
d5155fd
fix(runner): thread the resolved execution id into every request cons…
mmabrouk Jul 21, 2026
188025a
Merge pull request #5382 from Agenta-AI/plan/concurrent-approvals
mmabrouk Jul 21, 2026
a48fe0e
feat(ui): shared HeightCollapse + config-section animation primitives
ardaerzin Jul 17, 2026
343860d
feat(config): changed-path + focus primitives for config sections
ardaerzin Jul 17, 2026
b7dca93
feat(config): context-driven config sections — what-changed focus + i…
ardaerzin Jul 17, 2026
452ed30
feat(agent-chat): reduce approval friction — always-allow + batch res…
ardaerzin Jul 17, 2026
5856452
fix(ui): use size prop for TriggerDeliveriesDrawer width
ardaerzin Jul 17, 2026
eddc665
Merge pull request #5438 from Agenta-AI/fe-enhance/approval-ui-onstack
mmabrouk Jul 21, 2026
314a420
docs(sessions): rewrite the Arda handoff for the single-branch structure
mmabrouk Jul 21, 2026
35f7b28
feat(agent-chat): batch approvals — Deny all + context peek
ardaerzin Jul 22, 2026
a4c1df6
Merge release/v0.105.8 into feat/sessions-storage-rework
ardaerzin Jul 23, 2026
0f62780
fix(config): keep the version-history aside out of the inline what-ch…
ardaerzin Jul 23, 2026
7f3fa1c
fix(config): let the inline provider rail scroll instead of clipping
ardaerzin Jul 23, 2026
17dd3a1
fix(config): tighten the Connect-key section's top inset
ardaerzin Jul 23, 2026
d47941a
v0.106.0
ardaerzin Jul 23, 2026
d7e19ac
Merge branch 'release/v0.105.9' into feat/sessions-storage-rework
ardaerzin Jul 23, 2026
17366e1
Merge branch 'release/v0.106.0' into feat/sessions-storage-rework
ardaerzin Jul 23, 2026
733a7e6
feat(agent-chat): warm Stop — cooperatively cancel a turn instead of …
ardaerzin Jul 23, 2026
55809d3
feat(agent-chat): Steer — deny an approval with a redirect instruction
ardaerzin Jul 23, 2026
d0be7c8
feat(agent-chat): polish approval dock + gate steer behind a flag
ardaerzin Jul 24, 2026
d748049
fix(config): tighten the region header to first-row gap (pt-0)
ardaerzin Jul 24, 2026
fb36ef8
feat(agent-creation): add loading indicator and update button states …
ashrafchowdury Jul 24, 2026
df1530b
docs(agent-workflows): reject-siblings approval policy proposal (Deny…
ardaerzin Jul 24, 2026
3b2b70a
[chore] Zero out web tsc errors and fail builds on type regressions (…
ardaerzin Jul 24, 2026
baf49f1
fix(runner): keep a paused turn's persisted transcript hydration-clean
ardaerzin Jul 22, 2026
0518fea
fix(runner): render pause sentinels as nudges in the replayed transcript
ardaerzin Jul 22, 2026
3935f58
fix(agent-chat): don't let a behind server snapshot clobber a paused …
ardaerzin Jul 22, 2026
83df825
fix(agent-chat): fold a paused turn's resume into one message on cold…
ardaerzin Jul 24, 2026
f541c29
fix(api): revive soft-deleted session stream on resume
ardaerzin Jul 17, 2026
5944d0d
feat(web): server-backed session-list data layer
ardaerzin Jul 17, 2026
72bfea5
feat(api): include_ended on /sessions/query
ardaerzin Jul 18, 2026
1d2ee31
feat(web): reconcile server session list over the localStorage cache
ardaerzin Jul 18, 2026
c7f30d2
feat(web): sync session title to the durable header on rename
ardaerzin Jul 18, 2026
325b527
feat(web): propagate session delete to the server + show ended sessions
ardaerzin Jul 21, 2026
6535cda
feat(api): distinguish archive from kill with a dedicated archived_at
ardaerzin Jul 21, 2026
8a51833
feat(web): archive/unarchive sessions with a server-synced hidden state
ardaerzin Jul 21, 2026
eabcc0f
chore(web): regenerate Fern client for the sessions query flags
ardaerzin Jul 21, 2026
b6a1141
fix(api): clear archived_at when a turn starts on an archived session
ardaerzin Jul 21, 2026
c11b7e4
feat(api): index session_streams (project_id, archived_at)
ardaerzin Jul 21, 2026
7cfa283
Merge pull request #5475 from Agenta-AI/fix/add-loading-indicator-on-…
ashrafchowdury Jul 24, 2026
b709c9d
feat(web): auto-name a session from its first user message
ardaerzin Jul 24, 2026
afab2a4
fix(agent-chat): link a merged HITL turn to its resume trace + drop s…
ardaerzin Jul 24, 2026
af87b05
docs(sessions): design for last-message-only sends + server-side reco…
ardaerzin Jul 22, 2026
23ab026
feat(runner): flag-gated durable record persistence with drop tracking
ardaerzin Jul 22, 2026
2ad666a
feat(api): structure-preserving truncation for oversized record bodies
ardaerzin Jul 22, 2026
602838b
feat(runner): reconstruct ChatMessage history from the session record…
ardaerzin Jul 22, 2026
5a2f595
feat(runner): rebuild turn history from records when the client sends…
ardaerzin Jul 22, 2026
882eebc
feat(web): send only the trailing user message per agent turn when en…
ardaerzin Jul 22, 2026
3c78268
test(sessions): keep archive fakes type-faithful and docstrings accurate
ardaerzin Jul 24, 2026
068f296
fix(hosting): wire the session history flags into compose and the env…
mmabrouk Jul 24, 2026
f445673
style(agent-chat): format transcriptToMessages.test.ts with prettier
mmabrouk Jul 24, 2026
b652316
fix(runner): stop replaying the current prompt as a prior turn
mmabrouk Jul 24, 2026
66e70b6
fix(runner): keep the warm session when the client sends a minimal hi…
mmabrouk Jul 24, 2026
d4501e0
fix(api): order session records by producer time so turns stop interl…
mmabrouk Jul 24, 2026
5a00886
fix(api): attach SessionsConfig so smart truncation stops dropping re…
mmabrouk Jul 24, 2026
f621400
fix(runner): fail the turn instead of answering with a lost conversation
mmabrouk Jul 24, 2026
0fb7083
Merge pull request #4798 from Agenta-AI/fe-fix/trigger-schedule-cron-…
mmabrouk Jul 25, 2026
d818985
Merge branch 'release/v0.106.0' into feat/sessions-storage-rework
bekossy Jul 27, 2026
9c1bbe8
Merge branch 'feat/sessions-storage-rework' into fix/transcript-hygiene
bekossy Jul 27, 2026
6a6878d
Merge branch 'fix/transcript-hygiene' into feat/sessions-last-message…
bekossy Jul 27, 2026
6ba7b8e
Merge branch 'feat/sessions-last-message-only' into fix/sessions-flag…
bekossy Jul 27, 2026
8688ed4
style(agent-chat): fix prettier formatting in transcriptToMessages.te…
bekossy Jul 27, 2026
dd8e5bc
style(agent-chat): fix prettier formatting in transcriptToMessages.te…
bekossy Jul 27, 2026
e1b4825
Merge branch 'fix/transcript-hygiene' into feat/sessions-last-message…
bekossy Jul 27, 2026
7a63294
Merge branch 'feat/sessions-last-message-only' into fix/sessions-flag…
bekossy Jul 27, 2026
4bc2dec
fix(web): read sandbox_id from the turns ledger, fix SessionStream id…
bekossy Jul 27, 2026
f89df76
fix(web): read sandbox_id from the turns ledger, fix SessionStream id…
bekossy Jul 27, 2026
40c5c6c
Merge branch 'feat/sessions-storage-rework' into fix/transcript-hygiene
bekossy Jul 27, 2026
25f44ab
Merge branch 'fix/transcript-hygiene' into feat/sessions-last-message…
bekossy Jul 27, 2026
dcac0ad
Merge branch 'feat/sessions-last-message-only' into fix/sessions-flag…
bekossy Jul 27, 2026
eb64b42
Merge pull request #5488 from Agenta-AI/fix/sessions-flags-wiring
bekossy Jul 27, 2026
7ac6f22
Merge pull request #5486 from Agenta-AI/feat/sessions-last-message-only
bekossy Jul 27, 2026
f180f41
Merge pull request #5451 from Agenta-AI/fix/transcript-hygiene
bekossy Jul 27, 2026
d00aa3e
Merge branch 'feat/sessions-storage-rework' into fe-feat/approval-bat…
bekossy Jul 27, 2026
43f671b
Merge branch 'feat/sessions-storage-rework' into fix/sessions-no-dupl…
bekossy Jul 27, 2026
686612e
Merge branch 'fix/sessions-no-duplicate-prompt' into fix/sessions-kee…
bekossy Jul 27, 2026
a36a785
Merge pull request #5490 from Agenta-AI/fix/sessions-keep-warm-session
bekossy Jul 27, 2026
ef768f5
Merge pull request #5489 from Agenta-AI/fix/sessions-no-duplicate-prompt
bekossy Jul 27, 2026
df7aa96
Merge branch 'feat/sessions-storage-rework' into fe-feat/approval-bat…
bekossy Jul 27, 2026
f978cba
Merge branch 'feat/sessions-storage-rework' into fix/sessions-record-…
bekossy Jul 27, 2026
46fb50e
Merge branch 'feat/sessions-storage-rework' into fix/sessions-config-…
bekossy Jul 27, 2026
16260f8
Merge pull request #5491 from Agenta-AI/fix/sessions-config-attached
bekossy Jul 27, 2026
1155ebd
Merge pull request #5494 from Agenta-AI/fix/sessions-record-ordering
bekossy Jul 27, 2026
f567ce5
Merge branch 'feat/sessions-storage-rework' into fix/transcript-test-…
bekossy Jul 27, 2026
b18089a
Merge pull request #5495 from Agenta-AI/fix/transcript-test-formatting
bekossy Jul 27, 2026
d06a15d
Merge branch 'feat/sessions-storage-rework' into fix/sessions-fail-on…
bekossy Jul 27, 2026
390d85e
Merge branch 'feat/sessions-storage-rework' into feat/agent-cancel-steer
bekossy Jul 27, 2026
d94c056
Merge branch 'feat/sessions-storage-rework' into feat/sessions-contin…
bekossy Jul 27, 2026
80d71a1
Merge pull request #5479 from Agenta-AI/feat/sessions-continuity-fixes
bekossy Jul 28, 2026
f9b797f
Merge pull request #5477 from Agenta-AI/feat/agent-cancel-steer
bekossy Jul 28, 2026
db0a408
Merge remote-tracking branch 'origin/feat/sessions-storage-rework' in…
bekossy Jul 28, 2026
78b1184
Merge pull request #5470 from Agenta-AI/fe-feat/approval-batch-actions
bekossy Jul 28, 2026
3d79e4a
Merge branch 'feat/sessions-storage-rework' into fix/sessions-fail-on…
bekossy Jul 28, 2026
d08d7f5
Merge pull request #5493 from Agenta-AI/fix/sessions-fail-on-lost-rec…
bekossy Jul 28, 2026
0333e1e
Merge pull request #5436 from Agenta-AI/feat/sessions-storage-rework
bekossy Jul 28, 2026
0bc7c2f
Merge branch 'main' into release/v0.106.0
bekossy Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 27 additions & 12 deletions api/entrypoints/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@
from oss.src.core.ai_services.service import AIServicesService
from oss.src.apis.fastapi.ai_services.router import AIServicesRouter

from oss.src.dbs.postgres.sessions.states.dbes import SessionStateDBE # noqa: F401
from oss.src.dbs.postgres.sessions.states.dao import SessionStatesDAO
from oss.src.core.sessions.states.service import SessionStatesService

from oss.src.core.accounts.service import PlatformAdminAccountsService
from oss.src.apis.fastapi.accounts.router import PlatformAdminAccountsRouter
from oss.src.dbs.postgres.gateway.connections.dao import ConnectionsDAO
Expand Down Expand Up @@ -178,10 +174,15 @@
from oss.src.tasks.asyncio.sessions.orphan_sweep import orphan_sweep_loop
from oss.src.dbs.redis.shared.engine import get_lock_engine

from oss.src.dbs.postgres.sessions.turns.dbes import SessionTurnDBE # noqa: F401
from oss.src.dbs.postgres.sessions.turns.dao import SessionTurnsDAO
from oss.src.core.sessions.turns.service import SessionTurnsService

# Interactions
from oss.src.dbs.postgres.sessions.interactions.dbes import SessionInteractionDBE # noqa: F401
from oss.src.dbs.postgres.sessions.interactions.dao import SessionInteractionsDAO
from oss.src.core.sessions.interactions.service import SessionInteractionsService
from oss.src.core.sessions.service import SessionsService
from oss.src.tasks.asyncio.sessions.interactions_dispatcher import (
InteractionsDispatcher,
)
Expand Down Expand Up @@ -549,6 +550,7 @@ async def lifespan(*args, **kwargs):
evaluations_dao = EvaluationsDAO(engine=_transactions_engine)
folders_dao = FoldersDAO(engine=_transactions_engine)
session_streams_dao = SessionStreamsDAO(engine=_transactions_engine)
session_turns_dao = SessionTurnsDAO(engine=_transactions_engine)

connections_dao = ConnectionsDAO(engine=_transactions_engine)
mounts_dao = MountsDAO(engine=_transactions_engine)
Expand Down Expand Up @@ -616,6 +618,10 @@ async def lifespan(*args, **kwargs):
lock_engine=_lock_engine,
)

session_turns_service = SessionTurnsService(
turns_dao=session_turns_dao,
)

workflows_service = WorkflowsService(
workflows_dao=workflows_dao,
static_catalog=StaticWorkflowCatalog(),
Expand Down Expand Up @@ -1026,22 +1032,26 @@ async def _dispatch_detached_run(*, project_id, user_id, request) -> str:
ai_services_service=ai_services_service,
)

# SESSION STATES ---------------------------------------------------------------
# SESSIONS ---------------------------------------------------------------------
# Session header rename (name/description) lives on the streams router
# (PUT /sessions/streams/header) via streams_service.set_header.

session_states_dao = SessionStatesDAO(engine=_transactions_engine)

session_states_service = SessionStatesService(
session_states_dao=session_states_dao,
sessions_service = SessionsService(
streams_service=session_streams_service,
turns_service=session_turns_service,
interactions_service=interactions_service,
mounts_service=mounts_service,
)

sessions = SessionsRouter(
streams_service=session_streams_service,
states_service=session_states_service,
records_service=records_service,
interactions_service=interactions_service,
workflows_service=workflows_service,
session_mounts_service=session_mounts_service,
mounts_service=mounts_service,
turns_service=session_turns_service,
sessions_service=sessions_service,
respond_task=_interactions_worker.respond_interaction,
)

Expand Down Expand Up @@ -1479,15 +1489,20 @@ async def _dispatch_detached_run(*, project_id, user_id, request) -> str:
tags=["Sessions"],
)

app.include_router(
router=sessions.turns.router,
prefix="/sessions/turns",
tags=["Sessions"],
)

app.include_router(
router=platform_admin_accounts.router,
prefix="/admin",
tags=["Admin"],
)

app.include_router(
router=sessions.states.router,
prefix="/sessions",
router=sessions.root.router,
tags=["Sessions"],
)

Expand Down
1 change: 0 additions & 1 deletion api/oss/databases/postgres/migrations/core/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import oss.src.dbs.postgres.users.dbes # noqa: F401
import oss.src.dbs.postgres.workflows.dbes # noqa: F401
import oss.src.dbs.postgres.webhooks.dbes # noqa: F401
import oss.src.dbs.postgres.sessions.states.dbes # noqa: F401


# this is the Alembic Config object, which provides
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""add session_turns table

Revision ID: oss000000014
Revises: oss000000013
Create Date: 2026-07-17 00:00:00.000000

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

revision: str = "oss000000014"
down_revision: Union[str, None] = "oss000000013"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.create_table(
"session_turns",
sa.Column("id", sa.UUID(as_uuid=True), nullable=False),
sa.Column("project_id", sa.UUID(as_uuid=True), nullable=False),
sa.Column("session_id", sa.String(), nullable=False),
sa.Column("turn_id", sa.UUID(as_uuid=True), nullable=True),
sa.Column("stream_id", sa.UUID(as_uuid=True), nullable=False),
sa.Column("turn_index", sa.Integer(), nullable=False),
sa.Column("harness_kind", sa.String(), nullable=False),
sa.Column("agent_session_id", sa.String(), nullable=True),
sa.Column("sandbox_id", sa.String(), nullable=True),
sa.Column(
"references",
postgresql.JSONB(none_as_null=True),
nullable=True,
),
sa.Column("trace_id", sa.UUID(as_uuid=True), nullable=True),
# OTel span id: 64-bit / 16 hex chars, NOT a UUID (128-bit / 32 hex). Text, not UUID.
sa.Column("span_id", sa.String(), nullable=True),
sa.Column("start_time", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("end_time", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column(
"created_at",
sa.TIMESTAMP(timezone=True),
server_default=sa.func.current_timestamp(),
nullable=True,
),
sa.Column("updated_at", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("deleted_at", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("created_by_id", sa.UUID(as_uuid=True), nullable=True),
sa.Column("updated_by_id", sa.UUID(as_uuid=True), nullable=True),
sa.Column("deleted_by_id", sa.UUID(as_uuid=True), nullable=True),
sa.ForeignKeyConstraint(
["project_id"],
["projects.id"],
ondelete="CASCADE",
),
sa.ForeignKeyConstraint(
["project_id", "stream_id"],
["session_streams.project_id", "session_streams.id"],
ondelete="NO ACTION",
),
sa.PrimaryKeyConstraint("project_id", "id"),
)
op.create_index(
"ix_session_turns_project_id_session_id",
"session_turns",
["project_id", "session_id"],
)
op.create_index(
"ix_session_turns_project_id_session_id_turn_index",
"session_turns",
["project_id", "session_id", "turn_index"],
unique=True,
)
op.create_index(
"ix_session_turns_references",
"session_turns",
["references"],
postgresql_using="gin",
postgresql_ops={"references": "jsonb_path_ops"},
)


def downgrade() -> None:
op.drop_index(
"ix_session_turns_references",
table_name="session_turns",
)
op.drop_index(
"ix_session_turns_project_id_session_id_turn_index",
table_name="session_turns",
)
op.drop_index(
"ix_session_turns_project_id_session_id",
table_name="session_turns",
)
op.drop_table("session_turns")
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""add name/description header to session_streams

Revision ID: oss000000015
Revises: oss000000014
Create Date: 2026-07-17 00:00:00.000000

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

revision: str = "oss000000015"
down_revision: Union[str, None] = "oss000000014"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column(
"session_streams",
sa.Column("name", sa.String(), nullable=True),
)
op.add_column(
"session_streams",
sa.Column("description", sa.String(), nullable=True),
)


def downgrade() -> None:
op.drop_column("session_streams", "description")
op.drop_column("session_streams", "name")
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""add mounts agent_id column, index, and backfill

Mirrors session_id: a bare, nullable varchar populated only for agent mounts
(session mounts stay agent_id-null), with a partial index for querying "mounts
for agent X" the same way session_id already supports "mounts for session X".

Backfill: mounts are core DB, so a data migration is allowed here (unlike the
tracing DB). Agent-mount slugs are minted as
`__ag__agent__<canonical_artifact_id>__<name>` (`mint_agent_slug`,
`core/mounts/service.py`) — the artifact id is the raw canonical (lowercase)
UUID, not a hash, so it is deterministically recoverable straight out of the
slug. Session-mount slugs (`__ag__session__<uuid5(session_id)>__<name>`) hash
the session id, so no session_id backfill is possible or attempted here.

Revision ID: oss000000016
Revises: oss000000015
Create Date: 2026-07-17 00:00:00.000000

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

revision: str = "oss000000016"
down_revision: Union[str, None] = "oss000000015"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

_AGENT_SLUG_PREFIX = "__ag__agent__"


def upgrade() -> None:
op.add_column("mounts", sa.Column("agent_id", sa.String(), nullable=True))

op.create_index(
"ix_mounts_project_id_agent_id",
"mounts",
["project_id", "agent_id"],
unique=False,
postgresql_where=sa.text("agent_id IS NOT NULL"),
)

conn = op.get_bind()
conn.execute(
sa.text(
f"""
UPDATE mounts
SET agent_id = split_part(substr(slug, {len(_AGENT_SLUG_PREFIX) + 1}), '__', 1)
WHERE left(slug, {len(_AGENT_SLUG_PREFIX)}) = '{_AGENT_SLUG_PREFIX}'
"""
)
)


def downgrade() -> None:
op.drop_index("ix_mounts_project_id_agent_id", table_name="mounts")
op.drop_column("mounts", "agent_id")
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""drop session_states table

Superseded by the session_streams header (name/description) — the /sessions/states/
router now reads/writes the merged stream row via streams_service. The standalone
table, its DAO/service, and DBE are orphaned; drop the physical table.

Revision ID: oss000000017
Revises: oss000000016
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


revision: str = "oss000000017"
down_revision: Union[str, None] = "oss000000016"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.drop_table("session_states")


def downgrade() -> None:
op.create_table(
"session_states",
sa.Column("project_id", sa.UUID(), nullable=False),
sa.Column("id", sa.UUID(), nullable=False),
sa.Column("session_id", sa.String(), nullable=False),
sa.Column("sandbox_id", sa.String(), nullable=True),
sa.Column(
"data",
postgresql.JSON(astext_type=sa.Text()),
nullable=True,
),
sa.Column("flags", postgresql.JSONB(none_as_null=True), nullable=True),
sa.Column("tags", postgresql.JSONB(none_as_null=True), nullable=True),
sa.Column("meta", postgresql.JSON(none_as_null=True), nullable=True),
sa.Column(
"created_at",
sa.TIMESTAMP(timezone=True),
server_default=sa.text("CURRENT_TIMESTAMP"),
nullable=True,
),
sa.Column("updated_at", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("deleted_at", sa.TIMESTAMP(timezone=True), nullable=True),
sa.Column("created_by_id", sa.UUID(), nullable=True),
sa.Column("updated_by_id", sa.UUID(), nullable=True),
sa.Column("deleted_by_id", sa.UUID(), nullable=True),
sa.ForeignKeyConstraint(["project_id"], ["projects.id"], ondelete="CASCADE"),
sa.PrimaryKeyConstraint("project_id", "id"),
sa.UniqueConstraint(
"project_id",
"session_id",
name="uq_session_states_project_session_id",
),
)
Loading
Loading