Skip to content

Audit and harden behavior with multiple Agent Code instances open #147

Closed

Description

@Juliusolsson05

Problem

Agent Code has mainly been used/tested with one app instance open. We need to verify what happens when multiple Agent Code instances are running at the same time against the same app state, workspace files, session files, debug logs, proxy logs, and indexes.

I suspect this may currently break or corrupt state.

Questions

  • What happens if 2-4 Agent Code instances are open?
  • Do they race on workspace persistence?
  • Do they race on session indexes or restore state?
  • Do Claude/Codex transcript tails behave correctly?
  • Do debug/feed/proxy logs get corrupted or interleaved?
  • Does the worktree activity index handle concurrent refresh/write?
  • Should we support multi-instance, or enforce single-instance?

Desired Outcome

Choose and implement a clear policy:

  • allow multiple instances safely, or
  • enforce a single-instance app lock, or
  • allow multiple windows through one primary process.

Tasks

  • Audit all app-state/userData write paths.
  • Identify shared JSON/log/index files written by the app.
  • Test multiple simultaneous app instances.
  • Add file locking, per-instance namespacing, atomic writes, or single-instance enforcement.
  • Add thick WHY comments near the app bootstrap/storage policy.

Acceptance Criteria

  • Running multiple instances is either safe or intentionally blocked.
  • Shared state files cannot be corrupted by concurrent app processes.
  • Session restore behavior remains deterministic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions