Skip to content

feat(instances): enforce active limits, follow cwd sync, and quicktemp lifecycle#306

Open
Microck wants to merge 1 commit intoasheshgoplani:mainfrom
Microck:microck/instances-follow-cwd-and-limits
Open

feat(instances): enforce active limits, follow cwd sync, and quicktemp lifecycle#306
Microck wants to merge 1 commit intoasheshgoplani:mainfrom
Microck:microck/instances-follow-cwd-and-limits

Conversation

@Microck
Copy link
Contributor

@Microck Microck commented Mar 7, 2026

  • What changed

    • Added instances config support for:
      • follow_cwd_on_attach
      • quick_default_path
      • max_active_sessions
      • max_active_sessions_policy (warn|deny|close_oldest)
    • Added session.EnforceActiveSessionLimit(...) and applied it in both TUI and CLI flows:
      • TUI create/fork/restart
      • CLI launch, session start, session restart, session fork, try
    • Added quick default path fallback in quick/no-path creation paths (TUI + CLI).
    • Completed quicktemp lifecycle:
      • AutoDeleteOnClose persisted in storage/migration data model
      • close/delete semantics updated so temporary sessions clean metadata automatically
      • periodic cleanup path handles already-dead temp sessions.
    • Added discoverability and UX updates:
      • richer close confirmation messaging for temporary sessions
      • help text updated for quicktemp behavior
      • settings panel now includes editable INSTANCE BEHAVIOR controls.
  • Why

    • Makes session behavior predictable and configurable across both UI and CLI.
    • Prevents unbounded active-session growth with explicit policy handling.
    • Aligns quicktemp behavior with user expectation (temporary means auto-cleanup).
    • Reduces config friction by surfacing instance controls directly in Settings.
  • Behavior notes

    • follow_cwd_on_attach now updates project path from tmux pane path after attach return and during polling.
    • max_active_sessions:
      • warn: proceed + warning
      • deny: block operation
      • close_oldest: kill oldest active session then continue.
    • quick_default_path is used when no group/session context path is available.
    • Temporary sessions (AutoDeleteOnClose) skip undo/recent-session restoration paths when auto-removed.
  • Tests

    • Added/updated tests for:
      • instance settings parse/getters
      • active-session limit policies (warn/deny/close_oldest/exclude)
      • CLI warning composition + quick default path resolution
      • quicktemp close/delete behavior and skip-undo semantics
      • confirm dialog and settings panel coverage for new instance behavior controls.
    • Validation run:
      • go test ./...
  • Config delta

config_delta:
  affordances:
    - add: "Editable instance behavior controls in Settings panel"
    - add: "Active-session policy enforcement in TUI and CLI flows"
    - add: "Quick default path fallback for no-context session creation"
    - modify: "Temporary session close semantics to auto-delete metadata"
  invariants:
    - add: "When active-session limit is configured, start/create/fork/restart obey configured policy"
    - strengthen: "Quicktemp sessions removed via auto-delete do not populate undo/recent lists"
    - strengthen: "Project path follow uses normalized absolute directory paths only"
  constraints:
    - add: "max_active_sessions <= 0 means unlimited"
    - add: "policy defaults to warn for empty/invalid values"
  rationale:
    - "Unify behavior across TUI and CLI to avoid policy bypass paths"
    - "Expose controls in UI so users do not need manual TOML edits"
  enforcement:
    - conformance: "internal/session/instance_test.go (policy tests)"
    - conformance: "internal/ui/home_test.go and internal/ui/settings_panel_test.go"
    - conformance: "cmd/agent-deck/cli_utils_test.go"

Add instance-level session limits, follow-cwd path syncing, quick-default path fallback, and quicktemp auto-delete cleanup across TUI and CLI flows.

Surface the new behavior in settings/help/confirm dialogs and add coverage for limits, config parsing, and quicktemp delete semantics.
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