Skip to content

[feat] Enable full configuration of code and hook workflows and their schemas#4711

Open
junaway wants to merge 8 commits into
mainfrom
add-code-hook-workflow-config
Open

[feat] Enable full configuration of code and hook workflows and their schemas#4711
junaway wants to merge 8 commits into
mainfrom
add-code-hook-workflow-config

Conversation

@junaway

@junaway junaway commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Context

Code and hook workflows carry settings that lives outside data.parameters: code workflows have a script and runtime, hook workflows have a url and headers. These sit as siblings of parameters inside the revision's data object. The playground never rendered them, and the whole config pipeline only ever looked at data.parameters, so even if they had rendered, edits would not have been detected as dirty, diffed, or committed.

Changes

1. All-data plumbing. The config pipeline now covers every data.* field, not just parameters, across the five layers it touches:

  • Render: PlaygroundConfigSection.tsx surfaces the sibling fields, gated by the workflow URI so they only show for custom hook/code workflows.
  • Dirty detection: store.ts compares the whole data object with a deep equal (parameters stay normalized to avoid false positives) instead of only diffing parameters.
  • Patch build: snapshotAdapter.ts shallow-diffs the whole data (parameters nested), so any sibling field change produces a patch.
  • Diff display: variantAdapters.ts builds the commit context from the whole data on both sides.
  • Commit payload: commit.ts sends every canonical field. The backend model is extra="forbid", so the payload explicitly picks uri, url, headers, script, runtime, parameters, schemas rather than spreading. api.ts reuses the canonical WorkflowData type instead of an inline shape, and schema.ts adds the runtime enum (python | typescript | javascript).

Before, a patch was always data: {parameters}. After, it is a diff over the full data object.

2. Code/Hook UX. A grouped accordion renders the sibling fields through a dedicated HookCodeConfigControl (no synthetic schema):

  • Hook: a URL input plus a key/value Headers editor (monospace, 1/3–2/3 columns, add/remove rows).
  • Code: a script editor with the tool-card chrome (copy, collapse, line numbers; editor language derived from the runtime) and a runtime picker in the section header, styled like the model selector.

The accordion matches the existing Prompt accordion (full-bleed header, spacing before it when there are parameters above).

Tests / notes

  • Verified end to end in the playground: sibling fields render only for hook/code workflows, editing them marks the revision dirty, the diff view shows the change, and committing persists it. Confirmed the saved data in Postgres (workflow_revisions).
  • Runtime switches the script editor's syntax highlighting.

What to QA

  • Open a code workflow in the playground. Below Parameters there is a Code accordion with a script editor and a runtime dropdown. Edit the script. The revision goes dirty, the diff shows it, and commit persists it (reopen to confirm).
  • Switch the runtime. The script editor's language highlighting changes to match.
  • Open a hook workflow. There is a Hook accordion with a URL field and a Headers key/value editor. Add a header, commit, reopen, and it is still there.
  • Regression: open a normal completion workflow. No Hook/Code accordion appears, and editing parameters still commits as before.

Copilot AI review requested due to automatic review settings June 16, 2026 06:15
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jun 16, 2026
@vercel

vercel Bot commented Jun 16, 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 17, 2026 2:33pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR expands the workflow entity data model from a parameters-only shape to a full WorkflowData object that includes headers, script, and runtime, propagating the change through Zod schema validation, draft/snapshot patching, dirty tracking, commit API payloads, three new sibling-section UI controls, sibling section rendering, and variant commit diffs. In parallel, the Python SDK adds support for custom hook URIs with remote forwarding capability, allowing workflows to forward invocations to a remote service while preventing managed handler resolution from shadowing decorated functions.

Changes

Workflow Full Data Expansion

Layer / File(s) Summary
Schema and payload type foundation
web/packages/agenta-entities/src/workflow/core/schema.ts, web/packages/agenta-entities/src/workflow/api/api.ts
workflowDataSchema.runtime is narrowed to "python" | "typescript" | "javascript" enum; CreateWorkflowPayload.data and UpdateWorkflowPayload.data are updated from inline object shapes to the shared WorkflowData | null type.
Draft patch expansion to full data object
web/packages/agenta-entities/src/workflow/snapshotAdapter.ts
Replaces the fixed {parameters} patch schema with an open string-keyed record, adds mergeDataPatch() for shallow-parameter/replace-other merge, and rewrites buildDraftPatch, applyDraftPatch, and createLocalDraftWithPatch to diff and apply patches over the full data object.
Dirty tracking and commit payload expansion
web/packages/agenta-entities/src/workflow/state/store.ts, web/packages/agenta-entities/src/workflow/state/commit.ts, web/packages/agenta-entities/src/workflow/state/runnableSetup.ts
workflowIsDirtyAtomFamily now deep-compares the entire normalized data object; commitWorkflowRevisionAtom and createWorkflowVariantAtom include headers, script, and runtime in commit payloads; app-workflow invoke payload gains a data.revision field.
HookConfigControl, CodeConfigControl, and SchemasConfigControl
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/HookConfigControl.tsx, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/CodeConfigControl.tsx, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SchemasConfigControl.tsx, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/index.ts
Introduces three memoized UI controls: HookConfigControl (URL + key/value headers), CodeConfigControl (script editor with runtime-to-language mapping), and SchemasConfigControl (three JSON-schema editors for parameters/inputs/outputs). All three are re-exported from the barrel index.
PlaygroundConfigSection sibling group support
web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx
Defines sibling group keys (hook, code, schemas), merges sibling data into the adapter-visible shape, adds configUpdateRouterAtom routing __siblingData payloads to the workflow molecule, extends schema resolution for sibling paths, wires a runtime dropdown in the code header, and renders sibling sections via the new controls inside HeightCollapse.
Variant commit diff construction
web/packages/agenta-entity-ui/src/adapters/variantAdapters.ts
buildGenericCommitContext accepts full localData/remoteData objects and diffs entire .data payloads; variantCommitContextAtom extracts .data from workflowMolecule selectors.
Code style documentation
web/AGENTS.md
Adds a "Keep in-code comments terse" hard rule under React best practices.

Custom Hook Remote Forwarding

Layer / File(s) Summary
Custom hook URI detection and decorator options
sdks/python/agenta/sdk/decorators/running.py
Introduces _is_custom_hook() helper to recognize agenta:custom:hook:*:* URIs; adds remote: bool = False parameter to workflow.__init__; skips managed handler resolution for custom hook URIs while still merging registered interface and parameter configuration.
Remote forwarding handler and error handling
sdks/python/agenta/sdk/engines/running/errors.py, sdks/python/agenta/sdk/engines/running/handlers.py, sdks/python/agenta/sdk/middlewares/running/resolver.py
Introduces remote_forward_v0() handler that extracts revision URL/headers, constructs .../invoke endpoint, and forwards request payloads to a target service; adds CustomHookHandlerNotDefinedV0Error exception; replaces hook_v0 webhook behavior with an error placeholder; preserves pre-installed handlers in middleware resolution.
Handler selection and logging in invoke()
sdks/python/agenta/sdk/decorators/running.py
Selects remote_forward_v0 handler when self.remote is True; expands logging to include remote flag and resolved handler name.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PlaygroundConfigSection
  participant configUpdateRouterAtom
  participant workflowMolecule
  participant snapshotAdapter
  participant commitApi

  User->>PlaygroundConfigSection: edit code script or hook URL/headers
  PlaygroundConfigSection->>configUpdateRouterAtom: dispatch {__siblingData: {script|url|headers}}
  configUpdateRouterAtom->>workflowMolecule: write raw sibling data fields

  User->>PlaygroundConfigSection: change runtime via dropdown
  PlaygroundConfigSection->>configUpdateRouterAtom: dispatch {__siblingData: {runtime}}
  configUpdateRouterAtom->>workflowMolecule: update runtime field

  workflowMolecule->>snapshotAdapter: buildDraftPatch(currentData, serverBaseline)
  snapshotAdapter->>snapshotAdapter: shallow diff full data object
  snapshotAdapter-->>workflowMolecule: patch record (headers/script/runtime/parameters)

  User->>PlaygroundConfigSection: commit revision
  PlaygroundConfigSection->>commitApi: commitWorkflowRevisionApi({uri, url, headers, script, runtime, parameters, schemas})
Loading
sequenceDiagram
  participant Decorator as workflow decorator<br/>remote=True
  participant RunningContext
  participant remote_forward_v0
  participant RemoteService as Target Service<br/>/invoke endpoint

  Decorator->>RunningContext: invoke() with remote flag
  RunningContext->>RunningContext: select remote_forward_v0 handler
  RunningContext->>remote_forward_v0: execute with request/parameters/inputs
  remote_forward_v0->>remote_forward_v0: extract revision URL/headers
  remote_forward_v0->>RemoteService: POST /invoke with payload + forwarded headers
  RemoteService-->>remote_forward_v0: response
  remote_forward_v0-->>RunningContext: return response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.85% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description provides comprehensive context on the changes, clearly explaining the motivation, the five-layer pipeline modifications, UI improvements, testing details, and QA instructions related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title directly and specifically summarizes the main change: enabling full configuration of code and hook workflows and their schemas through the playground UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-code-hook-workflow-config

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 and usage tips.

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.

Pull request overview

This PR extends the playground workflow configuration pipeline to handle all workflow.data.* fields (not just data.parameters), enabling full editing/diffing/committing of custom hook (url, headers) and code (script, runtime) workflow settings.

Changes:

  • Add dedicated hook/code UI controls and surface them as top-level config sections in the playground (including a runtime picker for code workflows).
  • Update dirty detection, diff/commit context, draft patching, and commit payloads to operate on the full data object.
  • Tighten types by reusing WorkflowData in API payloads and constraining runtime to an enum.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/index.ts Exports the new dedicated hook/code config control.
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/HookCodeConfigControl.tsx Adds purpose-built UI for hook (URL/headers) and code (script) fields.
web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx Plumbs sibling data.* fields into the config UI, sections, and update routing.
web/packages/agenta-entity-ui/src/adapters/variantAdapters.ts Builds commit/diff context from full data (with normalized parameters).
web/packages/agenta-entities/src/workflow/state/store.ts Updates dirty detection to compare the full data object.
web/packages/agenta-entities/src/workflow/state/commit.ts Sends explicit canonical WorkflowData fields (incl. headers/script/runtime) in commits.
web/packages/agenta-entities/src/workflow/snapshotAdapter.ts Changes draft patching from {parameters}-only to shallow diff over full data.
web/packages/agenta-entities/src/workflow/core/schema.ts Constrains runtime to `python
web/packages/agenta-entities/src/workflow/api/api.ts Reuses WorkflowData for create/update payload typing.
web/AGENTS.md Adds a “keep in-code comments terse” guideline.
Comments suppressed due to low confidence (1)

web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx:1687

  • The loading/empty-state gating only checks hasParameters(activeData), so hook/code workflows with no parameters but with sibling groups (code/hook) will incorrectly show “No configuration needed” and never render the new accordions.
        [collapsedSections, parameters, siblingGroups, disabled, promptModelInfo?.isRootLevel],
    )

    // ========== LOADING / EMPTY STATE ==========
    const isConfigLoading = schemaQuery.isPending && !hasParameters(activeData)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web/packages/agenta-entities/src/workflow/snapshotAdapter.ts Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d91a54e7-a9d5-4518-a673-3b05b27f2676

📥 Commits

Reviewing files that changed from the base of the PR and between 58a5cca and 4cf6682.

📒 Files selected for processing (10)
  • web/AGENTS.md
  • web/packages/agenta-entities/src/workflow/api/api.ts
  • web/packages/agenta-entities/src/workflow/core/schema.ts
  • web/packages/agenta-entities/src/workflow/snapshotAdapter.ts
  • web/packages/agenta-entities/src/workflow/state/commit.ts
  • web/packages/agenta-entities/src/workflow/state/store.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/HookCodeConfigControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/index.ts
  • web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx
  • web/packages/agenta-entity-ui/src/adapters/variantAdapters.ts

Comment thread web/packages/agenta-entities/src/workflow/snapshotAdapter.ts Outdated
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-f181.up.railway.app/w
Image tag pr-4711-6e2aa0f
Status Failed
Railway logs Open logs
Logs View workflow run
Updated at 2026-06-17T14:42:02.584Z

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (4)
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/HookConfigControl.tsx (1)

1-6: ⚡ Quick win

Trim multi-line comment blocks to the one-line comment rule.

These newly added doc comments are multi-line blocks; this repo rule requires comments to be at most one short line.

As per coding guidelines: “Keep in-code comments to at most ONE short line per comment. Do not write multi-line blocks narrating why in prose or restating what the code shows.”

Also applies to: 103-106, 111-112

Source: Coding guidelines

web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/CodeConfigControl.tsx (1)

1-6: ⚡ Quick win

Reduce new multi-line comments to single-line comments.

Several added comment blocks exceed the repo’s one-line comment limit.

As per coding guidelines: “Keep in-code comments to at most ONE short line per comment. Do not write multi-line blocks narrating why in prose or restating what the code shows.”

Also applies to: 19-20, 95-98, 103-104

Source: Coding guidelines

web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SchemasConfigControl.tsx (1)

1-8: ⚡ Quick win

Conform added comment blocks to the one-line comment guideline.

The new comments are multi-line prose blocks; this codebase requires single short-line comments only.

As per coding guidelines: “Keep in-code comments to at most ONE short line per comment. Do not write multi-line blocks narrating why in prose or restating what the code shows.”

Also applies to: 126-129

Source: Coding guidelines

web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx (1)

303-304: ⚡ Quick win

Please collapse newly added multi-line prose comments to single-line comments.

These new comment blocks exceed the one-line comment policy for TS/TSX files.

As per coding guidelines: “Keep in-code comments to at most ONE short line per comment. Do not write multi-line blocks narrating why in prose or restating what the code shows.”

Also applies to: 325-326, 360-361, 473-475, 500-501

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 705e0336-4430-4c47-8853-6fdd497b6318

📥 Commits

Reviewing files that changed from the base of the PR and between 381865e and c5ad34d.

📒 Files selected for processing (13)
  • web/AGENTS.md
  • web/packages/agenta-entities/src/workflow/api/api.ts
  • web/packages/agenta-entities/src/workflow/core/schema.ts
  • web/packages/agenta-entities/src/workflow/snapshotAdapter.ts
  • web/packages/agenta-entities/src/workflow/state/commit.ts
  • web/packages/agenta-entities/src/workflow/state/runnableSetup.ts
  • web/packages/agenta-entities/src/workflow/state/store.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/CodeConfigControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/HookConfigControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SchemasConfigControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/index.ts
  • web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx
  • web/packages/agenta-entity-ui/src/adapters/variantAdapters.ts
✅ Files skipped from review due to trivial changes (2)
  • web/AGENTS.md
  • web/packages/agenta-entities/src/workflow/api/api.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • web/packages/agenta-entities/src/workflow/core/schema.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/index.ts
  • web/packages/agenta-entities/src/workflow/state/commit.ts
  • web/packages/agenta-entities/src/workflow/state/runnableSetup.ts
  • web/packages/agenta-entities/src/workflow/state/store.ts
  • web/packages/agenta-entity-ui/src/adapters/variantAdapters.ts
  • web/packages/agenta-entities/src/workflow/snapshotAdapter.ts

Copilot AI review requested due to automatic review settings June 17, 2026 10:30
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jun 17, 2026
@junaway junaway changed the title [feat] Enable full configuration of code and hook workflows [feat] Enable full configuration of code and hook workflows and their schemas Jun 17, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c818e5bf-ee21-45d8-926e-175eefeaa86d

📥 Commits

Reviewing files that changed from the base of the PR and between c5ad34d and 01bb436.

📒 Files selected for processing (4)
  • sdks/python/agenta/sdk/decorators/running.py
  • sdks/python/agenta/sdk/engines/running/errors.py
  • sdks/python/agenta/sdk/engines/running/handlers.py
  • sdks/python/agenta/sdk/middlewares/running/resolver.py

Comment thread sdks/python/agenta/sdk/engines/running/handlers.py Outdated
Comment thread sdks/python/agenta/sdk/engines/running/handlers.py

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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.

Comment thread web/packages/agenta-entities/src/workflow/snapshotAdapter.ts Outdated
Comment thread sdks/python/agenta/sdk/engines/running/handlers.py Outdated
Comment thread sdks/python/agenta/sdk/engines/running/errors.py
@junaway junaway requested a review from ardaerzin June 17, 2026 10:42
jp-agenta and others added 3 commits June 17, 2026 13:05
…ok config)

Generalize the playground config pipeline from data.parameters-only to the whole
data object, so code (script/runtime) and hook (url/headers) workflow fields are
rendered, diffed, and committed. Covers all five layers: render, dirty detection,
patch build, diff preview, and commit payload. Sibling sections are uri-gated
(custom:hook -> url/headers, custom:code -> script/runtime). Reuses the canonical
WorkflowData type and aligns runtime to the backend enum.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Render the code/hook data fields as one grouped 'Code'/'Hook' accordion via a
dedicated HookCodeConfigControl (no synthetic schema): hook shows a URL input +
key/value Headers editor; code shows a script editor with tool-card chrome (copy,
collapse, line numbers) whose language follows the runtime, plus a runtime picker
in the section header styled like the model picker. Sections match the prompt
accordion (full-bleed header, spaced from params).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The playground app-workflow invoke payload sent data.{inputs,parameters} only.
hook_v0 resolves the webhook url/headers from data.revision (a full
WorkflowRevision), so without it the call had no url to forward to. Forward the
whole revision under data.revision.
- New Schemas section (parameters/inputs/outputs JSON-schema editors) shown for
  both hook and code workflows, sourced from data.schemas. Section and each
  field collapsed by default; tool-card chrome (copy/collapse/line numbers).
  Writes route under data.schemas via {__siblingData:{schemas:...}}.
- Split HookCodeConfigControl into dedicated HookConfigControl and
  CodeConfigControl (one component per kind), consistent with SchemasConfigControl.
A workflow declaring uri=*:custom:hook:* used to resolve to the managed hook_v0
forwarder, which posted to the revision url verbatim. When the workflow IS the
url's target, that meant it never ran its own handler and called itself.

- @ag.workflow gains remote: bool = False. remote=True forwards to {url}/invoke
  (new remote_forward_v0, which also rstrips and appends /invoke, and forwards
  headers); remote=False runs the installed handler in-process.
- A custom-hook URI no longer binds a managed handler, so the decorator's own
  handler runs. The resolver keeps a handler the decorator already installed.
- hook_v0 is now a raising stub (CustomHookHandlerNotDefinedV0Error); reaching
  it means a custom hook had no handler and no remote.
Copilot AI review requested due to automatic review settings June 17, 2026 13:30
@junaway junaway force-pushed the add-code-hook-workflow-config branch from 5e121f3 to 669ef4c Compare June 17, 2026 13:30
@ardaerzin

Copy link
Copy Markdown
Contributor

Code review

Found 2 issues, both in the workflowIsDirtyAtomFamily change in store.ts:

  1. Dirty detection now diffs the whole data object (so it includes data.schemas), but normalizeData only normalizes parameters — not schemas. For evaluator workflows the entity side carries a nested schema (workflowBaseEntityAtomFamily applies nestEvaluatorSchema) while the server baseline (workflowServerDataSelectorFamily) stays flat. The two schemas shapes never compare equal, so every evaluator workflow reports isDirty = true on load before any edit.

// Compare the whole data object (so code/hook fields register as dirty),
// keeping parameters normalized to avoid false positives.
const normalizeData = (
data: Record<string, unknown> | null | undefined,
normalizedParams: unknown,
): unknown => {
const base = (data ?? {}) as Record<string, unknown>
return sortObjectKeys({...base, parameters: normalizeForComparison(normalizedParams)})
}
const normalizedEntity = normalizeData(entityData.data, entityParams)
const normalizedServer = normalizeData(serverData.data, serverParams)
const isDirty = !isEqual(normalizedEntity, normalizedServer)

  1. Stale comment: it still says "isDirty only compares parameters, never schemas", but the new code below it compares the entire data object (schemas, url, headers, script, runtime). The comment now contradicts the behavior and is what makes issue 1 easy to miss.

// Get the effective current parameters (base entity = server/clone + draft overlay,
// without schema resolution — isDirty only compares parameters, never schemas)
const entityData = get(workflowBaseEntityAtomFamily(workflowId))

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

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.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

Comment thread sdks/python/agenta/sdk/engines/running/handlers.py Outdated
Comment thread sdks/python/agenta/sdk/engines/running/handlers.py
Comment thread web/packages/agenta-entities/src/workflow/snapshotAdapter.ts
Comment thread web/packages/agenta-entities/src/workflow/state/runnableSetup.ts
Comment thread sdks/python/agenta/sdk/engines/running/errors.py
The whole-data dirty check compared server schemas.parameters (flat for
evaluators) against the nested entity schema, so every evaluator workflow
reported dirty on load. Nest the server schema to match. Fix stale comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Migrate hook forwarding tests to remote_forward_v0 (forwarding moved off
  hook_v0, now a raising stub); add a stub-raises test.
- Coerce forwarded webhook headers to str->str for httpx.
- Neutral wording for the custom-hook-not-defined error.
- mergeSiblingFields: default runtime to python (no false 'Select runtime').
- getChangesFromPath: emit tagged __siblingData for sibling paths.
- URL placeholder drops /invoke (always appended by remote_forward_v0).
- Condense multi-line comments per AGENTS.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Comment thread sdks/python/agenta/sdk/engines/running/handlers.py
setValueAtPath is immutable; the sibling/param branches ignored its
return value and emitted the pre-update object. Use the returned value.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Frontend size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants