Skip to content

Add safe output items manifest for audit trail#16842

Merged
pelikhan merged 14 commits intomainfrom
copilot/update-safe-output-logging
Feb 19, 2026
Merged

Add safe output items manifest for audit trail#16842
pelikhan merged 14 commits intomainfrom
copilot/update-safe-output-logging

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

  • Create actions/setup/js/safe_output_manifest.cjs - JavaScript helper that logs each created GitHub item to a JSONL manifest file at /tmp/safe-output-items.jsonl
  • Create actions/setup/js/safe_output_manifest.test.cjs - 22 tests for the manifest helper (including staged mode tests)
  • Modify actions/setup/js/safe_output_unified_handler_manager.cjs - staged mode, manifest logging, finally block
  • Modify actions/setup/js/safe_output_handler_manager.cjs - add manifest logging (this is the script the compiled workflows actually call)
  • Modify pkg/workflow/compiler_safe_outputs_job.go - Add upload-artifact step with if: always(); skip step entirely in staged mode
  • Modify pkg/cli/audit_report.go / audit_report_render.go - Parse and display "Created Items" table in audit output
  • Add SafeItemsCount stats to gh aw logs command
  • Run make recompile to update all 152 lock files
  • Fix: createManifestLogger() now touches file immediately so it always exists before processing starts
  • Fix: isStaged before try block + finally to guarantee ensureManifestExists() runs even on handler failure
  • Fix: Add scanner.Err() check in Go JSONL scan loop
  • Fix: Correct timestamp assertion in test to use Date.parse()
  • Fix: Add 6 Go unit tests for extractCreatedItemsFromManifest
  • Fix: Add 📝 Manifest: logged <type> → <url> debug logging when items are written
Original prompt

Update the safe output JavaScript handlers such that every create item in GitHub is logged in a JSONL manifest file and uploaded as an artifact (/tmp/safe-output-items.jsonl) . Uploads always.

The goal of this artifact is to be able to audit the trail of AW and generate item reliably.

Also record the temporary id if any.

One entry per generated item.

Create a JavaScript helper function that can be used by the safe output handlers. Make it easily testable.

Update audit command to download this artifact and display a table with URLs to the user.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.


Changeset

  • Type: patch
  • Description: Log safe output creations to the new JSONL manifest artifact and surface the created-items table during audit report generation

Generated by Changeset Generator



✨ PR Review Safe Output Test - Run 22187312231

💥 [THE END] — Illustrated by Smoke Claude


Changeset

  • Type: patch
  • Description: Log safe output creations to the new manifest artifact and surface the created-items table during audit reports

Generated by Changeset Generator



✨ PR Review Safe Output Test - Run 22190175158

💥 [THE END] — Illustrated by Smoke Claude


Changeset

  • Type: patch
  • Description: Log created safe output items to the manifest artifact and surface the created-items table in gh aw audit output.

Generated by Changeset Generator



✨ PR Review Safe Output Test - Run 22190930520

💥 [THE END] — Illustrated by Smoke Claude

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update safe output handlers to log created items in JSONL Add safe output items manifest for audit trail Feb 19, 2026
Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot handle staged mode

@pelikhan
Copy link
Contributor

@copilot logs command should show aggregate stats in result like number of GitHub items created by safe outputs (safe items)

@pelikhan pelikhan marked this pull request as ready for review February 19, 2026 15:03
Copilot AI review requested due to automatic review settings February 19, 2026 15:03
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 19, 2026

@copilot handle staged mode

Done in 79656df. In staged mode (GH_AW_SAFE_OUTPUTS_STAGED === "true"): the manifest logger is not created, ensureManifestExists() is not called in any code path, and extractCreatedItemFromResult explicitly rejects results with staged: true.

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke macOS ARM64 is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

🧪 Smoke Project is now testing project operations...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

🧪 Smoke Temporary ID is now testing temporary ID functionality...

@github-actions
Copy link
Contributor

📰 DEVELOPING STORY: Smoke macOS ARM64 reports failed. Our correspondents are investigating the incident...

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an auditable trail of GitHub items created by safe output handlers by logging each created item into a JSONL manifest, uploading it as an artifact, and surfacing it in gh aw audit as a “Created Items” table (and in --json output).

Changes:

  • Introduces a JS manifest helper (safe_output_manifest.cjs) plus unit tests to append created-item entries to /tmp/safe-output-items.jsonl.
  • Extends the unified safe output handler manager to invoke an onItemCreated callback and ensure the manifest file exists for upload.
  • Updates the safe outputs job compiler and workflow lock files to always upload the manifest artifact, and updates the audit command to parse/render created items.

Reviewed changes

Copilot reviewed 152 out of 152 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
actions/setup/js/safe_output_manifest.cjs New helper to write created-item JSONL entries and normalize handler results into manifest entries.
actions/setup/js/safe_output_manifest.test.cjs Adds Vitest coverage for manifest logger, ensure-file behavior, and result extraction.
actions/setup/js/safe_output_unified_handler_manager.cjs Adds optional onItemCreated callback plumbing and ensures the manifest exists on early-return paths.
pkg/workflow/compiler_safe_outputs_job.go Appends an if: always() upload-artifact step for the manifest in the consolidated safe outputs job.
pkg/cli/audit_report.go Adds CreatedItems to AuditData and parses safe-output-items.jsonl from the run’s downloaded artifacts directory.
pkg/cli/audit_report_render.go Renders a new “Created Items” section/table when created items are present.
.github/workflows/audit-workflows.lock.yml Adds the manifest upload step to the compiled workflow.
.github/workflows/artifacts-summary.lock.yml Adds the manifest upload step to the compiled workflow.
.github/workflows/archie.lock.yml Adds the manifest upload step to the compiled workflow.
.github/workflows/ai-moderator.lock.yml Adds the manifest upload step to the compiled workflow.
.github/workflows/agent-persona-explorer.lock.yml Adds the manifest upload step to the compiled workflow.
.github/workflows/agent-performance-analyzer.lock.yml Adds the manifest upload step to the compiled workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1147 to +1153
core.info(`Exported ${issuesToAssignCopilot.length} issue(s) for copilot assignment: ${issuesToAssignStr}`);
} else {
core.setOutput("issues_to_assign_copilot", "");
}

// Ensure the manifest file always exists for artifact upload (even if no items were created).
// Skip in staged mode — no real items were created so no manifest should be emitted.
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If main() throws before the normal completion path, the manifest may never be created, so the subsequent actions/upload-artifact step won’t have /tmp/safe-output-items.jsonl to upload (despite the goal of “uploads always”). Consider calling ensureManifestExists() in a finally block (or in the catch block, wrapped so it can’t mask the original failure) to guarantee the file exists even on handler-manager errors.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

🧪 Smoke Temporary ID is now testing temporary ID functionality...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke macOS ARM64 is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

🧪 Smoke Project is now testing project operations...

@github-actions
Copy link
Contributor

📰 DEVELOPING STORY: Smoke macOS ARM64 reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

Smoke Project completed successfully. All project operations validated.

@github-actions
Copy link
Contributor

Smoke test summary
Merged PR titles: [slides] Update slide deck - remove experimental labels, fix MCP toolsets; docs: add run failure issues and no-op report sections to monitoring guide
GitHub MCP: ✅
Serena MCP: ✅
Playwright: ✅
File write + bash cat: ✅
Build gh-aw: ✅
Overall: PASS

🔮 The oracle has spoken through Smoke Codex for issue #16842

@github-actions
Copy link
Contributor

Smoke test results for @pelikhan:

Test Status
GitHub MCP
Safe Inputs GH CLI
Playwright
File Writing + Bash
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: PASS ✅

📰 BREAKING: Report filed by Smoke Copilot for issue #16842

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good PR — the safe output manifest adds useful audit trail capability. Two minor observations about logging consistency in the manifest integration. Overall looks solid.

📰 BREAKING: Report filed by Smoke Copilot for issue #16842

* @returns {Promise<{success: boolean, results: Array<any>, temporaryIdMap: Object, outputsWithUnresolvedIds: Array<any>, missings: Object}>}
*/
async function processMessages(messageHandlers, messages) {
async function processMessages(messageHandlers, messages, onItemCreated = null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onItemCreated callback follows a clean optional pattern with = null default. Consider documenting in the JSDoc that callers can use createManifestLogger() from safe_output_manifest.cjs as the standard implementation for this parameter.

const createdItem = extractCreatedItemFromResult(messageType, result);
if (createdItem) {
core.info(`📝 Manifest: logged ${createdItem.type}${createdItem.url}`);
onItemCreated(createdItem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array branch (lines 377-384) logs core.info for each item, but the else branch (lines 385-390) doesn't log. This inconsistency might make debugging harder — consider adding the core.info log in the single-item path too for consistency with the array path.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

Copy link
Contributor Author

Copilot AI commented Feb 19, 2026

@copilot do not generate teh actions/upload-artifact step in staged mode

Done in 72721a8. The buildSafeOutputItemsManifestUploadStep() call in compiler_safe_outputs_job.go is now guarded by !isStaged (where isStaged = c.trialMode || data.SafeOutputs.Staged). Recompiled all 152 lock files — staged workflows like poem-bot and daily-choice-test no longer contain the upload-artifact step.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/cli/access_log.go /home/REDACTED/work/gh-aw/gh-aw/pkg/cli/actionlint.go (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/-
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/- --jq .object.sha (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions
Copy link
Contributor

Smoke Test Results – Run §22190930520

Core Tests #1–10: ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
PR Review Tests #11–17: ✅ ✅ ✅ ✅ ✅ ✅ ⚠️

Overall: PARTIAL (test #17 skipped – no safe test PR to close)

💥 [THE END] — Illustrated by Smoke Claude for issue #16842

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude for issue #16842

@pelikhan pelikhan merged commit 5a79466 into main Feb 19, 2026
@pelikhan pelikhan deleted the copilot/update-safe-output-logging branch February 19, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments