Repository navigation
feat(workflow): workflow summary <run_id> end-of-run message - #119
Conversation
adlc-workspace#66: a run that ended left no message saying how it ended or which MR/PR it opened; since the lane has no completion gate, #151's thread never showed adlc-workspace!166. `adlc-cli workflow summary <run_id> [--json]` builds one message from the run's own files (state.json, inputs.json, log.jsonl, trace events): the outcome and duration, the failing step and its error (the step with its own error, not an `if` around a rejected gate), every MR/PR link of every step, the conclusion (execute's wins), each gate's answer and who gave it, one line per step, and resumes. Step text is redacted, one line and capped; the whole text fits one chat message. No network. A gate that takes its verdict from an input now records `answered_by` from ADLC_ANSWERED_BY (a plain id only), so the summary can name the approver. Refs adlc-workspace#66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… per supplied verdict Security review of a9f8541: - a gate line comes only from a step the engine logged as `gate`; any other step can write choice/answered_by to its own output; - the summary text escapes & < > and breaks @here/@channel/@everyone, so step text cannot become chat links, mentions or broadcasts (the JSON fields keep the cleaned values); - a gate credits ADLC_ANSWERED_BY only when its verdict input was supplied in this run/resume call (StepContext.suppliedInputs), not for a verdict kept from an earlier call. Refs adlc-workspace#66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed
|
…first logged type wins Security review of 55631f7: - a gate records ADLC_ANSWERED_BY only when it was paused before this call and its verdict input was supplied now: a verdict preset at the start, or one a second gate shares, is not credited; - the answerer may not start with "@" (gate and summary) and is escaped in the summary text, so it can never render as a mention; - the summary takes a step's first logged type; a later log line cannot turn a step into a gate. Refs adlc-workspace#66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed
The summary tests now pass 17 of 17. Full |
…log.jsonl Security review: log.jsonl is not a trust source (anything in the workspace can append to it). Gate lines now come only from the run copy of the definition (runs/<id>/workflow.yml), the file the engine executes and resumes from, via the engine's own gateStepIds. No readable copy: no gate lines. log.jsonl stays an ordering hint. Also: resumes are counted from log.jsonl (a paused or interrupted end with entries after it), not from trace events, which are sampled and were absent on a real paused-and-resumed run. A test now runs a real pause and resume and checks the summary. Refs adlc-workspace#66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed
The summary tests pass 19 of 19. Full |
…e gate keys Security review: the run copy of the definition is as writable as the log, and walking it does not match runtime ids (fan-out, loops). The engine already records each step's type in its result (state.json step_results[<id>].type, keyed by the runtime id); a gate line now needs `type === "gate"` there. The definition walker is gone; log.jsonl stays an ordering hint. `choice`, `answered_by` and `auto_passed` are reserved in step output, so no agent or shell step can supply a gate's fields. Refs adlc-workspace#66 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed
What's left to forge is the engine's own The summary tests pass 20 of 20, including a real pause and resume through the engine. Full |
itaior
left a comment
There was a problem hiding this comment.
factory-review verdict — PR #119 workflow summary <run_id>
Outcome: 🟢 merge-ready — no Important findings open. Nits below are advisory only.
Reviewed revision: head=e5956276df2211193b16a2e5292215af3c7e21ed · base b2f7db89b433447dc1cc593be40115de3a8dd06c · merge-base b2f7db89b433447dc1cc593be40115de3a8dd06c
Scope: 10 files, +742/−1. Read from detached checkout at exact head SHA, not the rendered diff.
Checked
- bugs —
cleanFieldguards non-strings,readJson/readLinesfail-closed to null/[],formatDurationguards non-finite/negative, resume counting readslog.jsonldefensively,conclusion/failed_stepselection logic matches PR description (execute-wins, own-error-first). No null-deref, off-by-one, or leak paths found. - security — Gate-line trust anchor is the engine-recorded
step_results[<id>].type === "gate"(notlog.jsonl, not the definition copy, not step output);choice/answered_by/auto_passedare reserved inreadStepOutputso agent/shell steps cannot forge them;answered_byrequires all of: verdict-from-input + supplied-now + gate-was-paused + plain-id regex that rejects a leading@; rendered text escapes&<>and breaks@here/@channel/@everyone; step text redacted viaredactSecrets, one line, per-field + whole-text caps; links http(s)-only, deduped, max 10. Each hardening has a failing-before test (S2/S5/S6). - spec-compliance — Matches the issue goal as scoped by the PR body: outcome + duration + issue/dispatch + failing step + MR/PR links + conclusion + per-gate answers + per-step lines + resume count, no network calls (ADR-416 direction), caps fit one chat message. Explicitly out of scope (MR head/CI status, Slack posting) is declared, not silently dropped.
- test-integrity — New
tests/workflow-summary.test.mjs(20 tests) only adds assertions; no existing assertion weakened.agent.mjsreserved-key change rejects whole files that smuggle gate fields (fail-closed, consistent with existing reserved-key behaviour);blocked:conclusion still read from raw file so refusal paths are preserved. - ci-integrity — No workflow files touched. CI green on this head (all listed checks pass); full
npm testin checkout: 1138/1142, the 4 failures are the same target-branch tests that fail on cleanmain. - quality (Nit) — naming/length/complexity within norms; see advisory nits.
Not checked
- Live Slack rendering of the zero-width-space mention break (unit-tested, not rendered in a real client).
- Performance of
buildRunSummaryon very largelog.jsonl(linear scan; acceptable for a report path).
Nits (advisory, non-blocking)
- 💬
summary.mjs:types[id]fromlog.jsonlstill populatesstep.typefor display while the gate decision correctly uses onlyr.type— consider not surfacing log-derived types at all so display and decision can never diverge. - 💬
summary.mjs:conclusionkeeps the last non-execute conclusion — a run with severalconclusionfields reports only the last; fine for the stated contract, worth one line in help text if multi-conclusion runs exist.
Evidence
- Intent: PR body (Why/What/Not-in-this-PR) + linked issue
adlc-workspace#66. - Execution:
tests/workflow-summary.test.mjs20/20 in checkout; full suite 1138/1142 with only the 4 pre-existingmainfailures; CI checks green on heade595627.
Refs https://gitlab.tikalk.dev/tikalk/engineering/agentic-sdlc/adlc-workspace/-/issues/66
Why
When a run ends, nothing says how it ended or which MR/PR it opened. The Argo lane has no completion gate any more (ADR-531-amendment-1). So #151 run
1b997ae3opened adlc-workspace!166, and its Slack thread never showed the link. The issue owner asked to see the opened MR/PR in Slack. As decided at triage, the engine builds the summary from run state, and the agentic-container runtime only forwards it in the run thread, in a follow-up there (ADR-414/416).What changes
adlc-cli workflow summary <run_id> [--json]insrc/workflow/summary.mjs, wired incommands/workflow.mjs,dispatch.mjsandhelp.mjs. It builds one message from the run's own files:state.json,inputs.json,log.jsonland the trace events. It makes no network calls. The message covers:ifwrapper around a rejected gate.mr_url, plusmr_urlssplit on spaces and commas), http(s) only, each listed once, at most 10;execute's wins);(auto)for an auto-passed gate;redactSecrets, kept on one line and capped at 300 characters per field. The whole text is capped at 3000 characters, so it fits one Slack message.--jsonprints the same data plustext.answered_byfromADLC_ANSWERED_BY, plain ids only (^[A-Za-z0-9._@-]{1,64}$). The runtime already sets that variable for question answers, and the follow-up sets it for gate answers too.Example output for the #181 drill run:
Not in this PR
workflow summaryonce, after the terminal status, in the run thread; setADLC_ANSWERED_BYon gate resumes.Tests
tests/workflow-summary.test.mjswith 10 tests:--jsonoutput and exit 1 for a missing run;npm test: 1128 of 1132 pass. The 4 failures are the same target-branch tests that fail on a cleanmainhere.🤖 Generated with Claude Code