Skip to content

Fix gvisor+privileged sandbox codemod gap and add missing tools.bash codemod for min-integrity: none - #53964

Merged
pelikhan merged 11 commits into
mainfrom
copilot/aw-compat-fix-codemod-gaps
Aug 19, 2026
Merged

Fix gvisor+privileged sandbox codemod gap and add missing tools.bash codemod for min-integrity: none#53964
pelikhan merged 11 commits into
mainfrom
copilot/aw-compat-fix-codemod-gaps

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Two recurring gaps in gh aw fix --write left --strict compile failures unrepaired across independently-verified repos: the sandbox-runtime-profiles codemod hard-errored on runtime: gvisor combined with privileged options instead of migrating, and no codemod existed to satisfy the new tools.bash requirement when min-integrity: none.

sandbox-runtime-profiles codemod

  • sandbox.agent.runtime: gvisor combined with sudo: true or legacy-security: enable now auto-migrates to runtime: docker-sudo-iptables, preserving the original privileged/sudo intent, instead of aborting the fix pass with an error.
  • The migration rewrites an existing runtime: line in place when its value changes (previously only inserted a runtime: key when one was absent).
  • Other genuinely ambiguous runtime/privilege combinations still return the actionable error as before.
# Before (fix --write aborted with an error)
sandbox:
  agent:
    runtime: gvisor
    sudo: true

# After (auto-migrated)
sandbox:
  agent:
    runtime: docker-sudo-iptables

New min-integrity-none-requires-bash codemod

  • Inserts tools.bash: false when tools.github.min-integrity is none and tools.bash is not already specified, satisfying the strict-mode requirement that shell access be explicit.
  • Preserves current behavior (no bash was configured before) since it only sets bash: false.
# Before (fix --write reported "No fixes needed", compile still failed)
tools:
  github:
    min-integrity: none

# After
tools:
  bash: false
  github:
    min-integrity: none

Both codemods are registered in the codemod registry with accompanying unit tests, and a changeset documents the fix.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 8.09 AIC · ⊞ 9.3K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.8 AIC · ⌖ 8.39 AIC · ⊞ 9.3K ·
Comment /souschef to run again


run: https://github.com/github/gh-aw/actions/runs/32276767055> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 26.4 AIC · ⌖ 9.42 AIC · ⊞ 9.3K ·

Comment /souschef to run again

Copilot AI and others added 2 commits August 19, 2026 10:46
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recurring codemod gaps in gh-aw Fix gvisor+privileged sandbox codemod gap and add missing tools.bash codemod for min-integrity: none Aug 19, 2026
Copilot AI requested a review from pelikhan August 19, 2026 10:48
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the codemod gvisor should retain gvisor and drop the sudo field

…ng runtime

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

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the codemod gvisor should retain gvisor and drop the sudo field

Fixed in 9017c9d — the codemod now keeps runtime: gvisor and simply drops the unsupported sudo/legacy-security fields instead of migrating to docker-sudo-iptables.

@pelikhan
pelikhan marked this pull request as ready for review August 19, 2026 11:18
Copilot AI balanced review requested due to automatic review settings August 19, 2026 11:18
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 19, 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 19, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #53964

@github-actions

github-actions Bot commented Aug 19, 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

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-19T00:00:00Z
review_event: REQUEST_CHANGES
top_themes:
  - codemod misses inline-YAML frontmatter shapes and leaves strict compile failures unrepaired
files_reviewed:
  - .changeset/fix-sandbox-gvisor-privileged-and-min-integrity-bash-codemods.md
  - pkg/cli/codemod_min_integrity_none_bash.go
  - pkg/cli/codemod_min_integrity_none_bash_test.go
  - pkg/cli/codemod_sandbox_runtime_profile.go
  - pkg/cli/codemod_sandbox_runtime_profile_test.go
  - pkg/cli/fix_codemods.go
  - pkg/cli/fix_codemods_test.go
comment_count: 1

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 12.9 AIC · ⌖ 6.91 AIC · ⊞ 7K ·
Comment /review to run again

@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.

Request changes

This still misses at least one valid frontmatter shape, so gh aw fix --write can claim success while leaving the strict-mode compile error unfixed.

Blocking theme
  • The new min-integrity-none-requires-bash codemod only rewrites block-style tools: YAML and silently skips inline mappings such as tools: { github: { min-integrity: none } }, even though the parsed frontmatter says the fix is required.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 12.9 AIC · ⌖ 6.91 AIC · ⊞ 7K
Comment /review to run again

Comment thread pkg/cli/codemod_min_integrity_none_bash.go

@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.

The two codemod fixes are correct and well-tested. The gvisor+privileged path correctly keeps runtime: gvisor unchanged (since targetRuntime == oldRuntime, needsRuntimeUpdate stays false) and only strips the unsupported sudo/legacy-security fields. The min-integrity-none codemod safely inserts bash: false as the first child of the tools: block. Both codemods have comprehensive no-op guard tests. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 20.2 AIC · ⌖ 8.8 AIC · ⊞ 5.8K

@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.

Ponytail review (over-engineering only).

One finding: duplicated insert-point scan logic across three codemod files, extractable into a shared helper.

net: -30 lines possible.

Generated by ✂️ Ponytail Reviewer for #53964 · auto · 25 AIC · ⌖ 3.62 AIC · ⊞ 7.3K
Comment /ponytail to run again

Comments that could not be inline-anchored

pkg/cli/codemod_min_integrity_none_bash.go:107

L77-107: yagni: insertBashFalseIntoTopLevelTools reimplements the "find first-child insertion point under a top-level block" scan already written twice (insertAt logic in codemod_cli_proxy_bash.go and codemod_cli_proxy_mode.go). Extract one shared helper and reuse it in all three codemods instead of a third copy.

@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 /diagnosing-bugs and /tdd — requesting changes for a PR-body/code contradiction and two test coverage gaps.

📋 Key Themes & Highlights

Key Themes

  • PR description contradicts implementation: The PR body shows gvisor → docker-sudo-iptables migration, but the code (and changeset) correctly keeps runtime: gvisor and drops the privileged fields. The description needs a fix before merge to avoid future confusion.
  • Test coverage gaps: The combined sudo + legacy-security + gvisor case is untested; the insertBashFalseIntoTopLevelTools comment-skipping logic has no targeted test.

Positive Highlights

  • ✅ Clean, focused fixes — each codemod solves exactly one gap with minimal surface area.
  • migrateSandboxAgentSecurityLines signature improvement (oldRuntime, targetRuntime) makes the call-site intent explicit.
  • ✅ New codemod tests are well-structured, parallel-safe, and cover all the important no-op paths.
  • ✅ Changeset description is accurate and matches the implementation.
  • ✅ Registry ordering is maintained correctly in GetAllCodemods.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 31.6 AIC · ⌖ 10.2 AIC · ⊞ 7.9K
Comment /matt to run again

Comment thread pkg/cli/codemod_sandbox_runtime_profile_test.go
Comment thread pkg/cli/codemod_sandbox_runtime_profile.go
Comment thread pkg/cli/codemod_min_integrity_none_bash.go

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.

Pull request overview

Attempts to close two strict-mode codemod gaps involving privileged gVisor configurations and explicit Bash settings.

Changes:

  • Adjusts sandbox runtime migration and runtime-line rewriting.
  • Adds and registers the min-integrity-none-requires-bash codemod.
  • Adds unit tests and release notes.
