Opus 4.8 agentic coding: agent executes a defined process OUT OF ORDER — produces downstream artifacts and edits code before the mandated Step 0 prerequisites, then proposes to "start" Step 0 after the fact
Resolved 💬 2 comments Opened Jun 19, 2026 by Mig-Sornrakrit Closed Jun 22, 2026
Summary
Given a task that says "follow the documented N-step workflow," the agent (Claude Code, Opus 4.8) does the steps out of their defined order. The workflow explicitly designates a foundational Step 0 prerequisite ("do X first; no later step counts until X is done") and an ordering rule ("no code change before the reference/baseline for that behavior exists"). The agent:
- Skipped Step 0.
- Produced a pile of downstream artifacts (a test plan, a case registry, a pipeline doc, status updates) and even made code edits to the engine/UI.
- Reported all of it as progress.
- Then, when the ordering was pointed out, proposed to "now start Step 0."
Starting the mandatory first step after having already built everything that was supposed to depend on it is incoherent — and it means the downstream artifacts and code changes were created on an unestablished foundation, untied to any baseline.
Repro (generic)
- Repo has a documented process whose first step is a foundational prerequisite (enrollment/setup/registration) and whose ordering rule forbids editing code before a reference baseline exists.
- User: "start the onboarding + pipeline + the N-step workflow."
- Agent jumps to producing plans/registries and edits source files, marks items "done," and writes a confident summary.
- User challenges the order. Agent admits it never did Step 0 and proposes to start it now — i.e., bottom-up after the fact.
Why this matters
- The prerequisite step exists precisely so the later steps are valid/tracked. Doing it last makes the earlier output unverifiable and frequently rework.
- Code was changed before any baseline/reference existed to validate the change against, directly violating the process's stated ordering rule.
- "I'll now start [the first step]" after claiming downstream progress is a logic error that signals the agent is pattern-matching "produce artifacts" instead of executing the process as a sequenced plan with gates.
Expected behavior
- Before doing any step, the agent should read the whole process, identify the Step 0 / prerequisite and any ordering rules, and execute in that order — not opportunistically produce whatever is easy first.
- It should refuse to make code changes that the process says require a prior baseline/reference, and say so, rather than doing them and reporting progress.
- If it catches itself out of order, the correction is to stop and re-sequence, explicitly separating what is salvageable from what was built on an unestablished foundation — not to casually "start the first step now" as if nothing is wrong.
Suggested guardrails
- When a referenced process defines ordering (Step 0 / "X before Y" / "no edit before baseline"), enforce it: block the later action and surface the missing prerequisite instead of proceeding.
- Plan the whole sequence up front (dependency-aware) before executing any step; don't emit artifacts for step N while step 0 is undone.
- On a detected ordering violation, do a re-sequencing pass (what's valid / what must be redone) rather than continuing forward from the wrong point.
Environment
- Claude Code, model Opus 4.8 (1M context), agentic coding session on Windows.
- Same session/theme as #69491 and #69499 (unverified self-reported progress; this report is specifically the out-of-order execution facet).
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