Fix Destroy→Restore: KB name, duplicate agents, webloc, My Lists#6
Closed
agropper wants to merge 4 commits intoagropper:mainfrom
Closed
Fix Destroy→Restore: KB name, duplicate agents, webloc, My Lists#6agropper wants to merge 4 commits intoagropper:mainfrom
agropper wants to merge 4 commits intoagropper:mainfrom
Conversation
…h, FAQ accordion - /api/local/delete: relax UUID-only regex to accept any valid userId format - Restore flow: validate folder identity matches userId before restoring - Folder picker: reject folders already assigned to a different known user - Wizard: switch tabs in-place instead of close/reopen MyStuffDialog (fixes flash) - FAQ dialog: render as expandable accordion instead of flat markdown Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- generate-patient-summary: retry once after recreating stale API key - files/lists/current-medications: same 401 retry pattern - extractMarkdownCategories: same 401 retry pattern - Matches existing retry logic in chat.js Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ists loop
Root cause of NO_KB_FILES: RestoreWizard uploaded files to {userId}-kb/ (simple
fallback) but update-knowledge-base generated a new timestamped name and looked
for files under {userId}-kb-{timestamp}/. Fix: /api/account/recreate now
generates and stores kbName so both paths use the same name.
Other fixes:
- Destroy now scans for and deletes ALL agents matching {userId}-agent-* pattern,
not just the stored assignedAgentId (prevents orphaned agents in DO)
- Suppress ChatInterface agent-setup-status polling during restore to prevent
racing with RestoreWizard's sync-agent call (duplicate agent creation)
- Write personalized webloc and save local state snapshot after restore
- Clear stale sessionStorage wizard flags on restore to prevent My Lists reload
- Add comprehensive debug logging to destroy, restore, file registration, and
KB indexing flows
- Add post-destroy verification (CouchDB, agent, KB, Spaces)
- Add POST /api/user-status endpoint for RestoreWizard completion
- Add Documentation/Wizards.md describing provisioning architecture and fragility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…& coordinator 1. Idempotent KB name: getKBNameFromUserDoc() returns null instead of generating a new name. ensureKBNameOnUserDoc() is the only generator. kbName is set at user doc creation time in both /api/temporary/start and /api/account/recreate. Null guards added to unguarded callers. 2. Agent creation mutex: per-user lock prevents concurrent agent creation from ChatInterface polling and RestoreWizard both calling ensureUserAgent(). 3. RestoreWizard waits for agent deployment: polls /api/agent-setup-status every 5s (up to 40 attempts) before proceeding to metadata restore. 4. Single provisioning coordinator: POST /api/restore batches metadata saves (medications, summary, chats, instructions) into one server-side call, replacing 4 separate client-side fetch calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
/api/account/recreatenow generates and storeskbNamein the new user doc so RestoreWizard andupdate-knowledge-baseuse the same timestamped KB folder path{userId}-agent-*pattern, not just the storedassignedAgentIdmaia-for-{name}-as-{userId}.weblocand save local state snapshot on restore completionautoProcessInitialFileandwizardMyListsAutosessionStorage flags at restore startDocumentation/Wizards.mddescribing the provisioning/destroy/restore architecture and known fragility pointsTest plan
.weblocfile appears in local folder after restore🤖 Generated with Claude Code