Skip to content

Separate runtime providers from modes - #105

Open
moshloop wants to merge 19 commits into
mainfrom
runtime-provider-mode
Open

Separate runtime providers from modes#105
moshloop wants to merge 19 commits into
mainfrom
runtime-provider-mode

Conversation

@moshloop

@moshloop moshloop commented Sep 1, 2026

Copy link
Copy Markdown
Member

What

  • Split composite backend identifiers into explicit provider and execution mode across AI, API, CLI, chat, database, sessions, prompts, and the web workbench.
  • Normalize runtime resolution, validate authored modes, add session parent relationships, and improve JSONL/session handling.
  • Add rich markdown response rendering and prompt workbench editing, conflict, duplicate, delete, and repair flows.

Notes

  • Breaking changes replace backend with provider and mode; migrations are required for saved configurations and external tools.

Claude-Session-Id: 01a04225-f4a8-7490-b9e7-6db50c066bbb
…n to sessions

Split composite `backend` column that conflated provider, mode, and adapter ID into explicit columns. Add `parent_relation` to distinguish agent vs transcript parent relationships. Views expose new columns via aliasing for compatibility. Backfill handles divergent vocabularies from multiple sources idempotently. Add migration safety test for co-tenant enum preservation.
Migrate from backend-prefixed model names (claude-agent-opus) to explicit `mode:` field combined with normalized model names (claude-opus-5). Centralizes runtime resolution via ai.Resolve() to consider both model family and authored mode together.

Authored mode is now validated — cannot be silently dropped. Updates all test fixtures and adds contract validation that mode selection pins the runtime choice.
Rename Backend to Mode and introduce Provider field in the Runtime
abstraction, separating execution mode (API, CLI, Agent) from LLM
provider (Anthropic, OpenAI, etc.). GetBackend() method replaced with
GetRuntime() returning a Runtime struct.

BREAKING CHANGE: GetBackend() removed; Backend field replaced with Mode
and Provider fields in Model struct.
…irs resolved upfront

Split the ambiguous Backend enum—which meant adapter outbound, mode inbound—into Provider (family) and RuntimeMode (mechanism), resolved once at the boundary before any factory runs.

Key changes:
- Model.Backend deleted; Model now carries Provider + Mode fields set by Resolve
- All provider factories receive pre-resolved models; no re-normalization
- RuntimeOf(provider, mode) creates the pair; ProviderFor(name) derives only family
- GetBackend() → GetRuntime() throughout; update all adapter interfaces
- Wire format: `backend` key becomes `mode`; provider lives off-wire
- Sandbox: SandboxNone→SandboxOff, SandboxSRT→SandboxSRTInternal, introduce SandboxNative
- Remove composite mode tokens from claim table; mode comes from selector or default

Impact: Model captain records and model the CLI receives are now identical. Sandbox policy translates uniformly across all providers via api.TranslateClaudeSandbox and api.TranslateCodexSandbox.
…mposite adapters

Replace the flat Backend identifier ("claude-agent", "codex-cli") with an explicit (provider, mode) pair. Provider names the family (anthropic, openai, google, deepseek); mode names the mechanism (api, agent, cli, cmux).

Separate permission mode from sandbox isolation. Whether an agent asks before acting is now independent of what it can reach, fixing the confusing equivalence where `sandbox: off` forced `bypassPermissions`.

Sandbox refactoring: rename SandboxNone→Off, SandboxSRT→Native, SandboxContainer→Docker. SandboxRef.Backend becomes SandboxRef.Mode. Add provider-neutral NativeSandboxPolicy with per-provider translators.

Config changes: remove global ai.backend/model/reasoningEffort; move under ai.providers.<provider>. Add agent_resources.go to declare what each CLI sees, runtime_arguments.go to map native flags to Spec paths.

BREAKING CHANGE: Backend type removed; use Runtime{Provider, Mode}. Config format changed; old files rejected with migration guidance.
Replace the monolithic Backend enum with a two-axis Runtime system: Provider
(the model family: Anthropic, OpenAI, Google, DeepSeek) and Mode (the execution
mechanism: api, agent, cli, cmux). This decouples family selection from runtime
selection so each can be configured independently.

- ModelProvider replaces Backend as the family descriptor
- RuntimeMode replaces the mode suffix in backend names
- All adapter, model, and schema operations now take (Provider, Mode) instead of Backend
- Model definitions now carry Provider+Mode fields instead of Backend
- Runtime selection logic restructured to select along independent axes
- Updates signature of ResolveAPIKey, ListModels, RegistryModelDefs, and other
  model discovery functions to reflect the two-axis design
- Keeps all external APIs and behavior unchanged; internal refactoring only
BREAKING CHANGE: Wire format for runtime selection changes from {"backend":"adapter-name"} to {"mode":"api|agent|cli"}; provider is inferred from model name. Thread.Runtime type changes from *api.Model to *api.RuntimeIdentity.

The monolithic Backend enum conflated provider identity (Anthropic, OpenAI) with execution mode (API, Agent, CLI), making invalid runtime states constructible and confusing credentials (per-provider) with runtime choices (per-turn). This split separates concerns: Provider is a ModelProvider struct identifying API endpoints and agent binaries; Mode is the runtime mechanism chosen at execution time. Credentials belong to a provider; mode is a per-turn choice that does not affect authentication.

Thread locking now uses RuntimeIdentity (model/provider/mode) to avoid earlier bugs where hand-built identities omitted Mode, allowing clients to post a different runtime than the one they read. Also adds history recovery for incomplete terminal sessions, terminal execution atomicity, and improved HTTP error status codes for concurrency conflicts.
…te management

Refactor the prompt workbench into modular components and improve state management to support concurrent editing of multiple prompts:

- Extract `PromptDetailPane`, `PromptSidebar`, `PromptWorkbenchActions`, `PromptCatalogView`, `PromptDeleteDialog` into separate components for maintainability
- Move state management to per-prompt slots, enabling drafts to survive navigation between prompts
- Implement conflict detection via `baseVersion` on save
- Add duplicate and delete confirmation UX
- Support repair mode for prompts with parse errors
- Refetch permission catalog when runtime selection changes (keyed by resolved adapter)
- Show file destination preview before creating/saving a prompt
- Extract API utilities to `promptWorkbenchApi`, `promptDetailState`, `promptWriteDestination`, `promptAgentTools`
- Update documentation terminology: `backend` → `mode` (runtime mechanism: api/agent/cli/cmux)
…gent sessions

Replaces bufio.Scanner with a custom jsonl.Reader that has no hardcoded line
size limit, avoiding silent truncation of large JSONL entries (e.g., Codex
compaction records). Refactors Codex session building to properly handle
forked/subagent threads as separate sessions linked to their parent,
preventing duplicate turn records on (session_id, provider_turn_id). Clarifies
Provider, ModelMode, and ExecutionMode fields in the session model.
…d mode

Replace the composite Backend enum (e.g., BackendClaudeAgent, BackendCodexCLI) with independent Provider (*api.ModelProvider) and Mode (api.RuntimeMode) fields throughout the CLI. This allows independent reasoning about provider families and execution mechanisms, enabling clearer expression of which providers support which modes and stricter validation.

BREAKING CHANGE: Configuration field "backend" becomes "mode" and "provider"; JSON output changes from {"backend":"..."} to {"provider":"...","mode":"..."}. Migration required for saved configurations and external tools depending on the old contract.
The "backend" concept was overloaded: it named both the adapter identity (anthropic, openai) and the composite runtime mechanism (api, cli, agent, cmux). This conflation made it impossible to derive one axis from the other.

Split into two explicit concepts:
- **provider**: the LLM family (derived from model name or explicitly chosen)
- **mode**: the execution mechanism (api|cli|agent|cmux), explicit from model prefix or CLI flag

Updates database schema via migrations 79–80, which recover both axes from composite values recorded in metadata and transcripts. Adds session hierarchy tracking (agent vs transcript children) to exclude provider mirrors from thread views. Improves prompt run error reporting and conflict detection.

All APIs, CLI flags, and test fixtures updated. Backward compatibility for task.json payloads validated at runtime. Sandbox kind names aligned with actual behavior (docker, off, native, srt).
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 445 files, which is 345 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: eb6206c6-1da0-461e-a73a-c3d10b5833cc

📥 Commits

Reviewing files that changed from the base of the PR and between 42f1026 and 4fc4369.

⛔ Files ignored due to path filters (3)
  • go.sum is excluded by !**/*.sum
  • pkg/cli/webapp/dist/.gitkeep is excluded by !**/dist/**
  • pkg/cli/webapp/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (445)
  • .gitignore
  • cmd/captain/main.go
  • docs/src/components/PromptApiShapes.tsx
  • docs/src/components/RuntimeSpecDemo.tsx
  • docs/src/pages/prompts/format.mdx
  • docs/src/pages/prompts/runtime.mdx
  • docs/src/pages/prompts/sources-api.mdx
  • docs/src/pages/todos/execution.mdx
  • docs/src/pages/todos/index.mdx
  • go.mod
  • migrations/10_sessions.pg.hcl
  • migrations/20_prompt_runs_and_plans.pg.hcl
  • migrations/30_execution.pg.hcl
  • migrations/32_execution_approvals.pg.hcl
  • migrations/60_view_session_overview.sql
  • migrations/61_view_session_transcript.sql
  • migrations/62_view_session_turns.sql
  • migrations/63_view_session_agents.sql
  • migrations/67_view_session_costs.sql
  • migrations/approval_identity_upgrade_integration_test.go
  • migrations/enum_upgrade_integration_test.go
  • migrations/index_pruning_integration_test.go
  • pkg/ai/adapter_models.go
  • pkg/ai/adapters.go
  • pkg/ai/adapters_cache_test.go
  • pkg/ai/adapters_test.go
  • pkg/ai/agent.go
  • pkg/ai/agent/commit/notice_test.go
  • pkg/ai/agent/runner_test.go
  • pkg/ai/agent/runner_timeout_test.go
  • pkg/ai/agent/verify/prompt_hooks_test.go
  • pkg/ai/agent_close_ginkgo_test.go
  • pkg/ai/agent_test.go
  • pkg/ai/attachment_capabilities.go
  • pkg/ai/attachment_capabilities_ginkgo_test.go
  • pkg/ai/availability.go
  • pkg/ai/availability_test.go
  • pkg/ai/catalog.go
  • pkg/ai/catalog_disabled_ginkgo_test.go
  • pkg/ai/catalog_info.go
  • pkg/ai/catalog_info_test.go
  • pkg/ai/catalog_resolve.go
  • pkg/ai/catalog_resolve_test.go
  • pkg/ai/catalog_test.go
  • pkg/ai/client.go
  • pkg/ai/fallback.go
  • pkg/ai/fallback_test.go
  • pkg/ai/generation_config.go
  • pkg/ai/generation_config_test.go
  • pkg/ai/history/codex_parser.go
  • pkg/ai/history/codex_types.go
  • pkg/ai/history/parser.go
  • pkg/ai/internal/gen-model-registry/main.go
  • pkg/ai/live_catalog.go
  • pkg/ai/live_catalog_test.go
  • pkg/ai/log_identity.go
  • pkg/ai/loop.go
  • pkg/ai/loop_test.go
  • pkg/ai/middleware/caching.go
  • pkg/ai/middleware/logging.go
  • pkg/ai/middleware/logging_test.go
  • pkg/ai/middleware/retry.go
  • pkg/ai/middleware/schema_repair.go
  • pkg/ai/middleware/validation.go
  • pkg/ai/middleware/validation_test.go
  • pkg/ai/model_effort.go
  • pkg/ai/model_effort_ginkgo_test.go
  • pkg/ai/model_effort_test.go
  • pkg/ai/model_error.go
  • pkg/ai/model_error_test.go
  • pkg/ai/model_lists.go
  • pkg/ai/model_parse_conformance_test.go
  • pkg/ai/model_registry.go
  • pkg/ai/model_registry_test.go
  • pkg/ai/models_codex.go
  • pkg/ai/models_remote.go
  • pkg/ai/models_remote_test.go
  • pkg/ai/price_usage_ginkgo_test.go
  • pkg/ai/pricing_coverage_test.go
  • pkg/ai/prompt/document_test.go
  • pkg/ai/prompt/prompt.go
  • pkg/ai/prompt/prompt_test.go
  • pkg/ai/prompt/testdata/fixtures/anthropic-claude-opus.prompt
  • pkg/ai/prompt/testdata/fixtures/anthropic-claude-sonnet.prompt
  • pkg/ai/prompt/testdata/fixtures/claude-agent-opus.prompt
  • pkg/ai/prompt/testdata/fixtures/claude-agent-sonnet.prompt
  • pkg/ai/prompt/testdata/fixtures/claude-cli-opus.prompt
  • pkg/ai/prompt/testdata/fixtures/claude-cli-sonnet.prompt
  • pkg/ai/prompt/testdata/fixtures/claude-cmux-opus.prompt
  • pkg/ai/prompt/testdata/fixtures/claude-cmux-sonnet.prompt
  • pkg/ai/prompt/testdata/fixtures/codex-agent.prompt
  • pkg/ai/prompt/testdata/fixtures/codex-cli.prompt
  • pkg/ai/prompt/testdata/fixtures/codex-cmux.prompt
  • pkg/ai/prompt/testdata/fixtures/deepseek.prompt
  • pkg/ai/prompt/testdata/fixtures/gemini-api.prompt
  • pkg/ai/prompt/testdata/fixtures/gemini-cli.prompt
  • pkg/ai/prompt/testdata/fixtures/openai-gpt.prompt
  • pkg/ai/prompt/testdata/options.prompt
  • pkg/ai/provider.go
  • pkg/ai/provider/caller_tools_ginkgo_test.go
  • pkg/ai/provider/claude_cli.go
  • pkg/ai/provider/claude_cli_test.go
  • pkg/ai/provider/claudeagent/agent.ts
  • pkg/ai/provider/claudeagent/bridge_params.go
  • pkg/ai/provider/claudeagent/caller_tools_ginkgo_test.go
  • pkg/ai/provider/claudeagent/mapping_test.go
  • pkg/ai/provider/claudeagent/permission_capabilities_test.go
  • pkg/ai/provider/claudeagent/permissions_test.go
  • pkg/ai/provider/claudeagent/provider.go
  • pkg/ai/provider/claudeagent/provider_test.go
  • pkg/ai/provider/claudeagent/runner.go
  • pkg/ai/provider/claudeagent/turn.go
  • pkg/ai/provider/cli.go
  • pkg/ai/provider/cli_test.go
  • pkg/ai/provider/cmux/executor.go
  • pkg/ai/provider/cmux/executor_test.go
  • pkg/ai/provider/cmux/permission_capabilities_test.go
  • pkg/ai/provider/cmux/provider.go
  • pkg/ai/provider/cmux/provider_test.go
  • pkg/ai/provider/coalesce.go
  • pkg/ai/provider/codex_appserver.go
  • pkg/ai/provider/codex_appserver_approval.go
  • pkg/ai/provider/codex_appserver_params_test.go
  • pkg/ai/provider/codex_appserver_protocol.go
  • pkg/ai/provider/codex_appserver_test.go
  • pkg/ai/provider/codex_cli.go
  • pkg/ai/provider/codex_cli_test.go
  • pkg/ai/provider/gemini_cli.go
  • pkg/ai/provider/gemini_cli_test.go
  • pkg/ai/provider/genkit/gemini_transport_ginkgo_test.go
  • pkg/ai/provider/genkit/genkit.go
  • pkg/ai/provider/genkit/genkit_test.go
  • pkg/ai/provider/genkit/instance.go
  • pkg/ai/provider/genkit/instance_test.go
  • pkg/ai/provider/genkit/mapping.go
  • pkg/ai/provider/genkit/options.go
  • pkg/ai/provider/genkit/tool_approval_ginkgo_test.go
  • pkg/ai/provider/genkit/tool_lifecycle_ginkgo_test.go
  • pkg/ai/provider/genkit/tools.go
  • pkg/ai/provider/init.go
  • pkg/ai/provider/monitor_hooks.go
  • pkg/ai/provider/openai/input.go
  • pkg/ai/provider/openai/observation_test.go
  • pkg/ai/provider/openai/provider.go
  • pkg/ai/provider/permission_capabilities_test.go
  • pkg/ai/provider/sandbox_seam_test.go
  • pkg/ai/provider_test.go
  • pkg/ai/runtime_probe.go
  • pkg/ai/runtime_selection_ginkgo_test.go
  • pkg/ai/runtime_selector.go
  • pkg/ai/runtime_selector_test.go
  • pkg/ai/schema.go
  • pkg/ai/schema_claude_cli_ginkgo_test.go
  • pkg/ai/schema_test.go
  • pkg/ai/tools/strategies_ginkgo_test.go
  • pkg/ai/tools/tools.go
  • pkg/aichat/aimock_lifecycle_integration_test.go
  • pkg/aichat/approval_execution.go
  • pkg/aichat/approval_http.go
  • pkg/aichat/database_threads.go
  • pkg/aichat/database_threads_integration_test.go
  • pkg/aichat/execution.go
  • pkg/aichat/execution_authority_ginkgo_test.go
  • pkg/aichat/execution_database.go
  • pkg/aichat/execution_database_authority.go
  • pkg/aichat/execution_database_integration_test.go
  • pkg/aichat/messages.go
  • pkg/aichat/messages_ginkgo_test.go
  • pkg/aichat/messages_model_ginkgo_test.go
  • pkg/aichat/persistence.go
  • pkg/aichat/provider_config.go
  • pkg/aichat/resolver.go
  • pkg/aichat/runtime_profile_ginkgo_test.go
  • pkg/aichat/service.go
  • pkg/aichat/service_ginkgo_test.go
  • pkg/aichat/session_title_ginkgo_test.go
  • pkg/aichat/sse.go
  • pkg/aichat/thread_identity_ginkgo_test.go
  • pkg/aichat/threads.go
  • pkg/aichat/threads_http.go
  • pkg/aichat/wire_ginkgo_test.go
  • pkg/aiflags/defaults.go
  • pkg/aiflags/flags.go
  • pkg/aimock/e2e_claude_agent_test.go
  • pkg/aimock/e2e_codex_cli_test.go
  • pkg/aimock/e2e_surfaces_test.go
  • pkg/aimock/genkit_test.go
  • pkg/aimock/wire_scenarios_test.go
  • pkg/api/aliases.go
  • pkg/api/budget.go
  • pkg/api/cli_options.go
  • pkg/api/cli_options_test.go
  • pkg/api/cost.go
  • pkg/api/is_empty_test.go
  • pkg/api/message_ginkgo_test.go
  • pkg/api/permission_capabilities.go
  • pkg/api/permission_capabilities_ginkgo_test.go
  • pkg/api/permissions.go
  • pkg/api/permissions_schema.go
  • pkg/api/pretty.go
  • pkg/api/pretty_test.go
  • pkg/api/prompt.go
  • pkg/api/registry/backend.go
  • pkg/api/registry/backend_test.go
  • pkg/api/registry/cost.go
  • pkg/api/registry/disabled.go
  • pkg/api/registry/disabled_ginkgo_test.go
  • pkg/api/registry/effort_disabled_ginkgo_test.go
  • pkg/api/registry/effort_support.go
  • pkg/api/registry/identity.go
  • pkg/api/registry/mode.go
  • pkg/api/registry/model.go
  • pkg/api/registry/model_compact.go
  • pkg/api/registry/model_compact_test.go
  • pkg/api/registry/model_disabled_ginkgo_test.go
  • pkg/api/registry/models.json
  • pkg/api/registry/parse.go
  • pkg/api/registry/provider.go
  • pkg/api/registry/providers.go
  • pkg/api/registry/sandbox.go
  • pkg/api/registry/sandboxes.go
  • pkg/api/registry/supported_models.go
  • pkg/api/runtime_catalog.go
  • pkg/api/runtime_catalog_ginkgo_test.go
  • pkg/api/runtime_config.go
  • pkg/api/runtime_event.go
  • pkg/api/runtime_observation.go
  • pkg/api/runtime_observation_test.go
  • pkg/api/runtime_provider.go
  • pkg/api/runtime_provider_ginkgo_test.go
  • pkg/api/runtime_registry.go
  • pkg/api/sandbox.go
  • pkg/api/sandbox_ginkgo_test.go
  • pkg/api/sandbox_ref.go
  • pkg/api/sandbox_ref_ginkgo_test.go
  • pkg/api/sandbox_registry.go
  • pkg/api/spec_layers.go
  • pkg/api/spec_merge.go
  • pkg/api/spec_merge_differential_test.go
  • pkg/api/spec_test.go
  • pkg/api/tool_approval_ginkgo_test.go
  • pkg/api/tool_policy_support_test.go
  • pkg/api/tool_preferences_ginkgo_test.go
  • pkg/api/toolcatalog.go
  • pkg/api/toolpolicy_ginkgo_test.go
  • pkg/captainconfig/config.go
  • pkg/captainconfig/config_test.go
  • pkg/captainconfig/sandbox_test.go
  • pkg/claude/reader.go
  • pkg/cli/ai.go
  • pkg/cli/ai_agent.go
  • pkg/cli/ai_catalog.go
  • pkg/cli/ai_catalog_test.go
  • pkg/cli/ai_filters.go
  • pkg/cli/ai_filters_test.go
  • pkg/cli/ai_models.go
  • pkg/cli/ai_models_ginkgo_test.go
  • pkg/cli/ai_models_test.go
  • pkg/cli/ai_prompt_file.go
  • pkg/cli/ai_prompt_file_test.go
  • pkg/cli/ai_sandbox.go
  • pkg/cli/ai_sandbox_remote.go
  • pkg/cli/ai_sandbox_remote_test.go
  • pkg/cli/ai_sandbox_test.go
  • pkg/cli/ai_test.go
  • pkg/cli/attachments_ginkgo_test.go
  • pkg/cli/configure.go
  • pkg/cli/configure_provider.go
  • pkg/cli/configure_test.go
  • pkg/cli/gitagent_agent_api_ginkgo_test.go
  • pkg/cli/gitagent_runtask.go
  • pkg/cli/gitagent_runtask_test.go
  • pkg/cli/gitagent_serve_https.go
  • pkg/cli/history_cost_test.go
  • pkg/cli/main_test.go
  • pkg/cli/model_selection_ginkgo_test.go
  • pkg/cli/permission_catalog.go
  • pkg/cli/permission_catalog_test.go
  • pkg/cli/permissions_matrix.go
  • pkg/cli/permissions_matrix_test.go
  • pkg/cli/prompt_batch_run.go
  • pkg/cli/prompt_batch_session.go
  • pkg/cli/prompt_batch_session_ginkgo_test.go
  • pkg/cli/prompt_chat.go
  • pkg/cli/prompt_chat_ginkgo_test.go
  • pkg/cli/prompt_chat_http.go
  • pkg/cli/prompt_chat_types.go
  • pkg/cli/prompt_entity.go
  • pkg/cli/prompt_entity_test.go
  • pkg/cli/prompt_help_content.go
  • pkg/cli/prompt_observe.go
  • pkg/cli/prompt_observe_capture.go
  • pkg/cli/prompt_observe_test.go
  • pkg/cli/prompt_records.go
  • pkg/cli/prompt_render.go
  • pkg/cli/prompt_render_test.go
  • pkg/cli/prompt_run.go
  • pkg/cli/prompt_run_failure_ginkgo_test.go
  • pkg/cli/prompt_run_history.go
  • pkg/cli/prompt_run_live.go
  • pkg/cli/prompt_run_persist.go
  • pkg/cli/prompt_run_persist_test.go
  • pkg/cli/prompt_run_pretty_ginkgo_test.go
  • pkg/cli/prompt_run_result.go
  • pkg/cli/prompt_run_stream.go
  • pkg/cli/prompt_run_test.go
  • pkg/cli/prompt_run_workflow_test.go
  • pkg/cli/prompt_runtimes_ginkgo_test.go
  • pkg/cli/prompt_schema.go
  • pkg/cli/prompt_schema_build.go
  • pkg/cli/prompt_schema_http.go
  • pkg/cli/prompt_schema_http_test.go
  • pkg/cli/prompt_schema_sandboxes.go
  • pkg/cli/prompt_schema_sandboxes_test.go
  • pkg/cli/prompt_schema_test.go
  • pkg/cli/prompt_source.go
  • pkg/cli/prompt_source_test.go
  • pkg/cli/prompt_sources.go
  • pkg/cli/prompt_spec.go
  • pkg/cli/provider_defaults.go
  • pkg/cli/provider_defaults_test.go
  • pkg/cli/serve.go
  • pkg/cli/serve_chat.go
  • pkg/cli/serve_disabled.go
  • pkg/cli/serve_disabled_test.go
  • pkg/cli/serve_openapi.go
  • pkg/cli/serve_provider_defaults.go
  • pkg/cli/serve_provider_defaults_test.go
  • pkg/cli/serve_provider_tokens.go
  • pkg/cli/serve_provider_tokens_test.go
  • pkg/cli/serve_sandbox_test.go
  • pkg/cli/session_get.go
  • pkg/cli/session_get_multi_test.go
  • pkg/cli/session_live_render.go
  • pkg/cli/session_live_render_test.go
  • pkg/cli/session_record_db.go
  • pkg/cli/sessions.go
  • pkg/cli/webapp/src/PromptWorkbench.tsx
  • pkg/cli/webapp/src/PromptWriteModal.test.tsx
  • pkg/cli/webapp/src/PromptWriteModal.tsx
  • pkg/cli/webapp/src/promptData.ts
  • pkg/cli/webapp/src/promptWorkbenchHelpers.ts
  • pkg/cli/whoami.go
  • pkg/cli/whoami_ginkgo_test.go
  • pkg/cli/whoami_render.go
  • pkg/cli/whoami_test.go
  • pkg/database/caller_tool_legacy_policy_test.go
  • pkg/database/caller_tool_store.go
  • pkg/database/caller_tool_store_integration_test.go
  • pkg/database/model_usage.go
  • pkg/database/prompt_run_operations.go
  • pkg/database/prompt_run_overview.go
  • pkg/database/prompt_run_overview_test.go
  • pkg/database/prompt_run_store_integration_test.go
  • pkg/database/schema_scoped_integration_test.go
  • pkg/database/session_chat_store.go
  • pkg/database/session_hierarchy.go
  • pkg/database/session_hierarchy_ginkgo_test.go
  • pkg/database/session_ingest_store.go
  • pkg/database/session_ingest_store_integration_test.go
  • pkg/database/session_list_store.go
  • pkg/database/session_list_store_ginkgo_test.go
  • pkg/database/session_message_ingest.go
  • pkg/database/session_metadata_store_integration_test.go
  • pkg/database/session_overview_ginkgo_test.go
  • pkg/database/session_prompt_store.go
  • pkg/database/session_read_store.go
  • pkg/database/session_thread_store.go
  • pkg/database/session_thread_store_ginkgo_test.go
  • pkg/database/store_integration_test.go
  • pkg/gitagent/dispatch.go
  • pkg/gitagent/hookmain.go
  • pkg/gitagent/hookset_ginkgo_test.go
  • pkg/gitagent/workspace_test.go
  • pkg/monitor/ingest.go
  • pkg/sandbox/adapter/container.go
  • pkg/sandbox/adapter/container_test.go
  • pkg/sandbox/adapter/gitagent.go
  • pkg/sandbox/adapter/none.go
  • pkg/sandbox/adapter/none_test.go
  • pkg/sandbox/adapter/srt.go
  • pkg/sandbox/adapter/srt_test.go
  • pkg/session/build_codex.go
  • pkg/session/project.go
  • pkg/session/session.go
  • migrations/78_session_parent_relation.sql
  • migrations/79_runtime_provider_mode.sql
  • migrations/80_runtime_metadata_mode.sql
  • pkg/ai/history/codex_fork_ginkgo_test.go
  • pkg/ai/provider/sandbox_translation.go
  • pkg/ai/provider/sandbox_translation_ginkgo_test.go
  • pkg/aichat/database_thread_recovery.go
  • pkg/aichat/database_thread_recovery_integration_test.go
  • pkg/aichat/execution_database_terminal.go
  • pkg/aichat/execution_terminal_integration_test.go
  • pkg/aichat/runtime_profiles_http.go
  • pkg/aichat/runtime_profiles_http_ginkgo_test.go
  • pkg/aichat/testdata/recovery-claude.jsonl
  • pkg/aichat/tools_http.go
  • pkg/aichat/tools_http_ginkgo_test.go
  • pkg/aichat/with_caps_ginkgo_test.go
  • pkg/api/agent_resources.go
  • pkg/api/registry/doc.go
  • pkg/api/registry/runtime.go
  • pkg/api/registry/runtime_mode_ginkgo_test.go
  • pkg/api/registry/runtime_test.go
  • pkg/api/runtime_arguments.go
  • pkg/api/runtime_arguments_ginkgo_test.go
  • pkg/api/runtime_field_presentation.go
  • pkg/api/runtime_profiles.go
  • pkg/api/runtime_profiles_ginkgo_test.go
  • pkg/api/runtime_sandbox_schema.go
  • pkg/api/sandbox_capabilities.go
  • pkg/api/sandbox_claude.go
  • pkg/api/sandbox_codex.go
  • pkg/api/sandbox_policy.go
  • pkg/api/sandbox_unified_ginkgo_test.go
  • pkg/captainconfig/removed.go
  • pkg/cli/prompt_entity_write_ginkgo_test.go
  • pkg/cli/prompt_write.go
  • pkg/cli/webapp/embed.go
  • pkg/cli/webapp/src/PromptCatalogView.tsx
  • pkg/cli/webapp/src/PromptDeleteDialog.tsx
  • pkg/cli/webapp/src/PromptDetailPane.tsx
  • pkg/cli/webapp/src/PromptSidebar.tsx
  • pkg/cli/webapp/src/PromptWorkbenchActions.tsx
  • pkg/cli/webapp/src/promptAgentTools.ts
  • pkg/cli/webapp/src/promptCatalogEntries.test.ts
  • pkg/cli/webapp/src/promptCatalogEntries.ts
  • pkg/cli/webapp/src/promptDetailState.test.ts
  • pkg/cli/webapp/src/promptDetailState.ts
  • pkg/cli/webapp/src/promptWorkbenchApi.test.ts
  • pkg/cli/webapp/src/promptWorkbenchApi.ts
  • pkg/cli/webapp/src/promptWriteDestination.test.ts
  • pkg/cli/webapp/src/promptWriteDestination.ts
  • pkg/cli/with_caps_ginkgo_test.go
  • pkg/database/model_usage_integration_test.go
  • pkg/database/runtime_vocabulary_migration_integration_test.go
  • pkg/database/session_chat_completion.go
  • pkg/database/session_transcript_source.go
  • pkg/jsonl/lines.go
  • pkg/jsonl/lines_ginkgo_test.go
  • pkg/monitor/codex_fork_integration_test.go
  • pkg/session/build_codex_fork_ginkgo_test.go
  • pkg/session/project_ginkgo_test.go

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


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.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Gavel summary

Source Pass Fail Skip Duration

Totals: 0 passed · 0 failed · 0 skipped · -

View full results

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Gavel summary

Source Pass Fail Skip Duration
(unknown) 0 3 0 -
./pkg/cli 0 1 0 -
./pkg/database 0 1 0 -
./pkg/gitagent 0 1 0 -
api 252 1 0 123ms
github.com/flanksource/captain/pkg/ai/provider 173 4 1 -
github.com/flanksource/captain/pkg/cli 303 1 0 20.6s
agentcreds 11 0 0 663.891µs
ai 87 0 0 91ms
aichat 144 0 2 40.9s
anthropicmock 1 0 0 1ms
attachments 5 0 0 16ms
bash 4 0 0 184.248µs
callertools 10 0 0 88ms
captain 17 0 0 37.3s
claude 22 0 0 15ms
claudeagent 13 0 0 325ms
cmux 4 0 0 178.448µs
collections 12 0 0 372.844µs
credentials 5 0 0 21ms
credsync 11 0 0 393ms
deploy 110 0 0 146ms
genkit 25 0 0 80ms
github.com/flanksource/captain/migrations 11 0 0 3.9s
github.com/flanksource/captain/pkg/ai 245 0 0 870ms
github.com/flanksource/captain/pkg/ai/agent 26 0 0 450ms
github.com/flanksource/captain/pkg/ai/agent/commit 56 0 0 4.5s
github.com/flanksource/captain/pkg/ai/agent/setup 16 0 0 100ms
github.com/flanksource/captain/pkg/ai/agent/verify 21 0 0 390ms
github.com/flanksource/captain/pkg/ai/agent/worktree 6 0 0 -
github.com/flanksource/captain/pkg/ai/assistanttags 15 0 0 -
github.com/flanksource/captain/pkg/ai/fixture 43 0 0 140ms
github.com/flanksource/captain/pkg/ai/fixture/kubeproxy 2 0 0 70ms
github.com/flanksource/captain/pkg/ai/fixture/mcpproxy 6 0 0 -
github.com/flanksource/captain/pkg/ai/history 54 0 0 -
github.com/flanksource/captain/pkg/ai/internal/gen-model-registry 12 0 0 -
github.com/flanksource/captain/pkg/ai/middleware 25 0 0 -
github.com/flanksource/captain/pkg/ai/observation 2 0 0 -
github.com/flanksource/captain/pkg/ai/pricing 9 0 0 10ms
github.com/flanksource/captain/pkg/ai/prompt 21 0 0 20ms
github.com/flanksource/captain/pkg/ai/provider/claudeagent 54 0 0 1.3s
github.com/flanksource/captain/pkg/ai/provider/cmux 128 0 0 860ms
github.com/flanksource/captain/pkg/ai/provider/genkit 39 0 0 -
github.com/flanksource/captain/pkg/ai/provider/jsonrpc 6 0 0 50ms
github.com/flanksource/captain/pkg/ai/provider/openai 8 0 0 10ms
github.com/flanksource/captain/pkg/aichat 9 0 0 100ms
github.com/flanksource/captain/pkg/aimock 50 0 7 200ms
github.com/flanksource/captain/pkg/aimock/anthropicmock 14 0 0 10ms
github.com/flanksource/captain/pkg/aimock/openaimock 18 0 0 50ms
github.com/flanksource/captain/pkg/api 138 0 0 340ms
github.com/flanksource/captain/pkg/api/registry 127 0 0 10ms
github.com/flanksource/captain/pkg/bash 348 0 0 10ms
github.com/flanksource/captain/pkg/captainconfig 27 0 0 -
github.com/flanksource/captain/pkg/captaintoken 23 0 0 1.3s
github.com/flanksource/captain/pkg/claude 138 0 0 -
github.com/flanksource/captain/pkg/claude/tools 18 0 0 -
github.com/flanksource/captain/pkg/cmux 1 0 0 -
github.com/flanksource/captain/pkg/codexconfig 10 0 0 10ms
github.com/flanksource/captain/pkg/container 72 0 1 10ms
github.com/flanksource/captain/pkg/database 132 0 0 22.9s
github.com/flanksource/captain/pkg/dod 11 0 0 1m0s
github.com/flanksource/captain/pkg/gitagent 31 0 0 400ms
github.com/flanksource/captain/pkg/gitagent/proxy 12 0 0 30ms
github.com/flanksource/captain/pkg/monitor 61 0 0 9.7s
github.com/flanksource/captain/pkg/sandbox 13 0 0 -
github.com/flanksource/captain/pkg/sandbox/adapter 39 0 0 30ms
github.com/flanksource/captain/pkg/sandbox/presets 13 0 0 -
github.com/flanksource/captain/pkg/session 70 0 0 40ms
history 72 0 0 143ms
jsonl 6 0 0 33ms
migrations 13 0 0 21.1s
openaimock 2 0 0 652.524µs
provider 15 0 0 13ms
registry 52 0 0 9ms
session 31 0 0 7ms
tools 58 0 0 4ms

Totals: 3638 passed · 12 failed · 11 skipped · 3m49s

Failing tests

ginkgo Timeout

Running Suite: GitAgent Suite - /home/runner/work/captain/captain/pkg/gitagent
==============================================================================
Random Seed: �[1m1788275222�[0m

... (28 more lines truncated)```

#### ginkgo Timeout

[1/2] run "direct" iteration 1/1 (model=direct-model)…
· pid=50147, awaiting first stream-json event…
→ Bash
→ Bash
... (108 more lines truncated)```

ginkgo Timeout

�[2m15:07:12.742�[0m �[92mINF�[0m reusing existing embedded postgres on port 7432
�[2m15:07:13.653�[0m �[92mINF�[0m reusing existing embedded postgres on port 7432
�[2m15:07:14.670�[0m �[92mINF�[0m reusing existing embedded postgres on port 7432
�[2m15:07:16.188�[0m �[92mINF�[0m reusing existing embedded postgres on port 7432
... (4 more lines truncated)```

#### ginkgo Execution

'/home/runner/work/captain/captain/.ginkgo/ginkgo-report-.-pkg-gitagent-1788275221751572862.json' not found


#### ginkgo Execution

'/home/runner/work/captain/captain/.ginkgo/ginkgo-report-.-pkg-database-1788275215736568042.json' not found


_... and 7 more failing tests — see the full gavel-results artifact._

[View full results](https://github.com/flanksource/captain/actions/runs/33522704776/artifacts/9806781999)

Comment thread pkg/cli/prompt_write.go Fixed
Comment thread pkg/cli/prompt_write.go Fixed
Comment thread pkg/cli/prompt_write.go Fixed
Replace monolithic Backend enum with separate ModelProvider and RuntimeMode
types to clarify the distinction between "which provider" and "how it's invoked".

This improves type safety and enables flexible runtime combinations. Update all
provider registration, configuration, and observation code to use the new
Provider+Mode pair. Remove Backend field from runtime observations.

BREAKING CHANGE: Backend-keyed API surface replaced with Provider+Mode pair;
callers must update RegisterProvider(), ResolveRuntimeSelectors(), and related
function signatures.
Comment thread pkg/api/aliases.go
Comment on lines +107 to +112
type RuntimeIdentity struct {
Model string `json:"model,omitempty"`
Mode RuntimeMode `json:"mode,omitempty"`
Provider string `json:"provider,omitempty"`
Effort Effort `json:"effort,omitempty"`
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
type RuntimeIdentity struct {
Model string `json:"model,omitempty"`
Mode RuntimeMode `json:"mode,omitempty"`
Provider string `json:"provider,omitempty"`
Effort Effort `json:"effort,omitempty"`
}
type RuntimeIdentity struct {
Runtime
Model string `json:"model,omitempty"`
Effort Effort `json:"effort,omitempty"`
}```

Claude-Session-Id: 01a05ce8-8352-7740-ac44-d48f1b792cb4
Claude-Session-Id: 01a05ce8-8352-7740-ac44-d48f1b792cb4
Claude-Session-Id: 01a05ce8-8352-7740-ac44-d48f1b792cb4
Claude-Session-Id: 01a05ce8-8352-7740-ac44-d48f1b792cb4
Claude-Session-Id: 01a05ce8-8352-7740-ac44-d48f1b792cb4
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang/​github.com/​flanksource/​commons-db@​v0.1.28 ⏵ v0.1.30-0.20260831071002-2c7627a5ba9374 +2100100100100
Updatedgolang/​gorm.io/​gorm@​v1.31.1 ⏵ v1.31.282 +1100100100100

View full report

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: golang modernc.org/libc is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?golang/github.com/flanksource/clicky@v1.21.57golang/github.com/flanksource/commons-db@v0.1.30-0.20260831071002-2c7627a5ba93golang/modernc.org/libc@v1.74.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/modernc.org/libc@v1.74.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: golang modernc.org/libc is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?golang/github.com/flanksource/clicky@v1.21.57golang/github.com/flanksource/commons-db@v0.1.30-0.20260831071002-2c7627a5ba93golang/modernc.org/libc@v1.74.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/modernc.org/libc@v1.74.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants