You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: inc/Abilities/WorkspaceAbilities.php
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1283,7 +1283,7 @@ private function registerAbilities(): void {
1283
1283
'datamachine-code/workspace-worktree-add',
1284
1284
array(
1285
1285
'label' => 'Add Workspace Worktree',
1286
-
'description' => 'Create a git worktree for a branch under `<repo>@<branch-slug>`. Branches are created off the supplied `from` ref (default `origin/HEAD`) when they do not yet exist locally. When `inject_context` is true (default), the originating site\'s composed AGENTS.md is made visible to OpenCode: symlinked into the worktree root when no repo-owned AGENTS.md exists, otherwise added via local OpenCode instructions so both files load. Site agent memory is snapshotted into `.claude/CLAUDE.local.md`, and injected paths are added to the worktree\'s per-checkout `info/exclude`. When `bootstrap` is true (default), submodule init plus root or one-level nested package-manager/composer installs run after creation so the worktree is immediately test/build-ready; set false to create a bare checkout.',
1286
+
'description' => 'Create a git worktree for a branch under `<repo>@<branch-slug>`. Branches are created off the supplied `from` ref (default `origin/HEAD`) when they do not yet exist locally. Creation fails closed when remote freshness cannot be verified; set `allow_unverified_freshness=true` only for intentional offline work. When `inject_context` is true (default), the originating site\'s composed AGENTS.md is made visible to OpenCode: symlinked into the worktree root when no repo-owned AGENTS.md exists, otherwise added via local OpenCode instructions so both files load. Site agent memory is snapshotted into `.claude/CLAUDE.local.md`, and injected paths are added to the worktree\'s per-checkout `info/exclude`. When `bootstrap` is true (default), submodule init plus root or one-level nested package-manager/composer installs run after creation so the worktree is immediately test/build-ready; set false to create a bare checkout.',
1287
1287
'category' => 'datamachine-code-workspace',
1288
1288
'input_schema' => array(
1289
1289
'type' => 'object',
@@ -1312,6 +1312,10 @@ private function registerAbilities(): void {
1312
1312
'type' => 'boolean',
1313
1313
'description' => 'Bypass the staleness gate. When false (default), any branch/base behind the remote default branch is refused, and a new worktree more than `datamachine_worktree_stale_threshold` commits behind upstream is rolled back with a staleness error. Set true to opt in to a known-stale checkout.',
1314
1314
),
1315
+
'allow_unverified_freshness' => array(
1316
+
'type' => 'boolean',
1317
+
'description' => 'Bypass the fetch-failure freshness gate. When false (default), worktree creation is refused if remote freshness cannot be verified. Set true only for intentional offline work with local refs.',
1318
+
),
1315
1319
'rebase_base' => array(
1316
1320
'type' => 'boolean',
1317
1321
'description' => 'After creating the worktree, rebase onto the upstream tip (the branch\'s @{upstream} for existing branches, origin/<base> for new branches off a local base). Default false. On rebase conflicts the rebase is aborted; the worktree stays at its pre-rebase state and `rebase_succeeded: false` is surfaced.',
@@ -1354,7 +1358,7 @@ private function registerAbilities(): void {
1354
1358
),
1355
1359
'fetch_failed' => array(
1356
1360
'type' => 'boolean',
1357
-
'description' => 'Present only when the pre-create `git fetch origin` failed. Worktree creation continues either way; staleness fields are omitted when true.',
1361
+
'description' => 'Present only when the pre-create `git fetch origin` failed and allow_unverified_freshness=true allowed creation to continue. Staleness fields are omitted when true.',
1358
1362
),
1359
1363
'fetch_error' => array(
1360
1364
'type' => 'string',
@@ -3535,6 +3539,8 @@ public static function worktreeAdd( array $input ): array|\WP_Error {
if ( $fetch_failed && ! $allow_unverified_freshness ) {
246
+
returnnew \WP_Error(
247
+
'worktree_freshness_unverified',
248
+
'Refusing to create worktree because remote freshness could not be verified. Retry after connectivity is restored, or pass allow_unverified_freshness=true only when intentionally working offline with stale local refs.',
0 commit comments