Skip to content

worker_plan: represent plan_raw.json as InitialPlanRawTask#666

Merged
neoneye merged 1 commit intomainfrom
refactor/initial-plan-raw-external-task
May 3, 2026
Merged

worker_plan: represent plan_raw.json as InitialPlanRawTask#666
neoneye merged 1 commit intomainfrom
refactor/initial-plan-raw-external-task

Conversation

@neoneye
Copy link
Copy Markdown
Member

@neoneye neoneye commented May 3, 2026

Summary

plan_raw.json is supplied by the caller before the pipeline starts. Three tasks needed to read it (SetupTask, PromptAdherenceTask, ScreenPlanningPromptTask), and each was reaching directly into the run dir with self.run_id_dir / FilenameEnum.INITIAL_PLAN_RAW.value. SetupTask additionally hand-rolled an existence check; the two diagnostic tasks listed SetupTask in requires() purely for ordering even though neither read plan.txt.

This PR introduces InitialPlanRawTask — a luigi.ExternalTask that exposes plan_raw.json as a Luigi target — and routes all three consumers through it.

  • SetupTask now requires(InitialPlanRawTask); the manual FileNotFoundError check is gone (Luigi's ExternalTask.complete() already gates on file existence).
  • ScreenPlanningPromptTask swaps its SetupTask dependency for InitialPlanRawTask — it never used plan.txt.
  • PromptAdherenceTask swaps the 'setup' requires entry for 'plan_raw' — same reason.

Consumer code becomes PlanFile.load(self.input().path) instead of building the path manually.

Test plan

  • Run a full pipeline end-to-end and confirm plan.txt, screen_planning_prompt.json, and prompt_adherence_raw.json are still produced.
  • Delete plan_raw.json from a fresh run dir and confirm Luigi reports the external dependency as not satisfied (instead of the old FileNotFoundError).

🤖 Generated with Claude Code

`plan_raw.json` is supplied by the caller before the pipeline runs.
Three tasks needed to read it:

- `SetupTask` (always, to produce `plan.txt`)
- `PromptAdherenceTask` (wants the bare prompt)
- `ScreenPlanningPromptTask` (wants the bare prompt)

Each was reaching directly into the run directory:

    raw_path = self.run_id_dir / FilenameEnum.INITIAL_PLAN_RAW.value

with `SetupTask` additionally hand-rolling its own existence
check. Both `PromptAdherence` and `ScreenPlanningPrompt` listed
`SetupTask` in `requires()` purely for ordering, even though
neither actually consumed `plan.txt`.

Introduce `InitialPlanRawTask` (`luigi.ExternalTask`) that
exposes `plan_raw.json` as a Luigi target. Consumers now go
through the DAG:

    def requires(self):
        return self.clone(InitialPlanRawTask)

    def run_with_llm(self, llm):
        plan_file = PlanFile.load(self.input().path)
        plan_prompt = plan_file.plan_prompt

`SetupTask`'s manual `FileNotFoundError` check is removed —
Luigi's `ExternalTask.complete()` already gates the pipeline on
the file's existence. `PromptAdherenceTask` swaps its `'setup'`
requires entry for `'plan_raw'`, dropping the unused dependency
on the formatted `plan.txt`.
@neoneye neoneye merged commit ff2aa85 into main May 3, 2026
3 checks passed
@neoneye neoneye deleted the refactor/initial-plan-raw-external-task branch May 3, 2026 14:46
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