Skip to content

Regression: bounded workspace commands hang or return empty JSON at scale #1237

Description

@chubes4

Problem

Large-workspace read and cleanup commands have regressed after #948 and #964 were closed. On a workspace with roughly 170 managed worktrees, targeted and bounded commands either emit no output, overrun their declared budget, or mutate successfully without returning terminal evidence.

Reproduction

The following commands produced no output before 120-second client timeouts:

studio wp datamachine-code workspace show homeboy
studio wp datamachine-code workspace list
studio wp datamachine-code workspace hygiene
studio wp datamachine-code workspace worktree locks --format=json

Queued JSON safe cleanup returned no JSON envelope or run ID:

studio wp datamachine-code workspace cleanup safe --dry-run --format=json

Synchronous safe cleanup emitted only an initial state=applying, cycles=0 table, then exceeded a 600-second client deadline while still removing worktrees. A narrower drain declared --until-budget=120s but exceeded 300 seconds and removed additional entries without terminal JSON:

studio wp datamachine-code workspace worktree cleanup-eligible-drain \
  --apply --limit=25 --passes=10 --until-budget=120s --format=json

Impact

The operator cannot tell whether a disconnected command committed mutations, cannot recover the durable run without an emitted run ID, and is pushed toward raw Git worktrees because even workspace worktree add can fail behind the same overloaded control plane.

Expected

  • JSON commands emit an early durable run ID before expensive work.
  • Every recursive scan and child operation shares the caller budget.
  • Budget expiry returns typed partial evidence and a continuation command.
  • Read-only show/list/lock commands remain bounded independently of global reconciliation.
  • A client disconnect never leaves mutation outcome ambiguous.

Acceptance criteria

  • Exercise 150+ worktrees with slow Git/database probes.
  • Each command returns or yields a durable continuation inside its declared budget.
  • Tests prove successful partial mutation is recoverable after output interruption.
  • Existing primary, dirty, unpushed, live, and open-PR protections remain fail-closed.

Related

AI assistance

OpenAI GPT-5.6 Sol via OpenCode reproduced the commands, captured timing and mutation evidence, deduplicated prior trackers, and drafted this issue under Chris Huber's direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions