Skip to content

Exclude contract state from SDLC PRs - #302

Closed
james-in-a-box[bot] wants to merge 1 commit into
mainfrom
egg/fix-contract-in-pr
Closed

james-in-a-box[bot] wants to merge 1 commit into
mainfrom
egg/fix-contract-in-pr

Conversation

@james-in-a-box

@james-in-a-box james-in-a-box Bot commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Remove .egg-state/ contract files from PR branches before PR creation

What happened (PR #300)

PR #300 was opened for issue #262 containing only the SDLC contract
state file (.egg-state/contracts/262.json) with no implementation
code. Here's the full chain of events:

  1. SDLC pipeline initialized egg/issue-262 branch, committing the
    contract file to track pipeline state across workflow runs
  2. Refine phase completed — analysis posted to issue, human approved
  3. Each phase transition (refine→plan, plan→implement) committed
    contract updates to the branch via sdlc-hitl.yml
  4. Implement phase was dispatched but the agent failed immediately
    ("exit code: unknown") before writing any implementation code
  5. Despite the failure, a PR was created containing only the 3
    contract commits — no implementation code at all

Root cause: The .egg-state/contracts/*.json file is committed to
issue branches as the pipeline's state persistence mechanism. Since
this file doesn't exist on main, it appears in every PR diff. There
was no step to clean it up before PR creation, and no guard to prevent
PR creation when there's no implementation code.

Changes

sdlc-pipeline.yml — Added a Remove contract state from branch
step in the create-pr job that runs git rm -r .egg-state/ before
the agent creates the PR. This ensures contract state never appears
in the PR diff.

build-sdlc-prompt.sh — Two changes:

  • PR phase prompt: Added verification steps — agent must confirm
    the branch contains actual implementation code (not just contract
    state) before creating the PR. If .egg-state/ wasn't already
    cleaned up by the workflow step, the agent is instructed to remove
    it. If there's no implementation code, the agent should report the
    problem instead of creating an empty PR.
  • Implement phase prompt: Strengthened the "no PR creation"
    restriction with an explanation of why — PRs are created in a
    separate phase after implementation is verified complete, and
    creating one prematurely results in incomplete PRs with only
    contract state.

Issue: #262

Test plan:

  • Verify that the create-pr job removes .egg-state/ before the agent runs
  • Run a full SDLC pipeline through to PR creation and confirm the PR diff contains only implementation code
  • Verify implement phase agent does not create PRs prematurely

Authored-by: egg

@james-in-a-box james-in-a-box Bot closed this Feb 8, 2026
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.

0 participants