Skip to content

Store sandbox.agent.runtime in aw_info.json and add --runtime filter to logs/audit - #51465

Merged
pelikhan merged 3 commits into
mainfrom
copilot/add-runtime-filter-to-logs
Aug 9, 2026
Merged

Store sandbox.agent.runtime in aw_info.json and add --runtime filter to logs/audit#51465
pelikhan merged 3 commits into
mainfrom
copilot/add-runtime-filter-to-logs

Conversation

Copilot AI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

sandbox.agent.runtime (e.g. gvisor, docker-sbx) was not recorded anywhere post-compile, making it impossible to filter or audit runs by sandbox runtime after the fact.

aw_info.json generation

  • Compiler now emits GH_AW_INFO_AGENT_RUNTIME from sandbox.agent.runtime in the generate_aw_info step.
  • generate_aw_info.cjs reads this env var and writes agent_runtime into aw_info.json.
  • AwInfo Go struct gains a matching AgentRuntime field for CLI-side parsing.

--runtime filter for logs and audit

  • logs: new --runtime flag, filtering wired through runFilterOpts/applyRunFilters (mirrors the existing --engine filter).
  • audit: new --runtime flag; shouldSkipAuditRun now also checks agent_runtime from aw_info.json.
gh aw logs --runtime gvisor
gh aw audit --runtime docker-sbx

MCP tools

  • logs and audit MCP tools gain a runtime parameter, forwarded as --runtime <value> to the underlying CLI invocation, keeping MCP and CLI surfaces in sync.

All 284 compiled .lock.yml workflow files are regenerated to include the new GH_AW_INFO_AGENT_RUNTIME env var.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.6 AIC · ⌖ 5.15 AIC · ⊞ 8.5K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.05 AIC · ⌖ 6.07 AIC · ⊞ 6.1K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/31287357931> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20.7 AIC · ⌖ 6.68 AIC · ⊞ 8.5K ·

Comment /souschef to run again

…to logs/audit + MCP tools

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review August 8, 2026 21:00
Copilot AI balanced review requested due to automatic review settings August 8, 2026 21:00
Copilot AI requested a review from pelikhan August 8, 2026 21:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. This PR only updates workflow lock files (.lock.yml artifacts). Test Quality Sentinel analysis skipped.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.individual.githubcopilot.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.individual.githubcopilot.com"

See Network Configuration for more information.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

pr-diff.patch is empty (0 bytes), so there are no changed lines to review for over-engineering. Stopping per instructions.

Generated by Ponytail Reviewer for #51465

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /codebase-design and /tdd — requesting changes on a validation gap and a test coverage gap.

📋 Key Themes & Highlights

Key Themes

  • Validation asymmetry: logs --runtime validates the value eagerly; audit --runtime does not, silently skipping all runs on a typo.
  • Code duplication: shouldSkipAuditRun re-implements the runtime-matching logic from matchRuntimeFilter instead of calling it.
  • Test coverage gaps: shouldSkipAuditRun's new branch has no unit tests; TestApplyRunFilters_Runtime is missing the empty agent_runtime edge case.

Positive Highlights

  • ✅ Clean end-to-end threading of the new field: compiler → generate_aw_info.cjsaw_info.json → Go struct → filter flag.
  • matchRuntimeFilter follows the same contract as matchEngineFilter — consistent pattern.
  • ✅ Tests for the new generate_aw_info.cjs behaviour and the TestMatchRuntimeFilter unit are well structured and cover all expected states.
  • ✅ MCP tool surfaces kept in sync with CLI flags.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 65.1 AIC · ⌖ 7.85 AIC · ⊞ 7.1K
Comment /matt to run again

Comments that could not be inline-anchored

pkg/cli/audit.go:156

[/codebase-design] audit silently accepts any --runtime value (no input validation), but logs calls validateLogsRuntime and returns an error on unknown values. gh aw audit --runtime typo will silently skip all runs rather than failing fast.

<details>
<summary>💡 Suggested fix</summary>

Add validation in getAuditCommandOptions, after reading opts.runtimeFilter:

if err := validateLogsRuntime(opts.runtimeFilter); err != nil {
    return auditCommandOptions{}, err
}

pkg/cli/audit.go:582

[/codebase-design] The runtime-filter logic in shouldSkipAuditRun is a copy of matchRuntimeFilter in logs_orchestrator_filters.go — it directly calls parseAwInfo and branches on AgentRuntime instead of reusing the shared helper. If the skip message format or the fallback logic changes later, both sites need updating.

<details>
<summary>💡 Suggested refactor</summary>

Reuse matchRuntimeFilter here (or move shouldSkipAuditRun's runtime block into a shared package-level helper)…

pkg/cli/audit.go:563

[/tdd] shouldSkipAuditRun has no unit tests for the new runtimeFilter branch. The function is a pure function that takes strings — it is easy to test in isolation, and the logs side already has TestApplyRunFilters_Runtime as a model.

<details>
<summary>💡 Suggested tests</summary>

Add a TestShouldSkipAuditRun_Runtime table-driven test covering:

  • matching runtime → not skipped
  • non-matching runtime → skipped + correct message
  • empty aw_info.json → skipped (unknown runtime)
    -…
pkg/cli/logs_orchestrator_filters_test.go:443

[/tdd] TestApplyRunFilters_Runtime is missing the empty agent_runtime case (where aw_info.json exists but agent_runtime is &quot;&quot;). logs_engine_filter_test.go covers this for engine but not for runtime in the integration-level filter test.

<details>
<summary>💡 Suggested test case to add</summary>

{
    name:          &quot;empty agent_runtime is skipped&quot;,
    awInfo:        `{&quot;agent_runtime&quot;:&quot;&quot;}`,
    filterRuntime: &quot;gvisor&quot;,
    wantSkip:      true,
},

This ensures the fil…

…ntime filter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (300 new lines across business logic paths) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/51465-persist-agent-runtime-in-aw-info-and-add-runtime-filter.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR description and diff
  2. Complete the missing sections — add context the AI could not infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-51465: Persist Agent Runtime in aw_info.json and Add --runtime Filter

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 0042-use-postgresql.md for PR #42).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 51.4 AIC · ⌖ 24.3 AIC · ⊞ 8.8K ·
Comment /review to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage nudge for this PR.

Please address the current maintainer-facing review feedback below, refresh the branch if GitHub can update it cleanly, run the pr-finisher skill, and push follow-up fixes.

Open review context (newest first):

Branch refresh was requested.

Run: https://github.com/github/gh-aw/actions/runs/31278943751

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.6 AIC · ⌖ 5.15 AIC · ⊞ 8.5K ·
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage nudge for this PR.

Please address the current maintainer-facing review feedback, refresh the branch if GitHub can update it cleanly, run the pr-finisher skill, and push follow-up fixes.

Open items (newest first):

Branch refresh was requested.
Run: https://github.com/github/gh-aw/actions/runs/31282624218

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.05 AIC · ⌖ 6.07 AIC · ⊞ 6.1K ·
Comment /souschef to run again

…ze ADR

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: feature
  • Risk: medium (309 files, but 300+ are regenerated .lock.yml; substantive code in compiler + aw_info.json generation + CLI --runtime flag)
  • Score: 62/100 (impact 32, urgency 15, quality 15)
  • CI: unknown/pending — commit status is pending, no check-run data returned; PR marked mergeable_state=blocked
  • Recommendation: batch_review — good candidate to batch with other lockfile-regeneration PRs; verify CI resolves and blocked-mergeable state clears before merging.

Generated by 🔧 PR Triage Agent · auto · 51 AIC · ⌖ 2.57 AIC · ⊞ 8K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage nudge for this PR.

Please refresh the branch if GitHub can update it cleanly, re-check the current maintainer-facing state, run the pr-finisher skill, and push follow-up fixes only if something actionable remains.

Open review context (newest first):

Branch refresh was requested.

Run: https://github.com/github/gh-aw/actions/runs/31287357931

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20.7 AIC · ⌖ 6.68 AIC · ⊞ 8.5K ·
Comment /souschef to run again

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: feature
  • Risk: medium
  • Priority: medium
  • Score: 56/100 (impact 30 + urgency 12 + quality 14)
  • Recommended action: fast_track

New audit/filter feature, CI green, but blocked mergeable_state and dismissed review - needs human attention.

Generated by 🔧 PR Triage Agent · auto · 58.3 AIC · ⌖ 2.48 AIC · ⊞ 8K ·

@pelikhan
pelikhan merged commit b613569 into main Aug 9, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/add-runtime-filter-to-logs branch August 9, 2026 10:56
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.

4 participants