_apply_plan() fails to match target root directory from plan paths #76
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: archeious/luminos#76
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root Cause Analysis
Symptom
When running luminos against
luminos_lib/, the planning pass correctly identified it as a priority directory withsuggested_turns: 20, but the dir loop received only 10 turns (the default). The plan's allocation was silently ignored.Root cause
_apply_plan()builds a lookup table mapping relative paths to absolute paths:When
dis the target directory itself,os.path.relpath(target, target)returns".". So the lookup table has{".": "/abs/path/to/luminos_lib", ...}.But the planner sees the directory tree rendered by
render_tree(), which showsluminos_lib/as the root label (usingos.path.basename(target)). The planner naturally uses"luminos_lib"as the path in its plan output. The key"luminos_lib"doesn't exist inrel_to_abs(it's stored as"."), so theif rel in rel_to_abscheck fails silently, and the directory falls through to the default tier.Why it's silent
_apply_plan()deliberately ignores unknown paths in the plan (to handle planner hallucinations gracefully). This means a legitimate path mismatch looks identical to a hallucinated path. No warning is logged.The
.vs basename inconsistencyThe codebase already knows about this:
_build_dir_loop_context()normalizes"."toos.path.basename(target)for display purposes (ai.py:1035). The tree renderer usesbasename(target)as the root label. But_apply_plan()doesn't apply this normalization in its lookup, creating a mismatch between what the planner sees and what the orchestrator expects.Fix
In
_apply_plan(), add the basename alias when the relative path is".":This makes both
"."and"luminos_lib"resolve to the same absolute path. The planner can use either form and the match succeeds.Also consider logging a warning when a plan path doesn't match any known directory, so future mismatches are visible rather than silent.
Impact
Any investigation where the target root directory appears in the plan (priority, shallow, or skip) will have its allocation silently ignored. This is most visible on small targets where the root is the most important directory.
Discovered in
Smoke test of Phase 3 (PR #75). Plan allocated 20 turns to
luminos_lib, orchestrator gave it 10.