Repository navigation
fix(agent-task): use the caller's publication branch as given and make workspace git status/diff work - #2592
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2591.
Root causes
1. Doubled branch name.
runner-workspace-publisher.mjsalways built the head as${branch_prefix}${run_id || workload.id}with no separator. docs-agent passes itsdocs_branchas bothbranchandbranch_prefix, producingdocs-agent/extrachill-shop-user-docsdocs-agent-user-maintenance.2.
workspace_git_status/workspace_git_diffalwaystool_call_failed. The sandbox executor (WP_Codebox_Sandbox_Workspace_Executor) is git-less by design and compares against a filesystem baseline fromworkspace_baseline_rootin the executor context. Only the smoke test supplied it.WP_Codebox_Runtime_Package_Executor::sandbox_workspace_context()passes onlyworkspace_rootandwritable_paths, and the seeded snapshot excludes.git/**. So in every real run both tools returnedbaseline_unavailable, which shows up redacted astool_call_failedin tool_observability (Extra-Chill/extrachill runs 43732877188 and 43734927628, calls 51 and 52).Changes
runner_workspace.branch(aliashead_branch) is used exactly as given. Otherwisebranch_prefixand 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.bodygets a### Changed files (N)list, with deletions marked.changes(added/modified/deleted) and asummary. The diff is a real 3-context-line unified diff, not a whole-file rewrite. It takes an optionalpath, is capped at 256 KB, and round-trips throughworkspace_apply_patch.docs/agent-task-reusable-workflow.mdgains Publication branch, title, and body.docs/sandbox-workspace-contract.mdgains Workspace status and diff tools. The README surface table links both.Tests
scripts/php-sandbox-workspace-executor-smoke.phpadds 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.mjscovers explicit branch use, the separator rules, reuse and fresh-suffix on an explicit branch, and caller title plus changed-files body.scripts/php-*-smoke.phpexit codes are unchanged against main.AI assistance: Extra Chill Bot (Claude), via a Roadie subagent.