Skip to content

refactor: split model agent manager responsibilities#112

Merged
ProfSynapse merged 4 commits into
mainfrom
codex/model-agent-manager-refactor
Apr 7, 2026
Merged

refactor: split model agent manager responsibilities#112
ProfSynapse merged 4 commits into
mainfrom
codex/model-agent-manager-refactor

Conversation

@ProfSynapse
Copy link
Copy Markdown
Owner

Summary\n- split ModelAgentManager into focused collaborators for conversation settings, workspace context, defaults, prompt assembly, and compaction state\n- keep ModelAgentManager as the stateful facade and preserve its public API\n- add characterization coverage for restore/save, workspace binding, message options, and delegated default resolution\n\n## Verification\n- npm test\n- npx jest tests/unit/ModelAgentManager.test.ts tests/unit/ModelAgentManagerContextGating.test.ts tests/unit/ModelAgentManagerCompactionPersistence.test.ts --runInBand\n- focused eslint on the changed files\n\n## Notes\n- Full repo tests pass in this branch.\n- npm run build still fails during the repo-wide eslint phase due to pre-existing issues outside this refactor in src/database/storage/SQLiteCacheManager.ts and a console warning in src/core/PluginLifecycleManager.ts.

ProfSynapse and others added 4 commits April 7, 2026 07:55
Introduce PluginScopedStorageCoordinator to resolve storage paths
relative to the active plugin directory rather than hardcoding .nexus,
which enables reliable SQLite WASM resolution and JSONL sync across
devices. JSONLWriter now supports multiple read roots so data synced
from other devices is discovered alongside local writes. Adds a
"Refresh synced data" maintenance command for mobile users whose vault
finishes syncing after plugin init. Settings save now merges with
existing data to avoid clobbering unrecognized keys. Conversation
reconciliation replays JSONL files missing from SQLite on startup
and after each sync cycle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…te sync

- Serialize data.json writes with shared pluginDataLock to prevent
  saveSettings/saveState race condition
- Short-circuit prepareStoragePlan() when migration is already verified,
  eliminating redundant file I/O on every startup
- Add conversation_deleted event type so deleted conversations persist
  in JSONL and don't resurrect on reconciliation/sync
- Update README and CLAUDE.md with multi-device sync documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
prepareStoragePlan() added I/O before sqliteCache.initialize(),
widening the race window where EmbeddingManager could query an
uninitialized database. Now awaits waitForReady() and bails
gracefully if the adapter failed to initialize.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ProfSynapse ProfSynapse merged commit 371a10c into main Apr 7, 2026
Midway65 added a commit to Midway65/nexus that referenced this pull request Apr 7, 2026
…pse#106, ProfSynapse#107, ProfSynapse#112ProfSynapse#115)

Merges upstream/main (35bed84) into my-custom-branch.

Fork additions preserved:
- HybridStorageAdapter: pruneOrphanedConversationFiles() re-added (fork: temporary cleanup)
- SQLiteMaintenanceService: fixVec0TableDimensions() added (fork: vec0 768→384 fix)
- SQLiteCacheManager: calls fixVec0TableDimensions() after migrations
- JSONLWriter: readEventsStreaming() kept; size-check in readEvents() for >50MB files;
  stat() call made optional-chain safe for test environments
- MessageBubble: action bar import, field, appendActionBar/cleanupActionBar methods,
  call sites in createElement/updateWithNewMessage/rebuildElement/cleanup;
  ToolBubbleFactory call uses 3-param signature (action bar owns copy)

Upstream changes taken entirely:
- ProviderHttpClient: dropped our require() fix; took upstream desktopRequire version
- ConversationRepository: dropped JSONL file-delete; took upstream tombstone approach
- ModelAgentManager: 5-service split (PRs ProfSynapse#112)
- SQLiteCacheManager: 6-file split (PR ProfSynapse#113); facade kept; new services accepted
- MessageBubble: 527-line refactor with 4 helper classes (PR ProfSynapse#115)
- PluginScopedStorage: new PluginScopedStorageCoordinator + PluginStoragePathResolver
- 9 new test files accepted from upstream

.gitignore: added !docs/review/ exception (pattern consistent with other doc dirs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant