Skip to content

Incomplete artifacts marked as "done" after workflow interruption #1084

@jiehu03

Description

@jiehu03

Problem

When a workflow (/opsx:propose, /opsx:ff, etc.) is interrupted mid-execution, partially-written artifact files remain on disk. On re-execution, the system detects these files and marks the artifacts as status: "done", causing the workflow to skip them — leaving the change in an inconsistent state with incomplete artifacts that cascade into poor downstream output.

Root Cause

detectCompleted() in src/core/artifact-graph/state.ts uses artifactOutputExists() which only checks file existence (fs.statSync / glob match). No content validation is performed — an empty or half-written file is treated identically to a complete one.

Reproduction

  1. Run /opsx:propose "add-dark-mode"
  2. Interrupt after proposal.md is created but before content is fully written
  3. Re-run /opsx:continue on the same change
  4. openspec status --json reports proposal as status: "done" → workflow skips it

Impact

  • Stuck workflows — no clean way to resume after interruption
  • Cascading quality degradation — downstream artifacts built on incomplete context
  • Silent failure — no warning or error is produced
  • Only workaround is manually finding and deleting the incomplete files

Affected Code

  • src/core/artifact-graph/state.tsdetectCompleted(), isArtifactComplete()
  • src/core/artifact-graph/outputs.tsartifactOutputExists(), resolveArtifactOutputs()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions