aws-samples / aws-samples/sample-collaborative-ai-dlc

[Bug]: Trivial single-unit intent aborts at unit-DAG promotion (units_promotion_failed / artifact_not_found)

Open
#336 2 comments 0 reactions 1 assignee Claimed by @JWThewes View on GitHub
bug
Dominant language
JavaScript
Stars
75
Forks
23
Avg merge
3d 17h
Merged PRs (30d)
24

Description

### Description

A minimal, self-contained intent (one small change) runs successfully through all 12 once-per-workflow methodology stages, but then aborts at unit-DAG promotion:

units_promotion_failed: units-generation: artifact_not_found

The `units-generation` stage exits 0 (success) yet writes no `unit-of-work-dependency` artifact to the graph. Promotion then hard-fails the whole execution because it finds nothing to promote.

Expected: a trivial intent should degenerate to a single implicit unit (the whole intent = one unit) and continue to construction — or the stage should be guaranteed to always emit at least a one-unit DAG. A stage that exits 0 without producing its declared output artifact should not silently pass and then abort the run one step later.

Root cause — two gaps combine:

1. The stage can "succeed" without producing its required artifact. On a trivial intent the model sees nothing to fan out and skips emitting the fenced-YAML `units:` DAG. The blocking `required-sections` sensor does not catch this: it validates the content of an existing artifact, so with no artifact at all there is nothing to fail on. There is no "did this stage produce its declared output artifact?" check (lambda/shared/v2-sensor-contract.js).

2. Promotion hard-fails instead of degenerating. lambda/agentcore/commands/promote-units.js:

const artifact = pickCurrentArtifact(rows);
if (!artifact) {
await event('v2.units.promotion_failed', `no current ${DAG_ARTIFACT_TYPE} artifact`);
return { ok: false, reason: 'artifact_not_found' }; // aborts the execution
}

Note a distinct `dag_absent` reason already exists for "artifact exists but has no units: block"; the trivial-intent path instead hits `artifact_not_found` (no artifact row at all).

Suggested fix (pick one or combine):

A. (preferred) Degenerate gracefully: when no DAG artifact exists (or it parses to zero units), synthesise a one-unit plan (whole intent = one unit, no deps) and continue.
B. Guarantee the stage always emits >=1 unit, and add a stage-completion sensor that fails the stage if its declared output artifact is missing — so it's caught at the stage, not one step later.
C. At minimum, surface an actionable message ("intent produced no unit plan — may be too small to fan out; proceed as a single unit?") instead of a bare failure reason.

### Steps to reproduce

1. Create a v2 project (AgentCore) on any git provider.
2. Create a new intent with a trivial, single-file scope, e.g.:
"Add a new read-only REST endpoint GET /api/health/details returning app name, UTC ISO-8601 time, and status "UP". One controller method + one unit test. No new dependencies, no DB, no changes to existing endpoints."
3. Continue to Compose and run the intent.
4. Observe: all stages report exitCode=0 (feasibility ... application-design ... units-generation), then the run fails with units_promotion_failed: units-generation: artifact_not_found.

### Logs or screenshots

_No response_

### Environment

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.