Skip to content

feat: multi-project architecture — config, sessions, CLI#905

Closed
harsh-batheja wants to merge 1 commit intomainfrom
feat/issue-813
Closed

feat: multi-project architecture — config, sessions, CLI#905
harsh-batheja wants to merge 1 commit intomainfrom
feat/issue-813

Conversation

@harsh-batheja
Copy link
Copy Markdown
Collaborator

@harsh-batheja harsh-batheja commented Apr 4, 2026

What this PR does

Implements multi-project support so a single ao installation can manage multiple repos simultaneously. Also hardens the config loading pipeline, running state, and session ID management.

Added

Core infrastructure (packages/core)

  • global-config.ts — global registry at ~/.agent-orchestrator/config.yaml storing project identity; per-project behavior in local agent-orchestrator.yaml files (hybrid mode)
  • migration.tsbuildEffectiveConfig merges global registry + local configs into a standard OrchestratorConfig
  • multi-project-start.tsresolveMultiProjectStart + registerNewProject + validateAndCommitRegistration: pure registration logic with validate-first, write-after semantics and concurrent registration detection
  • OrchestratorSessionStrategySchema in global-config.ts — shared Zod schema (used by both LocalProjectConfigSchema and ProjectConfigSchema) to eliminate config drift; normalizes legacy aliases (kill-previousdelete, ignore-newignore)
  • DEFAULT_NOTIFICATION_ROUTING moved from config.tsglobal-config.ts to break circular dependency with migration.ts
  • ConfigMode type on ProjectConfig (hybrid | global-only); globalConfigPath and projectOrder on OrchestratorConfig

CLI (packages/cli)

  • ao project list — show all registered projects
  • ao project add <path> — register a directory; auto-derives ID, handles collisions; accepts --id and --name overrides
  • ao project remove <id> — unregister a project with confirmation
  • ao spawn -p/--project <id> — remote mode, works from any directory
  • In-process lifecycle manager — replaces detached ao lifecycle-worker subprocess; now runs inside ao start
  • addProjectToRunning / killRunningInstance in running-state.ts — track secondary PIDs in running.json; killRunningInstance signals all PIDs on stop
  • forcedSuffix support in spawnOrchestrator / reserveNextOrchestratorIdentity — CLI-computed suffix is honoured instead of auto-incremented

Changed

  • ao start auto-registers new hybrid projects on first run; multi-project "new orchestrator" path sets attachToRunning=true + orchestratorSessionStrategy: 'new' + orchestratorSuffix
  • Config loading pipeline (expandPaths, applyProjectDefaults, applyDefaultReactions, collectExternalPluginConfigs) — all return new objects; no in-place mutation
  • loadConfig / loadConfigWithPath reject empty project registries before returning; ZodError fallback consistent between both paths
  • validateAndCommitRegistration runs applyGlobalConfigPipeline (validates session prefix uniqueness) before saveGlobalConfig — write-after-validate pattern
  • Legacy ignore-newignore alias fixed (was erroneously mapped to new)
  • getEffectiveConfigPath synthesizes per-project virtual path in multi-project mode to prevent storage dir collision when projects share a basename

Removed

  • ao remove-project <id> — replaced by ao project remove <id>
  • ao lifecycle-worker detached subprocess — in-process replacement; stub kept for backward compatibility (exits 1 with deprecation message)

Test plan

  • ao start in a new hybrid project dir registers it automatically
  • ao project list shows registered projects
  • ao project add <path> registers; --id/--name overrides work; collision appends suffix
  • ao project remove <id> unregisters with confirmation
  • ao start with two projects that share a directory basename creates distinct storage dirs
  • ao stop terminates both the primary and secondary PIDs
  • ao lifecycle-worker prints deprecation message and exits 1

harsh-batheja added a commit to harsh-batheja/agent-orchestrator that referenced this pull request Apr 4, 2026
- Tighten SECRET_PATTERNS: replace broad /key$/i with
  /(?:api|secret|private|access|signing|encryption|auth)[-_]?key$/i
  to avoid silently excluding legitimate config fields from shadow sync
  while still matching apiKey and API_KEY variants

- ao project add: error when --id is explicitly provided but already
  taken by a different path, instead of silently suffixing the ID

- lifecycle-service: track config fingerprint per manager; restart
  stale managers when config changes rather than returning the old one

- start.ts: emit a warning when local config write fails in hybrid mode
  so users know the agent override won't persist across ao start
@harsh-batheja harsh-batheja changed the title feat: multi-project architecture — config, sessions, dashboard, CLI feat: multi-project architecture — config, sessions, CLI Apr 5, 2026
@harsh-batheja harsh-batheja force-pushed the feat/issue-813 branch 2 times, most recently from ca0e176 to d0c113e Compare April 6, 2026 09:32
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9400d9c. Configure here.

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