fix(agent-config): make effect dependencies explicit - #688
Open
beruro wants to merge 4 commits into
Open
Conversation
…ps' into junyu/fix-agent-config-effect-deps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Agent configuration hooks suppressed React dependency lint in four places. The shared loader accepted a caller-managed dependency array, SDE load/save callbacks hid
workspacePathbehind a ref, and OS credential checks reacted only toloadedwhile readingconfig. This obscured the actual scope lifecycle and allowed a slow credential response for an old model to overwrite the current model's status.Solution
Make callback identity the configuration-scope contract:
useAgentConfigBasereloads when its stableloadcallback changes, and OS/SDE callers declare their real dependencies. Derive OS credential synchronization from the current model and guard async results with a monotonically increasing generation so stale or unmounted requests cannot write state. Remove all four dependency suppressions in this group and add focused lifecycle tests for reload, save, and stale-response behavior.Potential risks
The load contract now requires callers to memoize
load; both production callers do so and are covered. UI behavior was not manually exercised in a live Tauri/WebView session, so backend-command integration remains an unverified path. Rollback is a normal commit revert; there are no schema, persistence-format, dependency, or public IPC changes.Verification
./node_modules/.bin/vitest run src/modules/MainApp/AgentOrgs/config/osAgent/useAgentConfigBase.test.ts src/modules/MainApp/AgentOrgs/config/osAgent/useOSAgentConfig.credentials.test.ts src/modules/MainApp/AgentOrgs/config/sdeAgent/useSdeAgentConfig.dependencies.test.ts— 3 files and 4 tests passed../node_modules/.bin/eslinton all six changed files — passed../node_modules/.bin/prettier --checkon all six changed files — passed.npm run typecheck— passed.lint-staged, scoped TypeScript check, commit stats) — passed.git diff --check origin/develop...HEAD— passed.Effects
No rendered markup or styling changed, so screenshots are not useful for this PR.