From db69a79b2e43a18a9b783514c91936dc132c193a Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 22 Mar 2026 10:00:36 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20planner=20formula=20uses=20$FACTORY=5FRO?= =?UTF-8?q?OT=20for=20per-project=20artifacts=20=E2=80=94=20causes=20cross?= =?UTF-8?q?-repo=20contamination=20(#541)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- formulas/run-planner.toml | 20 ++++++++++---------- planner/planner-run.sh | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/formulas/run-planner.toml b/formulas/run-planner.toml index 5e1111e..2777a2c 100644 --- a/formulas/run-planner.toml +++ b/formulas/run-planner.toml @@ -42,11 +42,11 @@ Set up the working environment for this planning run. HEAD_SHA=$(git rev-parse HEAD) 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. 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 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. 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 be marked: `[ ] ⏳ blocked-on-vault (vault/pending/.md)` - - `$FACTORY_ROOT/vault/approved/*.md` — fulfilled, being processed. - - `$FACTORY_ROOT/vault/fired/*.md` — completed. Check if the resource + - `$PROJECT_REPO_ROOT/vault/approved/*.md` — fulfilled, being processed. + - `$PROJECT_REPO_ROOT/vault/fired/*.md` — completed. Check if the resource now appears in RESOURCES.md and mark the prerequisite resolved. - 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 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: # Prerequisite Tree @@ -343,7 +343,7 @@ an issue: for this resource (match by filename). 2. If no request exists, create a markdown file at: - $FACTORY_ROOT/vault/pending/.md + $PROJECT_REPO_ROOT/vault/pending/.md Format: ``` @@ -389,7 +389,7 @@ memory is PERIODIC. ### 1. Prerequisite tree (always — committed to git) 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. 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) 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 with a timestamp header. @@ -444,7 +444,7 @@ Decide whether to update memory: does not exist, perform the memory update below. 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) Start the file with the run counter marker: diff --git a/planner/planner-run.sh b/planner/planner-run.sh index 2b3294c..d90caf3 100755 --- a/planner/planner-run.sh +++ b/planner/planner-run.sh @@ -47,7 +47,7 @@ build_context_block VISION.md AGENTS.md RESOURCES.md planner/prerequisite-tree.m # ── Read planner memory ───────────────────────────────────────────────── MEMORY_BLOCK="" -MEMORY_FILE="$FACTORY_ROOT/planner/MEMORY.md" +MEMORY_FILE="$PROJECT_REPO_ROOT/planner/MEMORY.md" if [ -f "$MEMORY_FILE" ]; then MEMORY_BLOCK=" ### planner/MEMORY.md (persistent memory from prior runs) @@ -57,7 +57,7 @@ fi # ── Read recent journal files ────────────────────────────────────────── JOURNAL_BLOCK="" -JOURNAL_DIR="$FACTORY_ROOT/planner/journal" +JOURNAL_DIR="$PROJECT_REPO_ROOT/planner/journal" if [ -d "$JOURNAL_DIR" ]; then # 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)