[fix] Persist build-kit tool disable across playground reloads [AGE-4251] - #6519
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe 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. ChangesBuild-kit UI state persistence
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to 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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
web/packages/agenta-entities/src/workflow/state/store.tsweb/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.
Railway Preview Environment
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.
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
localStoragerecord 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, souseBuildKit,AgentTemplateControl, and the run-request builder need no changes.Before:
workflowBuildKitDisabledOpsAtomFamily(rev)wasatom<string[]>([]), reset on every load.After: it reads/writes
agenta:playground:build-kitinlocalStorage(one record,{[revisionId]: {enabled, disabledOps}}, hydrated viagetOnInit).Tests
agent-build-kit-ui-state-atom.test.tsmodels a reload withvi.resetModules()+ a fresh import: a switched-off tool, the master off, and per-revision isolation all survive.agentRequestsuite (43 tests) still pass.tsc --noEmitand eslint clean on the changed files.What to QA