Skip to content

feat(agents): add pluggable session backends - #3570

Merged
daryllimyt merged 37 commits into
mainfrom
daryl/session-backend-interfaces
Sep 24, 2026
Merged

daryllimyt merged 37 commits into
mainfrom
daryl/session-backend-interfaces

Conversation

@daryllimyt

@daryllimyt daryllimyt commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

Allow trusted installed packages to provide agent backends through tracecat.agent_backends entry points. Tracecat retains authorization, configuration resolution, approval validation, session ownership, and chat rendering.

  • Store immutable backend_id and harness_type separately. The built-in backend remains oss, using claude_code; installed providers declare and validate their own harness identifiers. Discovery also verifies registered Temporal workflow and control-update definitions.
  • Gate backend selection and badges behind the agent-runtime engineering feature flag. Without an explicit override, chat creation uses the server default. Flagged chats wait for backend discovery; multiple-backend selection defers creation until the first message. Discovery errors offer retry and block new sessions. Removed backend selections fall back to the server default; unavailable selections submitted to session creation and rejected backend/harness changes submitted to session updates return HTTP 400.
  • Build workflow arguments from a data-only snapshot without a database handle or live ORM objects. Builders must avoid side effects; backend history/state writes belong in idempotent workflow activities after execution starts. Reserve ownership under a database lock, then commit immediately before the Temporal start RPC. Failed commit acknowledgements reconcile the matching reservation in a fresh database session. Uncertain dispatch preserves ownership and the reply stream; confirmed terminal workflows permit guarded reservation recovery. Running workflows, missing workflows, and failed lookups remain blocked.
  • Require fork preparation through the backend contract instead of capability flags. Fork hooks receive a flushed but uncommitted child session. Caller-owned workflow integration remains explicitly built-in-only because it constructs the built-in workflow directly.
  • Keep history readable for installed but disabled backends and use the existing is_readonly state for execution restrictions. Missing history backends raise an explicit read error instead of returning empty history. Session responses do not expose separate backend/history availability flags.

Migration

Adds agent_session.backend_id with the oss server default while preserving existing harness values. Downgrade refuses to discard routing identity while non-oss sessions exist.

Validation

  • Session update validation: all 58 router tests passed, including HTTP 400 for changes to either immutable routing field.

  • Temporal registry verification: all 136 backend unit tests passed, including malformed decorator metadata and valid custom update names.

  • Review-fix verification: 218 targeted Python unit tests, 30 real PostgreSQL transaction tests, and 16 chat-interface tests passed. Coverage includes stale selections, unavailable-backend HTTP responses, isolated argument snapshots, definitive RPC rejection and retry, lost commit acknowledgements, guarded ownership cleanup, terminal workflows, and cancellation. Temporal transport is mocked in the PostgreSQL tests; earlier session-read verification also passed 83 frontend tests.

  • Ruff, targeted Python type checks, frontend Biome/type checks, generated-client checks, and commit hooks passed.

  • Updated images have not been deployed. Live browser/provider E2E and the broader migration/workflow suites were not rerun for these review fixes.

LOC breakdown

Category + -
Logic 1386 430
Tests 2976 116
Infra/config 35 0
Generated 147 21

Summary by cubic

Lets trusted installed packages provide session execution backends through tracecat.agent_backends entry points, keeping shared authorization, config resolution, approvals, rendering, and history projection in Tracecat.

Behavior changes

  • Splits HarnessType into separate string backend_id and harness_type fields; oss/claude_code stay the defaults and are immutable after creation, and changes to either return HTTP 400.
  • Adds agent_session.backend_id with a server default of oss; the downgrade is refused while non-oss sessions exist, and API startup fails on invalid or duplicate installed backends or unverifiable Temporal workflow definitions.
  • Authenticated chat lists enabled backends and shows a selector only when more than one is available, gated behind a new agent-runtime feature flag; creation waits for backend discovery and blocks with retry on failure.
  • Omitted harnesses resolve to the selected backend's default, and registered harness identifiers are validated against each backend.
  • Removed selections fall back to the server default; unavailable selections submitted to session creation return HTTP 400.
  • Forks and call-backend control require backend-provided operations instead of capability flags, and the built-in session activity rejects a caller-supplied session from another backend or harness.
  • Dispatch commits the prepared turn only after Temporal has built its start request; uncertain outcomes and RPC-rejected starts release or preserve ownership and streams, and dispatch is shielded from caller cancellation.
  • Every session response derives read-only and availability state from the registry through a single shared view, including MCP tool reads.
  • Legacy approval views stay scoped to the built-in oss backend, and inbox lookups resolve backends through the registry.

Written for commit c1b56e2. Summary will update on new commits.

Review in cubic

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-23T20:56:31.791158Z c1b56e2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added agents Area: agent runtime, presets, chat, and the approvals inbox feat Type: new feature or capability (feat:) labels Sep 18, 2026
@zeropath-ai

zeropath-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to c1b56e2.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdd20bbb73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/components/chat/chat-interface.tsx Outdated
@daryllimyt
daryllimyt force-pushed the daryl/session-backend-interfaces branch from fdd20bb to df1f7c5 Compare September 18, 2026 17:15
@blacksmith-sh

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dfdbf0e23f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/session/router.py Outdated
Comment thread tracecat/agent/session/backends/registry.py Outdated
@daryllimyt
daryllimyt marked this pull request as ready for review September 22, 2026 18:35

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26470f973c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/backends/base.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 857d2df1f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/session/schemas.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf1c677cd6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/backends/registry.py
Comment thread frontend/src/hooks/use-chat.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f8442e565

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/backends/dispatch.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fff744b03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/session/router.py Outdated

@jordan-umusu jordan-umusu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, just a few thermos issues

Comment thread tracecat/agent/backends/base.py Outdated
Comment thread tracecat/agent/session/router.py Outdated
Comment thread tracecat/agent/backends/dispatch.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9296a800a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/components/chat/chat-interface.tsx
Comment thread tracecat/agent/backends/registry.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e362d07397

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/backends/base.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f52ad49382

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/backends/registry.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 125029ce9f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tracecat/agent/session/service.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1b56e2df3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/tracecat-ee/tracecat_ee/inbox/providers/agent_runs.py
@daryllimyt
daryllimyt merged commit 4821b7d into main Sep 24, 2026
25 of 27 checks passed
@daryllimyt
daryllimyt deleted the daryl/session-backend-interfaces branch September 24, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Area: agent runtime, presets, chat, and the approvals inbox feat Type: new feature or capability (feat:)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants