Skip to content

fix(frontend): Show raw payload for commit deltas outside parameters - #5129

Merged
mmabrouk merged 7 commits into
release/v0.105.6from
fe-fix/agent-commit-delta-preview-scope
Jul 19, 2026
Merged

fix(frontend): Show raw payload for commit deltas outside parameters#5129
mmabrouk merged 7 commits into
release/v0.105.6from
fe-fix/agent-commit-delta-preview-scope

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Context

Follow-up to #5101 (friendly commit_revision approvals), closing the one critical its review found. The backend deep-merges a revision delta onto the whole revision data tree, and WorkflowRevisionData legitimately carries uri, url, headers, runtime, script, and schemas next to parameters. The friendly approval card only previews parameters. So an LLM-authored delta like

{"set": {"parameters": {"agent": {"instructions": "..."}}, "url": "https://..."}}

rendered a benign "Instructions edited" card while the url change stayed invisible, and in chat mode the card fully replaces the raw payload. Approving it committed a change the user never saw. remove paths outside parameters had the same hole: a silent no-op in the preview, a real deletion on the backend.

Changes

classifyRevisionDeltaChanges now returns null whenever the delta reaches outside parameters: any own key on delta.set besides parameters, or any remove path that is not parameters or under parameters.. This is the same scope rule the backend's _validate_delta_scope already enforces for test_run deltas. Returning null routes the card through its existing fallback, so the ApprovalDock shows the exact JSON payload instead of a partial summary.

Deltas confined to parameters (the shape the op description steers agents toward) render the friendly card exactly as before.

Tests

  • Four new unit tests: mixed set (parameters + url) returns null, set-only out-of-scope (script) returns null, out-of-scope remove alongside a parameters edit returns null (including the parametersX prefix-boundary case), and parameters-scoped removes still produce a preview.
  • Full @agenta/entities unit suite green (841 tests), tsc --noEmit and eslint clean.
  • Backend follow-up (separate change): wire _validate_delta_scope into the commit_revision path so out-of-scope deltas are refused at the source, not just downgraded in the preview.

What to QA

  • In agent chat, have the agent propose a config change (e.g. "update your instructions") and reach the commit approval. The friendly "Save a new version of this agent" card still renders with the What's changing sections.
  • Regression: approve it. The commit succeeds and the config panel reflects the change.
  • If you can hand-craft a tool payload with a delta touching url or script: the approval shows the raw JSON payload card instead of the friendly card.

@vercel

vercel Bot commented Jul 7, 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 Jul 19, 2026 2:45pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d0341603-2948-4587-b40f-726086ea21f9

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

classifyRevisionDeltaChanges now returns null when a delta escapes the parameters scope in set or remove updates. Unit tests were added for mixed-scope and strictly scoped removals.

Changes

Delta Scope Validation

Layer / File(s) Summary
Out-of-scope guard for delta classification
web/packages/agenta-entities/src/workflow/commitDiff/revisionDelta.ts
Doc comment updated and an outOfScope check added, returning null when set keys or remove paths fall outside parameters.
Scope validation tests
web/packages/agenta-entities/tests/unit/revision-delta.test.ts
New tests verify null for out-of-scope set/remove operations, including a prefix-matching guard, and confirm valid parameters-scoped removes still produce a preview.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Agenta-AI/agenta#5101: Tightens classifyRevisionDeltaChanges and affects preview rendering paths that depend on its null return value.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 clearly summarizes the main change: falling back to the raw payload for out-of-scope commit deltas.
Description check ✅ Passed The description is directly about the same frontend preview fix and the related tests, so it matches the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fe-fix/agent-commit-delta-preview-scope

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.

@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🧹 Nitpick comments (1)
web/packages/agenta-entities/src/workflow/commitDiff/revisionDelta.ts (1)

100-107: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Reword the backend parity note. _validate_delta_scope is only used on test_run, so this preview guard shouldn’t imply commit_revision already enforces the same scope rule.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 39404084-a4e2-4225-82f1-133cfdaeafd8

📥 Commits

Reviewing files that changed from the base of the PR and between f5bc80d and d33bd58.

📒 Files selected for processing (2)
  • web/packages/agenta-entities/src/workflow/commitDiff/revisionDelta.ts
  • web/packages/agenta-entities/tests/unit/revision-delta.test.ts

… outside parameters

The commit_revision friendly card previews only the parameters tree, but the
backend deep-merges the delta onto the whole revision data (url, script,
headers, ...). A mixed delta rendered its parameters half and silently hid the
rest of the commit. Mirror the backend's test_run delta-scope rule: any set key
besides parameters, or any remove path not under parameters., returns null so
the ApprovalDock shows the exact payload instead.
@ardaerzin
ardaerzin force-pushed the fe-fix/agent-commit-delta-preview-scope branch from d33bd58 to 43aaafd Compare July 7, 2026 17:56
@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ardaerzin
ardaerzin marked this pull request as ready for review July 7, 2026 18:01
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. Frontend labels Jul 7, 2026
@mmabrouk
mmabrouk changed the base branch from big-agents to release/v0.105.6 July 19, 2026 14:09
@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-07-19T15:25:15.098Z

@mmabrouk
mmabrouk merged commit 8bb4e51 into release/v0.105.6 Jul 19, 2026
85 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants