Skip to content

[fix] Persist build-kit tool disable across playground reloads [AGE-4251] - #6519

Merged
ashrafchowdury merged 2 commits into
release/v0.114.8from
fix/build-kit-tool-disable-persist-6493
Sep 4, 2026
Merged

[fix] Persist build-kit tool disable across playground reloads [AGE-4251]#6519
ashrafchowdury merged 2 commits into
release/v0.114.8from
fix/build-kit-tool-disable-persist-6493

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Context

Disable a "build it" tool in the agent playground, refresh, and the tool is enabled again. The disabled state never survived a reload. The playground held the build-kit UI state (the master on/off plus the ops switched off individually) in plain in-memory Jotai atoms, so every page load re-initialized them to their defaults (enabled: true, disabledOps: []).

Changes

Both atom families are now backed by a single localStorage record keyed by revision id, so a switched-off tool and the master off both persist across reloads. The two families keep their existing public API, so useBuildKit, AgentTemplateControl, and the run-request builder need no changes.

Before: workflowBuildKitDisabledOpsAtomFamily(rev) was atom<string[]>([]), reset on every load.
After: it reads/writes agenta:playground:build-kit in localStorage (one record, {[revisionId]: {enabled, disabledOps}}, hydrated via getOnInit).

Tests

  • New unit suite agent-build-kit-ui-state-atom.test.ts models a reload with vi.resetModules() + a fresh import: a switched-off tool, the master off, and per-revision isolation all survive.
  • Existing build-kit overlay atom/api suites and the playground agentRequest suite (43 tests) still pass. tsc --noEmit and eslint clean on the changed files.

What to QA

  • Open the playground for any agent, expand Advanced, switch off one "build it" tool, then refresh. The tool stays off.
  • Switch the whole build kit off and refresh. It stays off.
  • Regression: two different agents keep independent tool states. Switching a tool off in one does not change the other.

The playground's build-kit enabled/disabledOps atoms were in-memory, so an
individually switched-off tool (or the master off) reverted to enabled after a
refresh (#6493). Back both atom families with one localStorage record keyed by
revision id (getOnInit hydration), keeping their public API unchanged.
@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

AGE-4251

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 4, 2026 6:06am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 5eacbd62-05cf-42db-941e-7017644c4deb

📥 Commits

Reviewing files that changed from the base of the PR and between edc963e and b9708ef.

📒 Files selected for processing (2)
  • web/packages/agenta-entities/src/workflow/state/store.ts
  • web/packages/agenta-entities/tests/unit/agent-build-kit-ui-state-atom.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/packages/agenta-entities/tests/unit/agent-build-kit-ui-state-atom.test.ts
  • web/packages/agenta-entities/src/workflow/state/store.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Build-kit preferences now persist across page reloads and sessions.
    • Master enable/disable settings are saved separately for each workflow revision.
    • Individual platform operation settings persist independently for each revision.
    • New revisions retain default build-kit settings without affecting existing revisions.
  • Bug Fixes

    • Invalid or incompatible saved preference data now safely falls back to default settings.

Walkthrough

The workflow store now persists build-kit UI state in localStorage for each revision. The atom families support writable master and per-operation settings. Unit tests cover defaults, reload persistence, malformed data, and revision isolation.

Changes

Build-kit UI state persistence

Layer / File(s) Summary
Persist state by revision
web/packages/agenta-entities/src/workflow/state/store.ts
The store uses a shared atomWithStorage record keyed by revision ID. Normalization validates stored values before the writable atom families persist the master enabled flag and disabledOps list.
Validate reload persistence
web/packages/agenta-entities/tests/unit/agent-build-kit-ui-state-atom.test.ts
Tests simulate module reloads with a MemoryStorage stub. They verify default values, persisted settings, malformed data fallback, and independent state for separate revisions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to b9708

Build-kit enabled and disabled-operation settings now persist per revision across reloads, with malformed persisted values normalized. No current merge-blocking risk is identified.

Sequence Diagram(s)

sequenceDiagram
  participant BuildKitAtomFamily
  participant BuildKitStateHelpers
  participant LocalStorage
  BuildKitAtomFamily->>BuildKitStateHelpers: read or update revision state
  BuildKitStateHelpers->>LocalStorage: persist agenta:playground:build-kit
  LocalStorage-->>BuildKitStateHelpers: return stored revision state
  BuildKitStateHelpers-->>BuildKitAtomFamily: return normalized enabled or disabledOps state
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
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 identifies the main change: persisting build-kit tool disable state across playground reloads. It is concise and includes the issue reference.
Description check ✅ Passed The description directly explains the reload persistence issue, the localStorage implementation, validation, tests, and QA steps. It is related to the changeset.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-kit-tool-disable-persist-6493

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.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 8a4da00d-94a1-42ac-908b-b8d63e6d32fe

📥 Commits

Reviewing files that changed from the base of the PR and between ded2cc3 and edc963e.

📒 Files selected for processing (2)
  • web/packages/agenta-entities/src/workflow/state/store.ts
  • web/packages/agenta-entities/tests/unit/agent-build-kit-ui-state-atom.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread web/packages/agenta-entities/src/workflow/state/store.ts
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-09-04T11:28:12.842Z

Normalize each revision's persisted UI state on read: valid-JSON-of-the-wrong-shape
slips past jotai's parse fallback, and a non-array disabledOps would throw in the
switches' .filter. Guard both fields and fold the shared read/write into helpers.
@ashrafchowdury
ashrafchowdury changed the base branch from main to release/v0.114.8 September 4, 2026 11:27
@ashrafchowdury
ashrafchowdury merged commit 1702661 into release/v0.114.8 Sep 4, 2026
75 of 76 checks passed
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.

(bug) Disabling a "build it" tool individually in the playground gets re-enabled after page refresh

1 participant