feat(codex): add reusable Codex coding agent workflows - #7205
Conversation
|
@ActivePeter is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds a reusable Codex coding-agent block with layered configuration, execution-scoped sandbox sessions, Plan and Create PR modes, workflow-copy support, settings UI, persistence, and documentation.
Confidence Score: 4/5The PR should not merge until duplicated and forked shared-agent references are remapped consistently with their copied Codex configuration. Workflow copy paths assign new block IDs and move block-ID-keyed Codex configuration to those IDs, but explicit agentId references remain tied to source blocks, splitting copied agent groups and resolving the wrong settings. Files Needing Attention: apps/sim/lib/workflows/persistence/duplicate.ts; apps/sim/ee/workspace-forking/lib/copy/copy-workflows.ts
|
| Filename | Overview |
|---|---|
| apps/sim/executor/handlers/codex/codex-handler.ts | Resolves layered Codex inputs and dispatches execution through reusable agent sessions. |
| apps/sim/executor/handlers/codex/cloud/authoring.ts | Implements isolated repository authoring, Git validation, bounded diff capture, push, and PR create/update behavior. |
| apps/sim/executor/handlers/codex/core/session.ts | Adds execution-owned sandbox pooling and per-agent serialized Codex turns. |
| apps/sim/lib/codex/config.ts | Defines sparse overlay parsing, precedence, compaction, and copied-agent configuration-key remapping. |
| apps/sim/lib/workflows/persistence/duplicate.ts | Remaps workflow Codex configuration keys during duplication but leaves explicit agentId subblock references pointing to source block IDs. |
| apps/sim/ee/workspace-forking/lib/copy/copy-workflows.ts | Applies the same mismatched configuration-key versus subblock-reference remapping during workspace fork and promotion. |
| packages/db/migrations/0309_codex_configuration_layers.sql | Adds nullable JSONB configuration columns for workspace and workflow Codex overlays. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
W[Workspace defaults] --> F[Workflow defaults]
F --> A[Agent settings]
A --> S[Step override]
S --> H[Codex handler]
H --> P{Mode}
P -->|Plan| R[Reusable isolated checkout]
P -->|Create PR| C[Reusable branch and Codex thread]
C --> G[Credentialed commit and push]
G --> PR[Create or update pull request]
Reviews (1): Last reviewed commit: "feat(codex): add reusable coding agent w..." | Re-trigger Greptile
|
|
||
| await tx | ||
| .update(workflow) | ||
| .set({ codexConfig: remapCodexWorkflowAgentIds(source.codexConfig, blockIdMapping) }) |
There was a problem hiding this comment.
Copied agent references diverge
When a duplicated workflow has Codex blocks sharing an agent through another block's ID, this remaps the configuration key to the copied block ID while leaving the agentId subblock pointed at the source block. The copied group therefore splits, and dependent blocks resolve defaults or stale embedded settings instead of the copied agent configuration. The fork create and replace paths in copy-workflows.ts have the same mismatch.
Knowledge Base Used: Workflow authoring and rendering
|
|
||
| function AgentColorDot({ color }: { color: string }) { | ||
| return ( | ||
| <span |
There was a problem hiding this comment.
AgentColorDot assigns its background color through a direct inline style on every rendered agent badge. This bypasses the repository's required Tailwind/CSS-variable styling path and makes the dynamic color inconsistent with normal component styling.
Context Used: Global coding standards that apply to all files (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| @@ -0,0 +1 @@ | |||
| export { AgentSessionSelector } from './agent-session-selector' | |||
There was a problem hiding this comment.
This new apps/sim barrel uses a relative export even though application imports and re-exports must follow the established @/ alias convention. Keeping the absolute path here avoids introducing an exception that complicates refactors and import enforcement.
| export { AgentSessionSelector } from './agent-session-selector' | |
| export { AgentSessionSelector } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/agent-session-selector/agent-session-selector' |
Context Used: Import patterns for the Sim application (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
93d995c to
fa1b75c
Compare
Summary\n\n- add a first-class Codex Coding Agent workflow block backed by isolated E2B or Daytona sandboxes\n- reuse one logical agent, retained repository checkout, and native Codex thread across multiple workflow steps and loop rounds\n- support Plan and Create PR modes with bounded event parsing, output redaction, branch reuse, and pull request updates\n- add Kustomize-style sparse configuration overlays in System → Workspace → Workflow → Agent → Step order\n- keep stable repository/runtime configuration out of step sidebars while allowing reasoning effort as a step-level override\n- preserve agent identity and configuration through collaboration, duplication, workflow copy, and workspace fork flows\n- add database configuration fields, migration, generated schema snapshot, documentation, and sandbox image builders\n\n## Security\n\n- Codex uses user-provided OpenAI BYOK credentials\n- GitHub credentials remain user-only inputs and are not included in inherited configuration\n- each logical agent receives an isolated CODEX_HOME\n- model shell network access is disabled by default and must be enabled explicitly\n- command output and repository URLs are redacted before workflow output projection\n\n## Validation\n\n- rebased onto upstream v0.8.13\n- bun run type-check\n- 24 focused Vitest files, 649 tests passed\n- bun run check:migrations\n- bun run check:api-validation:strict\n- bun run docs-manifest:check\n- bun run docs:check\n- Codex canvas sentence validation\n- manual browser verification of Workspace, Workflow, Agent, and Step inheritance plus collaborative mirror persistence