Repository navigation
Description
Problem
The SDLC pipeline's implement phase fails to execute, leaving the PR with only the contract file and no actual implementation. This was observed in PR #300 / workflow run for issue #262.
Root Causes
1. Bug in populate-contract-tasks.py — comment parsing breaks on multiline bodies
get_issue_comments() uses gh api --jq ".[].body" which outputs raw string values with embedded newlines. It then splits the output by "\n":
return [body for body in result.stdout.strip().split("\n") if body.strip()]This breaks each multi-line comment body into individual lines. find_plan_comment() looks for a single entry containing both [TASK- and ## Phase:
def find_plan_comment(comments: list[str]) -> str | None:
for comment in reversed(comments):
if "[TASK-" in comment and ("## Phase" in comment or "Phase 1:" in comment):
return comment
return NoneSince those markers are on different lines of the plan comment, no individual "line-comment" ever matches both conditions, so the plan is never found.
Fix: Use a JSON-aware approach to fetch comments (e.g., --jq '.[].body' | jq -Rs or fetch as JSON array and parse in Python).
2. Contract fields empty after plan phase — acceptance_criteria, phases, decisions not populated
The plan phase agent posts a structured plan as a markdown comment but does not update the contract JSON. The contract still shows:
{
"acceptance_criteria": [],
"phases": [],
"decisions": []
}These fields are supposed to be populated by populate-contract-tasks.py at the start of the implement phase, but due to bug #1 above, that never succeeds. Even if bug #1 is fixed, populate-contract-tasks.py only populates phases (with tasks) — it does not populate acceptance_criteria or decisions.
The plan phase should populate these contract fields before advancing to implement. At minimum, populate-contract-tasks.py should also extract acceptance criteria and decisions from the plan, or the plan phase itself should update the contract.
3. Implement step skipped entirely when populate-contract-tasks.py fails
The "Populate contract tasks from plan" step does not have continue-on-error: true. When it fails, the subsequent "Run egg implementer" step is skipped. The agent never gets a chance to implement anything.
Even if the populate step fails, the implementer should arguably still run (perhaps with a warning), rather than the entire implement phase being aborted.
4. PR only contains the contract file
Because the implement step never runs, the PR (#300) only contains .egg-state/contracts/262.json with empty fields. The PR description is also very sparse ("Draft PR for SDLC pipeline implementation") and doesn't reflect the actual planned work.
Expected Behavior
-
Plan phase populates the contract: When the plan phase completes, the contract should have populated
acceptance_criteria,phases(with tasks), anddecisionsfields. -
Implement phase runs the agent: The
populate-contract-tasks.pyscript should correctly parse multi-line plan comments from the issue. If the contract already has phases/tasks (populated during the plan phase), it should skip population gracefully. -
PR includes actual implementation: After the implement phase, the PR should contain the code changes implementing the plan, not just the contract file.
-
PR description reflects the work: The PR description should be updated to reflect the implemented changes, not remain as a generic placeholder.
Suggested Changes
action/populate-contract-tasks.py
- Fix
get_issue_comments()to correctly handle multi-line comment bodies (use JSON parsing instead of newline splitting) - Extract and populate
acceptance_criteriafrom the plan comment - Handle the case where phases/tasks are already populated in the contract
action/build-sdlc-prompt.sh (plan phase)
- Instruct the plan phase agent to update the contract with acceptance criteria, phases, and decisions using the contract CLI
- Or: have the plan phase workflow step populate the contract from the plan comment before advancing
.github/workflows/sdlc-pipeline.yml (implement job)
- Consider adding error handling so the implement step can still run even if contract population encounters issues
- Ensure the PR description is updated with meaningful content after implementation
Reproduction
- Label an issue with
egg-sdlc - Approve through refine → plan phases
- Observe that the contract has empty
acceptance_criteria,phases,decisionsafter plan approval - Observe that the implement phase fails at "Populate contract tasks from plan" with "No plan document found in issue comments"
- The PR only contains the contract file
References
- Failed workflow run: https://github.com/jwbron/egg/actions/runs/21791947310/job/62872789070
- PR [SDLC] Refine the SDLC human plan review workflow #300: [SDLC] Refine the SDLC human plan review workflow #300
- Contract file on branch:
.egg-state/contracts/262.json(onegg/issue-262) - Bug is in:
action/populate-contract-tasks.py:31-58andaction/populate-contract-tasks.py:85-92
Activity
james-in-a-box commentedon Feb 8, 2026
Additional finding: PR created prematurely by init job
The
initjob insdlc-pipeline.yml(lines 211-257) creates a draft PR before the implement phase runs, whenevercurrent_phase == 'implement'. At that point the branch only contains the contract JSON, so the PR is opened with just the contract file and a generic placeholder description.The implement step runs in a separate job after init — and in this case it failed entirely, leaving the PR with only the contract.
If the intent is that the agent should open a PR only after implementation is complete, the "Create or find draft PR" step should be moved out of
initand into a post-implementation step (or into thefinalize-prjob). Alternatively, if a draft PR is intentionally created early as a landing spot, the description should be updated after implementation completes.— Authored by egg
jwbron commentedon Feb 8, 2026
@james-in-a-box put together a plan of action for this issue and add it to this issue
james-in-a-box commentedon Feb 8, 2026
Plan of Action
Based on analysis of the codebase, here is the prioritized plan to fix the SDLC implement phase failures:
Fix 1: Comment Parsing in
populate-contract-tasks.py(P0 — Blocking)Problem:
get_issue_comments()at line 50 splits on"\n", breaking multi-line comment bodies into individual lines. Thefind_plan_comment()function then fails because[TASK-and## Phasemarkers are on different lines.Solution: Fetch comments as JSON and parse properly in Python.
Files:
action/populate-contract-tasks.py:31-50Fix 2: Extract Acceptance Criteria in
populate-contract-tasks.py(P1)Problem:
populate-contract-tasks.pyonly populatesphaseswith tasks. Theacceptance_criteriaanddecisionsfields remain empty.Solution: Extend the script to extract acceptance criteria from the plan comment. The plan template includes an exit criteria section per phase that can be used.
Add after task population (around line 144):
Files:
action/populate-contract-tasks.py(add extraction logic around line 144)Fix 3: Graceful Degradation for Implement Phase (P1)
Problem: The "Populate contract tasks from plan" step fails without
continue-on-error, causing the entire implement phase to be skipped.Solution: Add error handling so the implementer still runs with a warning.
In
.github/workflows/sdlc-pipeline.ymlaround line 322:Then add a warning step after:
Files:
.github/workflows/sdlc-pipeline.yml:322-340Fix 4: Defer PR Creation Until Implementation (P2)
Problem: The init job creates a draft PR before implementation runs (lines 211-257), resulting in a PR with only the contract file when implement fails.
Solution: Move PR creation from
initto a post-implementation step. Two options:Option A (Recommended): Move PR creation to the
implementjob, after the agent runs successfully.Option B: Keep early PR creation but update the description to clarify it's a placeholder, and add a step in
finalize-prto update the PR body with implementation details.For Option A, remove lines 211-257 from init and add to implement job after the agent step:
Files:
.github/workflows/sdlc-pipeline.yml:211-257(init),:342-357(implement)Fix 5: Plan Phase Should Populate Contract (P2 — Enhancement)
Problem: The plan phase posts a markdown comment but doesn't update the contract JSON. This creates a dependency on
populate-contract-tasks.pyworking correctly.Solution: Add a step in the plan job to populate the contract after the agent posts the plan. This makes the implement phase more robust.
After the plan agent runs (around line 928), add:
Files:
.github/workflows/sdlc-pipeline.yml:929-950(add after validate-plan step)Implementation Order
Testing Plan
egg-sdlclabel[TASK-X-Y]markerspopulate-contract-tasks.pycorrectly parses multi-line comments (Fix 1)— Authored by egg
james-in-a-box commentedon Feb 8, 2026
egg finished successfully. View run logs
jwbron commentedon Feb 8, 2026
@james-in-a-box open a pr for each of these fixes: #304 (comment)
Fix comment parsing to handle multiline bodies
Fix comment parsing to handle multiline bodies
Extract acceptance criteria from plan document
Add graceful degradation for contract task population
Defer PR creation until after implementation succeeds
Populate contract from plan comment in plan phase
james-in-a-box commentedon Feb 8, 2026
PRs Created for Plan of Action
I've created the following PRs to address the issues identified in the plan of action:
Fix 1: Comment Parsing (P0 — Critical)
PR #307: Fix multiline comment parsing in populate-contract-tasks.py
Fixes the root cause where
get_issue_comments()was splitting multiline comments on\n, breaking thefind_plan_comment()function.Fix 2: Extract Acceptance Criteria (P1)
PR #308: Extract acceptance criteria from plan document
Extends
populate-contract-tasks.pyto extract and populate theacceptance_criteriafield from exit criteria and test strategy sections.Fix 3: Graceful Degradation (P1)
PR #309: Add graceful degradation for implement phase task population
Adds
continue-on-error: trueto the task population step so the implementer still runs even if population fails.Fix 4: Defer PR Creation (P2)
PR #311: Defer PR creation until after implementation succeeds
Moves PR creation from the init job to the implement job, ensuring PRs contain actual implementation code.
Fix 5: Plan Phase Populates Contract (P2)
PR #312: Populate contract from plan comment in plan phase
Adds a step to the plan job that populates the contract before advancing to implement, providing redundancy.
Recommended Merge Order
— Authored by egg
james-in-a-box commentedon Feb 8, 2026
egg finished successfully. View run logs
Populate contract from plan comment in plan phase (#312)
Defer PR creation until after implementation succeeds (#311)
Fix comment parsing to handle multiline bodies (#307)