Skip to content

Targeted worktree get and finalize commands hang on a clean managed worktree #964

Description

@chubes4

Problem

Targeted DMC lifecycle commands hung during a Homeboy PR finalization handoff on a clean, pushed managed worktree. This prevented Homeboy from reading and recording DMC finalizer metadata after it opened the PR.

Observed with Data Machine Code 0.53.6 on macOS/WordPress Studio.

Reproduction

Managed worktree:

From the Studio site root, run:

studio wp datamachine-code workspace worktree get wp-codebox@perf-2135-canonical-restore-pack --format=json --path=/Users/chubes/Studio/intelligence-chubes4

Observed: no output; caller timeout killed it after 120 seconds.

Then run:

studio wp datamachine-code workspace worktree finalize wp-codebox@perf-2135-canonical-restore-pack --pr=https://github.com/Automattic/wp-codebox/pull/2142 --path=/Users/chubes/Studio/intelligence-chubes4

Observed: no output; caller timeout killed it after 300 seconds.

The worktree remained clean, and direct git status --short --branch returned immediately. GitHub confirmed the PR was open at exact head 0cae6497c10fc4c7daad95ed1ef20d2a32b43e8f.

Expected

  • worktree get should return the one requested row within a bounded deadline.
  • worktree finalize should either persist and return lifecycle metadata or fail with a bounded, actionable error.
  • A timeout/interruption must expose whether metadata committed before the caller was terminated.
  • Homeboy should be able to complete DMC bookkeeping after PR publication without an unbounded CLI process.

Source evidence

  • WorkspaceCommand::WORKTREE_OPERATIONS maps get to datamachine-code/workspace-worktree-list.
  • WorkspaceCommand::worktree() forces include_status=true for get.
  • WorkspaceWorktreeLifecycle::worktree_list() calls count_unpushed_commits($wt_path) without a timeout for that targeted row.
  • datamachine_code_is_targeted_workspace_read_cli_request() recognizes only workspace show, not workspace worktree get, so the targeted read does not receive the side-effect-free bootstrap treatment.
  • worktree_finalize() bounds its dirty Git probe, then writes lifecycle metadata and upserts inventory; the overall CLI call still had no externally observable completion within five minutes.

Relevant installed-source locations:

  • data-machine-code.php:55-63
  • inc/Cli/Commands/WorkspaceCommand.php:45-49,4146-4154
  • inc/Workspace/WorkspaceWorktreeLifecycle.php:528-586,822-932

Acceptance criteria

  • Add a true targeted handle lookup that avoids scanning unrelated workspace state.
  • Apply explicit deadlines to every Git/database/runtime step reachable from targeted get and finalize.
  • Emit bounded progress or phase diagnostics identifying the blocking step.
  • Add regression coverage for a clean pushed worktree with a PR URL.
  • Prove both commands complete under a deterministic wall-clock bound in a large-workspace fixture.

Context

Homeboy cook: agent-task-040917dd-8e78-4ef4-abf5-6e052784e1de. All code/test gates passed and PR creation succeeded; only the DMC metadata handoff remained unverified.

AI assistance

OpenAI openai/gpt-5.6-sol via OpenCode gathered the command evidence, inspected the installed DMC source, checked for duplicate issues, and drafted this report. Chris Huber reviewed and filed it.

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