Skip to content

Flow B: coder PR change-description + faster security review - #44

Closed
elamaran11 wants to merge 2 commits into
dark-factory-autonomous-agent-coding-patternfrom
feat/coder-pr-change-description
Closed

Flow B: coder PR change-description + faster security review#44
elamaran11 wants to merge 2 commits into
dark-factory-autonomous-agent-coding-patternfrom
feat/coder-pr-change-description

Conversation

@elamaran11

Copy link
Copy Markdown
Contributor

Flow B improvements: PR change-description + faster security review

Two Dark Factory (Flow B) improvements, both requested during the live dry-run.

1. Coder emits a PR change-description (reviewer request)

The coder now writes a concise, reviewer-facing description of what it changed (and why) to artifacts/description.md as part of its run, and the PR body renders it as a ### 📝 Changes section above the existing verification block.

  • claude path: instruction appended to the prompt.
  • kiro path: same instruction appended to SPEC.md.
  • PR body: the Changes section sits before the <!-- dark-factory:status --> marker, so status.js (which rewrites from the marker down) preserves it on every status update.
  • Falls back to a neutral line if the coder produced no description (body never empty).

2. Security review no longer blocks ~15 min after the result is known

Observed in the dry-run: the AWS Security Agent App bot posts "No issues identified" on the PR, but our headless security-agent.sh step kept polling IN_PROGRESS for the full timeout because the job's status field flips to COMPLETED long after findings are ready.

  • Early-exit: each poll iteration now also probes list-findings; the moment it returns a well-formed result, we proceed — no waiting for the status flip. (Reuses those findings; no re-fetch.)
  • Graceful timeout: this step is advisory (the App bot posts the authoritative result regardless), so exceeding the timeout now posts a neutral pending status + a pointer to the bot comment, instead of a misleading red error.
  • Side effect: the sticky status board (which depends on the security step) is now rewritten with accurate rows within seconds instead of ~15 min later.

Note on rollout

Change #1 is in the coder image (entrypoint.js) → takes effect once the coder image is rebuilt/pushed. Change #2 is a hub-side ConfigMap script → live on ArgoCD sync of dark-factory-hub.

Verification

  • node --check on entrypoint.js + status.js; sh -n on security-agent.sh.
  • Changes section verified to render above the status marker (preserved by status.js).

Generated with Claude Code.

Per reviewer request: the coder now writes a concise, reviewer-facing description
of WHAT it changed (and why) to artifacts/description.md as part of its run, and the
PR body renders it as a '### 📝 Changes' section ABOVE the existing verification
block. Falls back to a neutral line if absent so the body is never empty.

- claude path: description instruction appended to the prompt.
- kiro path: same instruction appended to SPEC.md (kiro reads --spec).
- PR body: new Changes section placed before the <!-- dark-factory:status --> marker,
  so status.js (which rewrites from the marker down) preserves it on every update.

node --check passes.
Two fixes for the 'security review waits ~15 min while the PR already shows a
result' problem:

1. Early-exit: the code-review job's status field flips to COMPLETED long AFTER the
   AWS Security Agent App bot has already posted its findings on the PR. So in
   addition to polling status, each iteration now probes list-findings; the moment
   it returns a well-formed result (findingsSummaries present) we proceed — no
   waiting for the status flip. Reuses those findings for the report (no re-fetch).

2. Graceful timeout: this step is advisory (the App bot posts the authoritative
   result regardless), so exceeding the poll timeout now posts a neutral 'pending'
   status + a pointer to the bot comment, instead of a misleading red 'error'.

This also fixes the stale sticky board: the sticky-status step depends on
security-agent (runs once, after it), so a fast security step means the board is
rewritten with accurate rows within seconds instead of ~15 min later.

sh -n passes.
@elamaran11

Copy link
Copy Markdown
Contributor Author

Consolidated into #41 (flow-d-lambda-microvm-sandbox) per request — the coder PR-description + security-agent early-exit commits are cherry-picked there.

@elamaran11 elamaran11 closed this Jul 30, 2026
@elamaran11
elamaran11 deleted the feat/coder-pr-change-description branch July 30, 2026 21:56
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.

1 participant