Skip to content

Prompt templates emit 33 repo-relative .hive-manager paths that resolve against the wrong root in a worktree #284

Description

@rdfitted

Summary

Prompt templates emit 33 repo-relative .hive-manager/{session_id}/… paths. Session artifacts (plan, tools,
coordination log, prompts) live in the main checkout at <project_path>/.hive-manager/{session_id}/, but almost
every agent runs with its CWD set to a worktree. A relative path therefore resolves against the wrong root.

This is the sibling of #280 (which covers .ai-docs/). It was found while planning #280 and deliberately kept out of
that issue's scope.

The correct pattern already exists in the same file

build_queen_master_prompt resolves the session root and emits absolute paths:

// src-tauri/src/session/controller.rs:6313-6316
let session_root = Self::session_root_path(project_path, session_id);
let plan_path = Self::prompt_path(&session_root.join("plan.md"));
let tools_dir = Self::prompt_path(&session_root.join("tools"));
let coordination_log_path = Self::prompt_path(&session_root.join("coordination.log"));

Five builders already bind session_root: :5027, :5273, :6313, :6652, :7118.

The clearest defect: build_swarm_queen_prompt binds session_root at :7118 and then still prints relative
paths at :7175-7176 and :7194. The value is in scope and unused.

Other relative sites include :4856, :4879, :4917, :4963, :4977, :5105-5106, :5147, :5156, :5163,
:5546, :5616, :5674, :5879, :6145, :7033, :7049, :7216, :7251, :7296, :7319.

This is triage, not find-replace

Not all 33 are wrong. At least one is correctly worktree-relative:

controller.rs:7072
Each worker's own task file path inside its worktree is `.hive-manager/tasks/worker-N-task.md`.

That path is worktree-local and must stay relative. Any fix must first classify every one of the 33 as
main-checkout (must become absolute) or worktree-local (correctly relative). That classification has not been
done — sizing this issue is the first task, not an assumption.

Two more sites need a judgement call rather than a mechanical fix:

  • :6864.ai-docs/learnings.jsonl appears as a prohibition, and .hive-manager/{session_id}/learnings.pending.jsonl
    as a fallback write target "in this workspace". Which root that means is exactly the ambiguity this issue is about.
  • :4237, :4251 — peer handoff files (milestone-ready.json, qa-verdict.json) that agents wait on. If the
    reader and writer disagree about the root, the wait never resolves.

Acceptance criteria

  • Every one of the 33 references is classified main-checkout vs worktree-local, and the classification is recorded
  • Main-checkout references render absolute via the session_root_path + prompt_path pattern at :6313
  • Worktree-local references (e.g. :7072) remain relative, deliberately and with a comment saying why
  • build_swarm_queen_prompt uses the session_root it already binds at :7118
  • Prompt tests assert the absolute form at the changed sites and would fail on a regression to relative
  • The peer-handoff paths at :4237/:4251 are confirmed consistent between the waiting reader and the writer

Related

Provenance

Found during Master Planner reconnaissance for the #276-#283 wave (session f7ef70f5). Operator decision on
2026-09-06 was to file rather than fold into the #280 task, because the class is only partly understood and a
half-applied fix is worse than none.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions