Skip to content

[681] Keep the tracked .bot tree out of the shared git exclude - #689

Open
EnmaJim wants to merge 2 commits into
andresharpe:mainfrom
EnmaJim:fix/keep-workspace-state-git-tracked
Open

[681] Keep the tracked .bot tree out of the shared git exclude#689
EnmaJim wants to merge 2 commits into
andresharpe:mainfrom
EnmaJim:fix/keep-workspace-state-git-tracked

Conversation

@EnmaJim

@EnmaJim EnmaJim commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Linked issue

Closes #681

Summary of changes

Ensure-DotbotWorktreeExcludes resolves its target with git rev-parse --git-path info/exclude, which git answers from the shared common directory — so the marker block written on every task worktree creation also applied to the operator's main checkout. Its entries for .bot/workspace/tasks, .bot/content, .bot/hooks and .bot/settings ignored trees dotbot documents as tracked: git add .bot/workspace/tasks/ became a silent no-op, run state accumulated invisibly, and FrameworkIntegrity's git status scan passed over three of its protected paths. This PR takes those entries out of the shared block, suppresses the generated copies from inside the worktree instead, and teaches dotbot doctor to report the condition rather than pass silently.

  • Drop .bot/workspace/tasks, .bot/content/, .bot/hooks/ and .bot/settings/ from the exclude marker block, leaving only generated, never-tracked paths; affected repos self-heal on their next task because the block is rewritten in place
  • Suppress the generated content/, hooks/ and settings/ copies with a nested .gitignore in each, which cannot reach the main checkout
  • Add a WORKSPACE TRACKING section to dotbot doctor that runs git check-ignore -v over the five tracked trees, names the responsible rule as file:line:pattern, and resolves back to the main repository via git rev-parse --git-common-dir so it reports identically from either checkout
  • Stop discarding the task-state git add in Complete-TaskWorktree: capture its output, check the exit code, and log a warning instead of sending stderr to $null
  • Fix Restore-DotbotTaskStateBackup passing -LiteralPath to New-Item, which is not a valid parameter and threw as soon as the task tree was visible to git again
  • Cover all of the above in Test-Components.ps1 and record the change in CHANGELOG.md

Testing notes

  • Exclude fixture: seed .git/info/exclude with the legacy block, add a worktree, run Ensure-DotbotWorktreeExcludes, then assert git check-ignore reports .bot/workspace/tasks and .bot/content unignored while generated .mcp.json stays ignored
  • Same fixture asserts a plain git add .bot/workspace/tasks/ (no -f) stages a new run file, matching how Complete-TaskWorktree stages state
  • E2E: run doctor.ps1 against a live task worktree's .bot and assert it does not flag the worktree's own generated .gitignore files
  • Source guard asserts no .bot/ tracked-tree entry returns to the exclude block
  • Issue repro: after a workflow run, .git/info/exclude no longer contains .bot/workspace/tasks/, and git status -- .bot/workspace/tasks shows the accumulated run directories instead of reporting clean

Checklist

  • Tests added or updated
  • Docs updated (if behaviour changed)
  • Linked issue exists
  • Follows the contribution guide

Ensure-DotbotWorktreeExcludes writes to the common-dir
  .git/info/exclude, which is shared with the operator main checkout, so the .bot/workspace/tasks, .bot/content, .bot/hooks and .bot/settings entries
  silently ignored tracked files in the project itself. Drop those entries and scope the worktree-local suppression to a nested .gitignore inside the
  generated content, hooks and settings copies instead.

Complete-TaskWorktree now logs a warning when staging task state fails rather than discarding
  git output, and doctor reports any workspace tree that is still ignored along with the rule responsible.

Refs: andresharpe#681
The WORKSPACE TRACKING section walked the path it was handed, so
  running doctor from a task worktree inspected that worktree's generated .gitignore files and flagged the tracked .bot tree as hidden. It now maps back
  to the main repository via git rev-parse --git-common-dir, reporting identically from either checkout, and the E2E worktree test asserts the clean
  result.

Refs: andresharpe#681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

Worktree setup writes .bot/workspace/tasks/ into the main repo's .git/info/exclude

1 participant