fix(runtime): warn when --bare skips worktree subsystem bootstrap - #6291
Merged
Conversation
`--bare` silently skipped WorktreeManager construction and capability probing even when worktree.enabled = true, with no operator-visible signal — background sub-agents with permissions.worktree = true lost their isolation guarantee unnoticed. Emit a tracing::warn! for the enabled + bare combination and document the skip in Agent::with_bare_mode's doc comment. Closes #6256
…e-mode-warning # Conflicts: # CHANGELOG.md
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.
Summary
src/runner.rs's worktree subsystem bootstrap gate (agents_config.worktree.enabled && !exec_mode.bare) had noelsebranch for theenabled && barecombination —WorktreeManagerwas never constructed and no warning was logged either, so a config withworktree.enabled = truewas silently ignored under--bare.--bare-mode-silently-skips-a-subsystem defect class (prior instance: MagicDocs registration never fires in --bare mode despite [magic_docs] enabled=true #6127 for MagicDocs).permissions.worktree = truerunning under--barelost its worktree isolation guarantee (INV-1/INV-3,specs/063-worktree-subsystem/spec.md) with nothing surfaced to the operator — notable because--bareis the documented/recommended flag for CI/scripted sessions, exactly where this matters.Changes
src/runner.rs: added anelse if agents_config.worktree.enabled && exec_mode.barebranch emitting atracing::warn!describing the skipped isolation guarantee.WorktreeManageris still never constructed under--bareby design — that would defeat the point of--bareas a fast, dependency-light path for CI/scripting.src/runner.rs: addedbare_flag_skips_worktree_guardunit test alongside the existing sibling guard tests (bare_flag_skips_{code_indexer,scheduler,mcp_connect,gateway_spawn}_guard).crates/zeph-core/src/agent/builder.rs: updatedAgent::with_bare_mode's doc comment to list the worktree subsystem among those--bareskips.CHANGELOG.md: added aFixedentry under[Unreleased]..local/testing/playbooks/worktree.md(main repo): added Scenario 17 with reproduction steps and a negative control..local/testing/coverage-status.md(main repo): added a row for this behavior (statusUntested, pending live-session confirmation).Review notes
Went through the reduced bug-fix chain (root cause and fix were already scoped on the issue via a prior CI recommendation, so the debugger step was skipped):
crates/zeph-subagent/src/manager/spawn.rs(subagents do run unisolated under--bareexactly as the message states).bare_flagtests pass independently, no regressions. Two advisory (non-blocking) gaps noted — pre-existing test debt unrelated to this change, and an optional negative-control test — both left as follow-up suggestions, not blockers.Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml -p zeph --bins -E 'test(bare_flag)'— 9/9 passed, including the newbare_flag_skips_worktree_guardUntestedin coverage-status.md pending the next CI cycleCloses #6256