Show a summary per file
File Description
pkg/cli/fix_codemods.go Registers the new codemod.
pkg/cli/fix_codemods_test.go Updates registry-order expectations.
pkg/cli/codemod_sandbox_runtime_profile.go Changes gVisor privilege migration behavior.
pkg/cli/codemod_sandbox_runtime_profile_test.go Tests revised gVisor handling.
pkg/cli/codemod_min_integrity_none_bash.go Implements explicit bash: false insertion.
pkg/cli/codemod_min_integrity_none_bash_test.go Tests the new codemod.
.changeset/fix-sandbox-gvisor-privileged-and-min-integrity-bash-codemods.md Documents both fixes.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread pkg/cli/fix_codemods.go Outdated
getMentionsAllowTeamMembersCodemod(), // Rename allow-team-members to allowed-collaborators in safe-outputs.mentions
getEngineCopilotSDKDriverToDriverCodemod(), // Rename deprecated engine.copilot-sdk-driver to engine.driver
getEngineModelToTopLevelCodemod(), // Move engine.model to top-level model
getMinIntegrityNoneRequiresBashCodemod(), // Add tools.bash: false when tools.github.min-integrity is 'none'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — getMinIntegrityNoneRequiresBashCodemod() is now registered at fix_codemods.go:113, immediately before getCLIProxyBashDisabledCodemod() at line 114, so a single fix pass emits both bash: false and cli-proxy: false. Covered by a registry-level test in codemod_min_integrity_none_bash_test.go that runs the full registry through processWorkflowFileWithInfo and asserts both settings appear after one pass, for block and inline tools: syntax.

}
trimmed := strings.TrimSpace(line)
if needsRuntimeUpdate && getIndentation(line) == indent && strings.HasPrefix(trimmed, "runtime:") {
result = append(result, indent+"runtime: "+targetRuntime)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — the runtime line rewrite now appends trailingCommentSuffix(...) (codemod_sandbox_runtime_profile.go:153), which uses the shared findTrailingCommentIndex helper to preserve any user-authored # ... suffix while replacing only the scalar value. Covered by the test case "rewritten runtime line keeps its trailing comment".

Comment thread pkg/cli/codemod_sandbox_runtime_profile.go
…ts in ambiguous codemod cases

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

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: bug
  • Risk: medium
  • Priority score: 59/100 (impact 30 + urgency 19 + quality 10)
  • Recommended action: fast_track

Fixes gh aw fix --write codemod gaps for gvisor+privileged sandbox and missing tools.bash min-integrity:none codemod. Moderate size, addresses repeatable --strict failures.

Generated by 🔧 PR Triage Agent · auto · 44.3 AIC · ⌖ 2.78 AIC · ⊞ 8.3K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot PR still has unresolved review threads. Please address the newest blocking feedback, refresh the branch if needed, and then run the pr-finisher skill.

Open review threads (newest first):

Also attempt a branch refresh if GitHub offers one.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.8 AIC · ⌖ 8.39 AIC · ⊞ 9.3K ·
Comment /souschef to run again

…ping bash insertion

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

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot PR still has unresolved review threads. Please address the newest blocking feedback, refresh the branch if needed, and then run the pr-finisher skill.

Open review threads (newest first):...

Remaining items addressed:

  • Added the combined runtime: gvisor + sudo: true + legacy-security: enable regression test.
  • Added direct table-driven coverage for the comment/blank-line skipping insertion behavior in insertBashFalseIntoTopLevelTools (leading comments, non-default field indentation, comment-only block).

The other listed threads were already resolved in earlier commits on this branch:

  • Inline tools: { ... } syntax is handled via insertEntryIntoInlineMapping (single-line flow mappings; multi-line ones are skipped conservatively).
  • min-integrity-none-requires-bash runs before cli-proxy-false-when-bash-disabled, with a registry-level test asserting one fix pass emits both bash: false and cli-proxy: false.
  • Rewriting the runtime: line preserves any trailing # ... comment, with a test case.
  • The PR body was updated to match the implemented runtime behavior and links ADR-53964.

On the "migrate gvisor + privileged options to docker-sudo-iptables" thread: that suggestion conflicts with @pelikhan's explicit direction on this PR ("the codemod gvisor should retain gvisor and drop the sudo field"), so the maintainer's decision was kept and the PR body/changeset reflect it.

Branch is refreshed from main; no CI failures on the branch (pending checks are action_required, awaiting maintainer approval) and make agent-report-progress passes.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot PR still has maintainer-visible unfinished work.

Open blockers to address in one pass:

  • Unresolved review threads still point at codemod behavior and test coverage; reply directly on-thread as each item is addressed.
  • Please refresh the branch if GitHub offers one.
  • Then run the pr-finisher skill and leave a concise maintainer-facing handoff comment with validation and any remaining risks.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 26.4 AIC · ⌖ 9.42 AIC · ⊞ 9.3K ·
Comment /souschef to run again

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot PR still has maintainer-visible unfinished work.

Open blockers to address in one pass:...

Handoff summary:

  • Reviews — replied on-thread to every unresolved thread: inline tools: { ... } handling, the combined gvisor + sudo + legacy-security regression test, direct insertBashFalseIntoTopLevelTools edge-case tests, the codemod ordering vs cli-proxy-false-when-bash-disabled, trailing-comment preservation, and the docker-sudo-iptables disagreement (kept gvisor per @pelikhan's explicit direction, rationale in ADR docs/adr/53964-prefer-restrictive-safe-default-in-ambiguous-codemod-cases.md). I can't mark threads resolved from this environment — that needs a maintainer click.
  • Checks (local)make agent-report-progress passes (fmt, lint, impacted unit tests, 286 workflows recompiled and lock files in sync). No new code changes were needed this pass; the branch already contained the fixes.
  • Checks (CI) — repo CI on this PR is action_required and awaiting maintainer approval; nothing has run against the current HEAD, and agent pushes don't trigger it.
  • Mergeable — branch is up to date with main (0 commits behind), no conflicts; mergeable_state: blocked reflects the pending required checks/approval only.

Remaining risk / maintainer action:

  1. PR description is stale — it still shows the docker-sudo-iptables migration example. I cannot edit the PR body from this environment. Implemented behavior is: runtime: gvisor + sudo/legacy-security → keep runtime: gvisor, drop the privileged fields. Please edit the body (or re-run souschef) to match.
  2. Approve/re-trigger CI so the required checks run against 84cd22c.
  3. Multi-line flow-mapping tools: frontmatter is intentionally skipped by the new codemod (no partial rewrite); single-line inline mappings are handled.

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: bug · Risk: medium · Score: 68/100 (impact 30 + urgency 20 + quality 18)
Recommended action: fast_track

Sandbox codemod correctness fix, approved review, CI green; large diff but well-scoped.

Automated triage — see run report for full details.

Generated by 🔧 PR Triage Agent · auto · 90.2 AIC · ⌖ 2.82 AIC · ⊞ 8.3K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot PR still has maintainer-visible unfinished work.

Open review threads / blockers to close in one pass:

  • Resolve or answer the remaining unresolved review threads directly, especially the codemod behavior/test coverage items and the maintainer-visible PR body mismatch noted in prior handoff comments.
  • Refresh the branch if GitHub offers one.
  • Then run the pr-finisher skill and leave a concise maintainer-facing handoff comment with validation and any remaining risks.

Generated by 👨🍳 PR Sous Chef

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 31.4 AIC · ⌖ 8.18 AIC · ⊞ 9.3K ·
Comment /souschef to run again

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot PR still has maintainer-visible unfinished work.

Open review threads / blockers to close in one pass:...

Handoff summary (no code changes needed this pass — the branch already contained every requested fix):

  • Reviews — all 7 review threads now have an on-thread reply. The two that were still without one are answered now:
    • codemod ordering (#discussion_r3812533124): getMinIntegrityNoneRequiresBashCodemod() sits at fix_codemods.go:113, directly before getCLIProxyBashDisabledCodemod() at 114, with a registry-level test asserting one pass emits both bash: false and cli-proxy: false.
    • comment preservation (#discussion_r3812533193): the runtime rewrite appends trailingCommentSuffix(...), keeping any trailing # ..., covered by a dedicated test.
      Both threads are marked outdated by GitHub; 5 of 7 are already resolved. Marking the last two resolved requires a maintainer click — I can't resolve threads from this environment.
  • Checks (local)make agent-report-progress passes: fmt, lint, impacted unit tests, 286 workflows compiled, lock files in sync. Targeted go test ./pkg/cli -run 'Codemod.*SandboxRuntime|MinIntegrity|InsertBashFalse' is green.
  • Checks (CI) — no check runs have executed against HEAD 84cd22c (status pending, total_count: 0); repo CI needs maintainer approval. Agent pushes don't trigger it, so this stays unverified until a human re-triggers.
  • Mergeable — branch is level with main (0 commits behind), no conflicts. mergeable_state: blocked reflects only the pending required checks/approval.

Remaining risks / maintainer actions:

  1. PR body is still stale — it shows the old docker-sudo-iptables migration example. I cannot edit the PR description from this environment (report_progress doesn't write through to the body). Implemented behavior: runtime: gvisor + sudo/legacy-security → keep runtime: gvisor, drop the privileged fields. The changeset, tests, and docs/adr/53964-prefer-restrictive-safe-default-in-ambiguous-codemod-cases.md are all correct; only the body needs a manual edit or a souschef re-run.
  2. Approve/re-trigger CI against 84cd22c.
  3. Resolve the two outdated review threads listed above.
  4. Known scope limit: multi-line flow-mapping tools: frontmatter is intentionally skipped by the new codemod (no partial rewrite); single-line inline mappings are handled.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot PR still has maintainer-visible unfinished work.

Please close out the remaining blockers in one pass:

  • Resolve or answer the two remaining unresolved review threads directly.
  • Refresh the branch if GitHub offers one.
  • Then run the pr-finisher skill and leave a concise maintainer-facing handoff comment with validation and any remaining risks.

Open review threads (newest first):

If those are already fixed on the current head, reply on-thread with the exact commit/test evidence so reviewers can resolve them quickly.

Generated by 👨🍳 PR Sous Chef

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.9 AIC · ⌖ 8.28 AIC · ⊞ 9.3K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit d21285f into main Aug 19, 2026
5 of 6 checks passed
@pelikhan
pelikhan deleted the copilot/aw-compat-fix-codemod-gaps branch August 19, 2026 21:02
Copilot stopped work on behalf of gh-aw-bot due to an error August 19, 2026 21:02
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.

[aw-compat] gh-aw fix: two recurring codemod gaps (gvisor+privileged sandbox, missing tools.bash w/ min-integrity: none)

4 participants