Skip to content

fix(kanban): constrain worktrees to configured external root - #9

Merged
cermm merged 7 commits into
mainfrom
fix/352-kanban-external-worktree-root-current-main
Aug 1, 2026
Merged

fix(kanban): constrain worktrees to configured external root#9
cermm merged 7 commits into
mainfrom
fix/352-kanban-external-worktree-root-current-main

Conversation

@cermm

@cermm cermm commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add profile-scoped kanban.worktree_root policy for canonical external worktree placement
  • derive <owner>-<repo> from remote.origin.url and persist canonical targets at task creation
  • revalidate persisted targets at dispatch/resolve boundaries and fail closed on unsafe roots, traversal, symlink escapes, repo-local paths, or wrong Git common-directory identity
  • preserve legacy behavior when the policy is unset
  • adapt the reviewed implementation to the current main dispatcher return contract

Tracks cermm/wc-infrastructure#352.

Verification

  • scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py tests/hermes_cli/test_kanban_project_link.py tests/hermes_cli/test_config.py tests/hermes_cli/test_set_config_value.py -q
    • 433 passed, 0 failed
  • python3 -m py_compile ...
  • Ruff on changed Python files: PASS
  • isolated recurrence probe: PASS; target persisted/materialized below external owner/repo namespace, repo-local target rejected
  • strict W&C worktree audit after port: 192 registrations, 0 violations

Review

Publication tip requires immutable current-main review before push/PR. Source live-base candidate b47826f3fc3754259899124ee910828724ca0ba1 previously received exact-tip PASS review. This PR tip includes the current-main compatibility commit and is reviewed separately.

Safety

This PR does not activate the live profile by itself. Live activation and rollback are tracked separately under the explicit approval in Discord message 1533028081357557790.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47bd776fba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hermes_cli/kanban_db.py
if configured_target is not None:
# Persist the final canonical target at publication time. The
# dispatcher revalidates it before any filesystem write.
insert_workspace_path = str(configured_target)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allocate distinct policy targets to decomposed children

When a worktree-backed triage card is decomposed with the policy enabled, persisting the parent-specific leaf here causes decompose_triage_task() to copy that same workspace_path into every child. The first child materializes its branch there, while subsequent children reuse the same checkout and even resolve to the first child's branch, so parallel workers can overwrite one another's results. Preserve enough source-repository identity for decomposition to derive a separate leaf for each child.

AGENTS.md reference: AGENTS.md:L54-L57

Useful? React with 👍 / 👎.

Comment thread hermes_cli/kanban_db.py
Comment on lines +5593 to +5594
repo = _project_repo_root(project_id)
if repo is not None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve source identity across profile dispatch

When a project-linked task is created under one profile and claimed by a dispatcher running another profile before its worktree exists, this lookup reads the dispatcher's per-profile projects.db, where the project need not exist. With no board default, the persisted external target is not yet a Git checkout, so every fallback fails and the task accumulates workspace spawn failures instead of dispatching; previously the persisted repo anchor made this supported cross-profile handoff independent of projects.db. Persist or otherwise resolve the source repository without consulting only the active profile's project store.

AGENTS.md reference: AGENTS.md:L84-L87

Useful? React with 👍 / 👎.

@cermm
cermm force-pushed the fix/352-kanban-external-worktree-root-current-main branch from 47bd776 to 35418dc Compare August 1, 2026 12:19
@cermm
cermm merged commit 75c0c97 into main Aug 1, 2026
36 checks passed
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.

1 participant