diff --git a/.github/workflows/opencode-documentation-review.yml b/.github/workflows/opencode-documentation-review.yml index fe0b755..39840ad 100644 --- a/.github/workflows/opencode-documentation-review.yml +++ b/.github/workflows/opencode-documentation-review.yml @@ -354,6 +354,7 @@ jobs: --effective-policy "$RUNNER_TEMP/effective-policy.json" --provenance "$RUNNER_TEMP/resolved-agentic-provenance.json" --response-diagnostics "$RUNNER_TEMP/opencode-response-diagnostics.json" + --publication-preview "$RUNNER_TEMP/agentic-publication-preview.json" ) if [[ "$FAIL_IF_REVIEWED" == "true" ]]; then review_args+=(--fail-if-reviewed) @@ -400,5 +401,6 @@ jobs: ${{ runner.temp }}/effective-policy.json ${{ runner.temp }}/resolved-agentic-provenance.json ${{ runner.temp }}/opencode-response-diagnostics.json + ${{ runner.temp }}/agentic-publication-preview.json retention-days: 14 if-no-files-found: ignore diff --git a/.github/workflows/opencode-issue-feedback.yml b/.github/workflows/opencode-issue-feedback.yml index 57c7d6f..34a4f79 100644 --- a/.github/workflows/opencode-issue-feedback.yml +++ b/.github/workflows/opencode-issue-feedback.yml @@ -309,6 +309,7 @@ jobs: --resolved-config "$RUNNER_TEMP/resolved-agentic-configuration.json" --effective-policy "$RUNNER_TEMP/effective-policy.json" --provenance "$RUNNER_TEMP/resolved-agentic-provenance-$issue_number.json" + --publication-preview "$RUNNER_TEMP/agentic-publication-preview-$issue_number.json" ) if [[ "$DRY_RUN" == "true" ]]; then feedback_args+=(--dry-run) @@ -330,5 +331,6 @@ jobs: ${{ runner.temp }}/effective-policy.json ${{ runner.temp }}/resolved-agentic-provenance.json ${{ runner.temp }}/resolved-agentic-provenance-*.json + ${{ runner.temp }}/agentic-publication-preview-*.json retention-days: 14 if-no-files-found: ignore \ No newline at end of file diff --git a/.github/workflows/opencode-release-project-review.yml b/.github/workflows/opencode-release-project-review.yml index c580283..58df9f0 100644 --- a/.github/workflows/opencode-release-project-review.yml +++ b/.github/workflows/opencode-release-project-review.yml @@ -428,6 +428,7 @@ jobs: --target-token-forwarded "$RELEASE_TARGET_TOKEN_FORWARDED" --repo-root "$GITHUB_WORKSPACE/release-target" --provenance "$RUNNER_TEMP/resolved-agentic-provenance.json" + --publication-preview "$RUNNER_TEMP/agentic-publication-preview.json" ) if [[ "$DRY_RUN" == "true" ]]; then args+=(--dry-run) @@ -448,5 +449,6 @@ jobs: ${{ runner.temp }}/effective-policy.json ${{ runner.temp }}/release-metadata.json ${{ runner.temp }}/resolved-agentic-provenance.json + ${{ runner.temp }}/agentic-publication-preview.json retention-days: 14 if-no-files-found: ignore \ No newline at end of file diff --git a/docs/configuration.md b/docs/configuration.md index 9e32231..c373134 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -21,6 +21,12 @@ For field-by-field definitions and complete bundle-file examples, see the `validate_only` does not invoke a model or write to GitHub. `dry_run` can invoke the model but cannot publish. The two modes are mutually exclusive. +For a dry run that generates feedback, download the workflow's +short-retention `resolved-invocation-*` artifact. Its +`agentic-publication-preview*.json` file contains the validated payload that +would have been posted: the review body and inline comments, an issue comment, +or a release-readiness issue. No preview file is written for `validate_only`, +model/contract failures, or a release review that decides `NO_ISSUE`. ## Pathway 1: supplied `default` profile diff --git a/docs/operations/operations-guide.md b/docs/operations/operations-guide.md index 88435fe..e71bc6c 100644 --- a/docs/operations/operations-guide.md +++ b/docs/operations/operations-guide.md @@ -55,6 +55,12 @@ failures that occur before a complete record exists, the runner emits a minimal redacted attempted-resolution record with `result: "failed"` and a non-secret error message. +For a feedback-generating `dry_run`, the same short-retention artifact also +includes `agentic-publication-preview*.json`. This is the validated payload +that publication would use (the comment/review/issue body, plus any inline +review comments). Treat it as workflow output with the same access controls as +the target content; it intentionally is not included in redacted provenance. + The configuration digest backs the v2 idempotency marker. A configuration change (different profile, manifest hash, prompt template hash, output contract, or model profile) produces a different digest, which triggers a diff --git a/scripts/run_agentic_feedback.py b/scripts/run_agentic_feedback.py index b07ecec..c90f9d2 100644 --- a/scripts/run_agentic_feedback.py +++ b/scripts/run_agentic_feedback.py @@ -633,6 +633,12 @@ def main(argv: list[str] | None = None) -> int: default=None, help="Path to write safe structural diagnostics for the model response", ) + parser.add_argument( + "--publication-preview", + type=Path, + default=None, + help="Path to write the validated GitHub publication payload during a dry run", + ) parser.add_argument("--pr-metadata", type=Path, help="Verified PR metadata JSON") parser.add_argument("--base-ref", help="Trusted base SHA/ref used for context blobs") parser.add_argument("--head-ref", help="Fetched untrusted PR-head ref used for context blobs") @@ -853,6 +859,20 @@ def main(argv: list[str] | None = None) -> int: file=sys.stderr, ) if args.dry_run: + if args.publication_preview: + args.publication_preview.write_text( + json.dumps( + { + "kind": "pull-request-review", + "body": f"{marker}\n{summary}", + "comments": comments, + }, + sort_keys=True, + indent=2, + ) + + "\n", + encoding="utf-8", + ) print( f"Dry run: would post agentic review with {len(comments)} inline comment(s).\n" f"{marker}\n{summary}", @@ -908,6 +928,19 @@ def main(argv: list[str] | None = None) -> int: ) return 1 if args.dry_run: + if args.publication_preview: + args.publication_preview.write_text( + json.dumps( + { + "kind": "issue-comment", + "body": f"{marker}\n{published_body}", + }, + sort_keys=True, + indent=2, + ) + + "\n", + encoding="utf-8", + ) print( f"Dry run: would post agentic feedback.\n{marker}\n{published_body}", ) diff --git a/scripts/run_agentic_release_project_review.py b/scripts/run_agentic_release_project_review.py index 1c6b820..2999977 100644 --- a/scripts/run_agentic_release_project_review.py +++ b/scripts/run_agentic_release_project_review.py @@ -1171,6 +1171,21 @@ def _cmd_review(args: argparse.Namespace) -> int: # CREATE_ISSUE: search for the idempotency marker before creating. if args.dry_run: + if args.publication_preview: + args.publication_preview.write_text( + json.dumps( + { + "kind": "issue", + "title": decision["title"], + "body": f"{marker}\n{decision['body']}", + "labels": decision["labels"], + }, + sort_keys=True, + indent=2, + ) + + "\n", + encoding="utf-8", + ) print( f"Dry run: would create one release-readiness issue in {target_repository}.\n" f"{marker}\ntitle: {decision['title']}" @@ -1329,6 +1344,12 @@ def _build_parser() -> argparse.ArgumentParser: ) review.add_argument("--focus", default=None) review.add_argument("--dry-run", action="store_true") + review.add_argument( + "--publication-preview", + type=Path, + default=None, + help="Path to write the validated issue payload during a dry run.", + ) review.add_argument("--provenance", type=Path, default=None) return parser diff --git a/tests/test_run_agentic_release_project_review.py b/tests/test_run_agentic_release_project_review.py index 96609dc..a708a11 100644 --- a/tests/test_run_agentic_release_project_review.py +++ b/tests/test_run_agentic_release_project_review.py @@ -835,6 +835,7 @@ def test_create_issue_publishes_exactly_one_issue(self) -> None: with tempfile.TemporaryDirectory() as tmp: tmp_path = Path(tmp) bundle, policy, metadata = self._write_inputs(tmp_path) + preview_path = tmp_path / "preview.json" create_output = json.dumps( { "decision": "CREATE_ISSUE", @@ -910,6 +911,7 @@ def test_dry_run_does_not_publish(self) -> None: with tempfile.TemporaryDirectory() as tmp: tmp_path = Path(tmp) bundle, policy, metadata = self._write_inputs(tmp_path) + preview_path = tmp_path / "preview.json" create_output = json.dumps( { "decision": "CREATE_ISSUE", @@ -924,7 +926,9 @@ def test_dry_run_does_not_publish(self) -> None: mock.patch.object(RUNNER, "_search_existing_marker") as m_search, mock.patch.object(RUNNER, "_create_issue") as m_create, ): - rc = RUNNER.main(self._args(tmp_path, bundle, policy, metadata, dry_run=True)) + args = self._args(tmp_path, bundle, policy, metadata, dry_run=True) + args.extend(["--publication-preview", str(preview_path)]) + rc = RUNNER.main(args) self.assertEqual(rc, 0) m_access.assert_not_called() m_search.assert_not_called() @@ -932,6 +936,15 @@ def test_dry_run_does_not_publish(self) -> None: prov = json.loads((tmp_path / "prov.json").read_text()) self.assertEqual(prov["mode"], "dry-run") self.assertEqual(prov["result"], "generated") + self.assertEqual( + json.loads(preview_path.read_text()), + { + "body": mock.ANY, + "kind": "issue", + "labels": ["release-readiness"], + "title": "Missing rollback", + }, + ) def test_contract_violation_rejected(self) -> None: with tempfile.TemporaryDirectory() as tmp: