fix: planner formula uses $FACTORY_ROOT for per-project artifacts — causes cross-repo contamination (#541)

Replace $FACTORY_ROOT/planner/ and $FACTORY_ROOT/vault/ references with
$PROJECT_REPO_ROOT/planner/ and $PROJECT_REPO_ROOT/vault/ in the planner
formula and planner-run.sh. Planner artifacts (journal, memory, prerequisite
tree) and vault state are per-project, not factory-owned. The old paths
caused cross-repo contamination when the planner ran for non-disinto projects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-22 10:00:36 +00:00
parent 02fa38fdfd
commit db69a79b2e
2 changed files with 12 additions and 12 deletions

View file

@ -42,11 +42,11 @@ Set up the working environment for this planning run.
HEAD_SHA=$(git rev-parse HEAD) HEAD_SHA=$(git rev-parse HEAD)
echo "$HEAD_SHA" > /tmp/planner-head-sha echo "$HEAD_SHA" > /tmp/planner-head-sha
4. Read the planner memory file at: $FACTORY_ROOT/planner/MEMORY.md 4. Read the planner memory file at: $PROJECT_REPO_ROOT/planner/MEMORY.md
If it does not exist, this is the first planning run. If it does not exist, this is the first planning run.
Keep this memory context in mind for all subsequent steps. Keep this memory context in mind for all subsequent steps.
5. Read the prerequisite tree at: $FACTORY_ROOT/planner/prerequisite-tree.md 5. Read the prerequisite tree at: $PROJECT_REPO_ROOT/planner/prerequisite-tree.md
If it does not exist, create an initial tree from VISION.md in the If it does not exist, create an initial tree from VISION.md in the
update-prerequisite-tree step. update-prerequisite-tree step.
""" """
@ -234,11 +234,11 @@ Update the tree by applying these operations:
the vault see the file-at-constraints step for how to file requests. the vault see the file-at-constraints step for how to file requests.
6. **Check vault state**: Scan vault directories for procurement status: 6. **Check vault state**: Scan vault directories for procurement status:
- `$FACTORY_ROOT/vault/pending/*.md` requests awaiting human action. - `$PROJECT_REPO_ROOT/vault/pending/*.md` requests awaiting human action.
Any prerequisite that depends on a pending procurement request should Any prerequisite that depends on a pending procurement request should
be marked: `[ ] <name> blocked-on-vault (vault/pending/<id>.md)` be marked: `[ ] <name> blocked-on-vault (vault/pending/<id>.md)`
- `$FACTORY_ROOT/vault/approved/*.md` fulfilled, being processed. - `$PROJECT_REPO_ROOT/vault/approved/*.md` fulfilled, being processed.
- `$FACTORY_ROOT/vault/fired/*.md` completed. Check if the resource - `$PROJECT_REPO_ROOT/vault/fired/*.md` completed. Check if the resource
now appears in RESOURCES.md and mark the prerequisite resolved. now appears in RESOURCES.md and mark the prerequisite resolved.
- Do NOT file issues for objectives blocked on pending vault items. - Do NOT file issues for objectives blocked on pending vault items.
@ -246,7 +246,7 @@ Update the tree by applying these operations:
were not present last run. If a new resource appears, mark the were not present last run. If a new resource appears, mark the
corresponding prerequisite as resolved. corresponding prerequisite as resolved.
Write the updated tree to: $FACTORY_ROOT/planner/prerequisite-tree.md Write the updated tree to: $PROJECT_REPO_ROOT/planner/prerequisite-tree.md
Use this format: Use this format:
# Prerequisite Tree # Prerequisite Tree
@ -343,7 +343,7 @@ an issue:
for this resource (match by filename). for this resource (match by filename).
2. If no request exists, create a markdown file at: 2. If no request exists, create a markdown file at:
$FACTORY_ROOT/vault/pending/<resource-id>.md $PROJECT_REPO_ROOT/vault/pending/<resource-id>.md
Format: Format:
``` ```
@ -389,7 +389,7 @@ memory is PERIODIC.
### 1. Prerequisite tree (always — committed to git) ### 1. Prerequisite tree (always — committed to git)
Write the updated prerequisite tree to: Write the updated prerequisite tree to:
$FACTORY_ROOT/planner/prerequisite-tree.md $PROJECT_REPO_ROOT/planner/prerequisite-tree.md
This is the tree you built in the update-prerequisite-tree step. This is the tree you built in the update-prerequisite-tree step.
Include the "Last updated" comment at the top. Include the "Last updated" comment at the top.
@ -397,7 +397,7 @@ Include the "Last updated" comment at the top.
### 2. Journal entry (always — committed to git) ### 2. Journal entry (always — committed to git)
Create a daily journal file at: Create a daily journal file at:
$FACTORY_ROOT/planner/journal/$(date -u +%Y-%m-%d).md $PROJECT_REPO_ROOT/planner/journal/$(date -u +%Y-%m-%d).md
If the file already exists (multiple runs per day), append a new section If the file already exists (multiple runs per day), append a new section
with a timestamp header. with a timestamp header.
@ -444,7 +444,7 @@ Decide whether to update memory:
does not exist, perform the memory update below. does not exist, perform the memory update below.
4. Otherwise, skip the memory update MEMORY.md remains read-only context. 4. Otherwise, skip the memory update MEMORY.md remains read-only context.
When updating memory, write to: $FACTORY_ROOT/planner/MEMORY.md When updating memory, write to: $PROJECT_REPO_ROOT/planner/MEMORY.md
(replace the entire file) (replace the entire file)
Start the file with the run counter marker: Start the file with the run counter marker:

View file

@ -47,7 +47,7 @@ build_context_block VISION.md AGENTS.md RESOURCES.md planner/prerequisite-tree.m
# ── Read planner memory ───────────────────────────────────────────────── # ── Read planner memory ─────────────────────────────────────────────────
MEMORY_BLOCK="" MEMORY_BLOCK=""
MEMORY_FILE="$FACTORY_ROOT/planner/MEMORY.md" MEMORY_FILE="$PROJECT_REPO_ROOT/planner/MEMORY.md"
if [ -f "$MEMORY_FILE" ]; then if [ -f "$MEMORY_FILE" ]; then
MEMORY_BLOCK=" MEMORY_BLOCK="
### planner/MEMORY.md (persistent memory from prior runs) ### planner/MEMORY.md (persistent memory from prior runs)
@ -57,7 +57,7 @@ fi
# ── Read recent journal files ────────────────────────────────────────── # ── Read recent journal files ──────────────────────────────────────────
JOURNAL_BLOCK="" JOURNAL_BLOCK=""
JOURNAL_DIR="$FACTORY_ROOT/planner/journal" JOURNAL_DIR="$PROJECT_REPO_ROOT/planner/journal"
if [ -d "$JOURNAL_DIR" ]; then if [ -d "$JOURNAL_DIR" ]; then
# Load last 5 journal files (most recent first) for run history context # Load last 5 journal files (most recent first) for run history context
JOURNAL_FILES=$(find "$JOURNAL_DIR" -name '*.md' -type f | sort -r | head -5) JOURNAL_FILES=$(find "$JOURNAL_DIR" -name '*.md' -type f | sort -r | head -5)