Skip to content

fix(agent-task): use the caller's publication branch as given and make workspace git status/diff work - #2592

Merged
chubes4 merged 1 commit into
mainfrom
fix/runner-workspace-branch-and-git-tools
Nov 15, 2026
Merged

chubes4 merged 1 commit into
mainfrom
fix/runner-workspace-branch-and-git-tools

Conversation

@chubes4

@chubes4 chubes4 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Closes #2591.

Root causes

1. Doubled branch name. runner-workspace-publisher.mjs always built the head as ${branch_prefix}${run_id || workload.id} with no separator. docs-agent passes its docs_branch as both branch and branch_prefix, producing docs-agent/extrachill-shop-user-docsdocs-agent-user-maintenance.

2. workspace_git_status / workspace_git_diff always tool_call_failed. The sandbox executor (WP_Codebox_Sandbox_Workspace_Executor) is git-less by design and compares against a filesystem baseline from workspace_baseline_root in the executor context. Only the smoke test supplied it. WP_Codebox_Runtime_Package_Executor::sandbox_workspace_context() passes only workspace_root and writable_paths, and the seeded snapshot excludes .git/**. So in every real run both tools returned baseline_unavailable, which shows up redacted as tool_call_failed in tool_observability (Extra-Chill/extrachill runs 43732877188 and 43734927628, calls 51 and 52).

Changes

  • Branch: an explicit runner_workspace.branch (alias head_branch) is used exactly as given. Otherwise branch_prefix and the run id are joined with - unless the prefix already ends in / - _ .. The fresh-branch-when-no-open-PR rule from v0.33.4 is unchanged and appends -<base-sha-12> once to whichever head results.
  • PR body: the caller body gets a ### Changed files (N) list, with deletions marked.
  • Git tools: before a mutation tool first touches a path, the executor records that path's seed content (or that it was absent). Status and diff compare against this record when no filesystem baseline exists, and it is reset with the mutation ledger at run start. Status now returns changes (added/modified/deleted) and a summary. The diff is a real 3-context-line unified diff, not a whole-file rewrite. It takes an optional path, is capped at 256 KB, and round-trips through workspace_apply_patch.
  • Docs: docs/agent-task-reusable-workflow.md gains Publication branch, title, and body. docs/sandbox-workspace-contract.md gains Workspace status and diff tools. The README surface table links both.

Tests

  • scripts/php-sandbox-workspace-executor-smoke.php adds a production-shaped run: no .git, no baseline. It covers a clean status, then edits, an add, a delete, an identical rewrite, exact hunk text, the path filter, patch replay, and reset.
  • tests/runner-workspace-publisher.test.mjs covers explicit branch use, the separator rules, reuse and fresh-suffix on an explicit branch, and caller title plus changed-files body.
  • All scripts/php-*-smoke.php exit codes are unchanged against main.

AI assistance: Extra Chill Bot (Claude), via a Roadie subagent.

…e workspace git status/diff work

Publication branch: the head was always `branch_prefix` + workload id with no
separator, so callers passing their branch as the prefix got doubled names such
as `docs-agent/extrachill-shop-user-docsdocs-agent-user-maintenance`. An explicit
`runner_workspace.branch` (or `head_branch`) is now used exactly; otherwise the
prefix and run id are joined with `-` unless the prefix already ends in a
separator. The fresh-branch rule still appends `-<base-sha-12>` once.

PR body: WP Codebox appends a "Changed files" list to the caller body.

Git tools: workspace_git_status/workspace_git_diff required a host-supplied
`workspace_baseline_root` that no production caller provided (the seeded
snapshot also excludes `.git`), so every call failed with baseline_unavailable
-> tool_call_failed. The sandbox executor now records each path's seed content
before its first mutation and compares against that; the diff is a real
context-hunk unified diff that round-trips through workspace_apply_patch.

Closes #2591

AI assistance: Extra Chill Bot (Claude), via a Roadie subagent.
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.

Runner-workspace publication: doubled branch names, failing git status/diff tool

1 participant