Skip to content

Make targets for individual Phase 1 subphases (phase-1a, phase-1b, phase-1c) #38

Description

@pruiz

Motivation

Currently make phase-1 runs all three subphases (1a → CodeQL → 1b → 1c) in a single orchestrated run. There is no way to run or re-run a single subphase independently. This is needed for:

  • Recovery: If Phase 1b fails mid-turn, the user must re-run the full make phase-1 which re-gates 1a (already done) and re-runs the entire chain.
  • Iteration: During development, re-running a single subphase avoids wasted work.
  • Targeted fixes: After manual edits to a specific artifact, running just the relevant subphase for validation/repair is cleaner than the full chain.
  • Debugging: Isolating subphase issues requires running them individually.

Design considerations

Runner changes (tools/codecome/phase_1.py)

run_phase_1() currently orchestrates all three subphases internally. It needs to expose individual entry points:

def run_phase_1a(args, console, rendering_ctx, runner, base_url) -> int:
    """Run Phase 1a only with gate before + after."""

def run_phase_1b(args, console, rendering_ctx, runner, base_url) -> int:
    """Run Phase 1b only (assumes 1a artifacts exist, gates that)."""

def run_phase_1c(args, console, rendering_ctx, runner, base_url) -> int:
    """Run Phase 1c only (assumes 1b artifacts exist, gates that)."""

Dispatch (tools/run-agent.py or tools/codecome/harness.py)

--phase 1a / --phase 1b / --phase 1c need to map to the right runner functions. Currently run_phase_mode in harness.py only handles --phase 1run_phase_1(). Needs to accept subphase dispatch.

Makefile targets

phase-1a: env-check
    @$(PYTHON) tools/gate-check.py 1a
    @$(PYTHON) tools/run-agent.py --phase 1a --label "Phase 1a: Target Profile" --agent recon

phase-1b: env-check
    @$(PYTHON) tools/gate-check.py 1b
    @$(PYTHON) tools/run-agent.py --phase 1b --label "Phase 1b: Detailed Reconnaissance" --agent recon --prompt-file prompts/phase-1b-recon.md

phase-1c: env-check
    @$(PYTHON) tools/gate-check.py 1c
    @$(PYTHON) tools/run-agent.py --phase 1c --label "Phase 1c: Sandbox Bootstrap" --agent recon --prompt-file prompts/phase-1c-sandbox.md

Gate changes

tools/gate-check.py already supports 1a, 1b, 1c via run_from_cli()check_phase_1a() etc. No gate changes needed.

Dependency awareness

  • make phase-1b must gate on Phase 1a artifacts (target-profile.md, build-model.md) — already handled by check_phase_1b via REQUIRED_NOTES_1B
  • make phase-1c must gate on Phase 1b artifacts — already handled by check_phase_1c
  • No automatic chaining (e.g., make phase-1b does not auto-run phase-1a)

Server lifecycle

Currently run_phase_1() starts the opencode server once and reuses it across all three subphases. Individual subphase runners would each start/stop their own server. This is acceptable — the overhead of starting the server is negligible compared to model response time.

PROMPT_EXTRA / PROMPT_EXTRA_FILE

These must be passed through to subphase runners, same as they are for the full make phase-1.

Acceptance criteria

  • make phase-1a runs only Phase 1a with gate before and after
  • make phase-1b runs only Phase 1b with gate before and after
  • make phase-1c runs only Phase 1c with gate before and after
  • make phase-1 continues to work (runs all three in sequence)
  • CODECOME_THINKING=1 PROMPT_EXTRA="..." work on all three targets
  • Existing tests pass; new tests cover subphase dispatch
  • make help lists the new targets
  • Phase 1a/1b/1c gate labels match the subphase names

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions