Skip to content

Normalize sandbox frontmatter fields to kebab-case - #64302

Merged
pelikhan merged 5 commits into
mainfrom
copilot/normalize-sandbox-fields
Sep 29, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/normalize-sandbox-fields

Conversation

Copilot AI commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Sandbox frontmatter now consistently uses kebab-case. Camel-cased fields are rejected without parser compatibility aliases; gh aw fix provides migration.

  • Parser and schema

    • Rename sandbox fields such as allowWrite, authHeader, and entrypointArgs.
    • Preserve camelCase only in generated AWF runtime JSON.
  • Migration

    • Add an idempotent codemod that preserves formatting, comments, and Markdown content.
    • Cover sandbox filesystem, targets, images, runtime configuration, and MCP fields.
  • Documentation and workflows

    • Update reference documentation, autocomplete metadata, examples, and affected workflows.
# Before
sandbox:
  agent:
    config:
      filesystem:
        allowWrite:
          - /workspace

# After
sandbox:
  agent:
    config:
      filesystem:
        allow-write:
          - /workspace

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

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 9.07 AIC · ⌖ 8.61 AIC · ⊞ 9.7K · ◷
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 10.7 AIC · ⌖ 6.64 AIC · ⊞ 9.7K · ◷
Comment /souschef to run again

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

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 review overview

🟡 Changes recommended

The codemod can create duplicate keys or fail to migrate valid YAML syntax, and several references remain outdated.

Review effort: Balanced
Findings: 1 Medium severity · 4 Low severity

Open (5)
What changed in this PR

Normalizes sandbox frontmatter to kebab-case while retaining camelCase in generated AWF runtime JSON.

Changes:

  • Renames schema, parser, validation, and autocomplete fields.
  • Adds a gh aw fix migration codemod.
  • Updates documentation, tests, workflows, and generated lock metadata.
File Description
specs/​awf-config-sources-spec.md Updates frontmatter mappings.
pkg/​workflow/​strict_mode_sandbox_validation.go Updates strict-mode field names.
pkg/​workflow/​strict_mode_sandbox_validation_test.go Updates strict-mode assertions.
pkg/​workflow/​sandbox.go Changes YAML tags to kebab-case.
pkg/​workflow/​sandbox_agent_images.go Maps image roles to AWF camelCase.
pkg/​workflow/​frontmatter_extraction_security.go Extracts normalized sandbox fields.
pkg/​workflow/​firewall.go Updates field documentation.
pkg/​workflow/​engine_api_targets.go Updates target-field documentation.
pkg/​workflow/​copilot_byok_extra_fields_compilation_test.go Tests kebab-case BYOK fields.
pkg/​workflow/​compiler_validators.go Updates warning text.
pkg/​workflow/​compiler_validators_test.go Updates warning assertions.
pkg/​parser/​schemas/​main_workflow_schema.json Enforces kebab-case sandbox fields.
pkg/​parser/​schema_test.go Tests acceptance and rejection behavior.
pkg/​cli/​fix_codemods.go Registers the migration codemod.
pkg/​cli/​fix_codemods_test.go Verifies codemod registration order.
pkg/​cli/​codemod_sandbox_fields.go Implements sandbox-field migration.
pkg/​cli/​codemod_sandbox_fields_test.go Tests migration and preservation.
docs/​src/​content/​docs/​reference/​self-hosted-runners.md Updates image-role example.
docs/​src/​content/​docs/​reference/​sandbox.md Updates sandbox examples.
docs/​src/​content/​docs/​reference/​frontmatter-full.md Refreshes generated reference content.
docs/​src/​content/​docs/​reference/​faq.md Updates image-role example.
docs/​public/​editor/​autocomplete-data.json Updates editor metadata.
.github/​workflows/​step-name-alignment.md Migrates sandbox frontmatter.
.github/​workflows/​step-name-alignment.lock.yml Refreshes generated metadata.
.github/​workflows/​smoke-pi.md Migrates sandbox frontmatter.
.github/​workflows/​smoke-pi.lock.yml Refreshes generated metadata.
.github/​workflows/​smoke-claude.md Migrates sandbox frontmatter.
.github/​workflows/​smoke-claude.lock.yml Refreshes generated metadata.
.changeset/​normalize-sandbox-fields.md Documents the breaking change.

Comment thread pkg/cli/codemod_sandbox_fields.go Outdated
Comment on lines +121 to +125
if replacement := sandboxFieldReplacement(parent, key); replacement != "" {
line, _ = findAndReplaceInLine(line, key, replacement)
key = replacement
modified = true
}

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.

Fixed in eecaf4e: the codemod now detects a canonical sibling and returns a guided error without modifying the workflow; block and flow collision cases are covered.

squid: registry.example.com/approved/squid:v0.28.8@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
agent: registry.example.com/approved/agent:v0.28.8@sha256:1123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
apiProxy: registry.example.com/approved/api-proxy:v0.28.8@sha256:2123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
api-proxy: registry.example.com/approved/api-proxy:v0.28.8@sha256:2123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

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.

Updated the role examples to api-proxy, cli-proxy, and build-tools in eecaf4e.

squid: registry.example.com/approved/squid:v0.28.4@sha256:<64-hex-digest>
agent: registry.example.com/approved/agent:v0.28.4@sha256:<64-hex-digest>
apiProxy: registry.example.com/approved/api-proxy:v0.28.4@sha256:<64-hex-digest>
api-proxy: registry.example.com/approved/api-proxy:v0.28.4@sha256:<64-hex-digest>

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.

Updated the supported and required image role names to kebab-case in eecaf4e.

squid: registry.example.com/approved/squid:v0.28.8@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
agent: registry.example.com/approved/agent:v0.28.8@sha256:1123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
apiProxy: registry.example.com/approved/api-proxy:v0.28.8@sha256:2123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
api-proxy: registry.example.com/approved/api-proxy:v0.28.8@sha256:2123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

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.

Updated the role references to cli-proxy and build-tools in eecaf4e.

Comment thread pkg/workflow/sandbox.go Outdated
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Design Decision Gate 🏗️. Review the logs for details.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #64302

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

Attempted to submit a PR review for #64302 twice via safeoutputs create_pull_request_review_comment and submit_pull_request_review, but both calls failed with: Permission denied and could not request permission from user. No GitHub write was recorded; continuity memory was updated locally at /tmp/gh-aw/comment-memory/pr-code-quality-reviewer.md.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Sep 29, 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 Sep 29, 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
🏗️ ADR Required - draft added for PR #64302

I added a draft ADR at docs/adr/64302-normalize-sandbox-frontmatter-fields.md because this PR triggers ADR enforcement and introduces a repository-wide authoring contract change.

Evidence used

  • adr-prefetch-summary.json: requires_adr_by_default_volume=true with default_business_additions=530
  • PR title/body: the change standardizes sandbox frontmatter fields to kebab-case and rejects camelCase aliases
  • Diff evidence: new pkg/cli/codemod_sandbox_fields.go, schema tests that reject camel-cased fields, and doc/example updates across workflows and reference docs

Gate result

  • Status: ADR draft generated
  • Decision inferred from PR: user-authored sandbox frontmatter fields should use kebab-case only, with gh aw fix providing migration

Next action

Please review and refine the draft ADR, then keep it with this architectural change before merge.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · gpt54 · 24.1 AIC · ⊞ 10.4K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-09-29T16:31:12Z
review_event: REQUEST_CHANGES
top_themes:
  - codemod migration misses inline YAML mappings
files_reviewed:
  - .changeset/normalize-sandbox-fields.md
  - .github/workflows/smoke-claude.md
  - .github/workflows/smoke-pi.md
  - .github/workflows/step-name-alignment.md
  - docs/public/editor/autocomplete-data.json
  - docs/src/content/docs/reference/faq.md
  - docs/src/content/docs/reference/frontmatter-full.md
  - docs/src/content/docs/reference/sandbox.md
  - docs/src/content/docs/reference/self-hosted-runners.md
  - pkg/cli/codemod_sandbox_fields.go
  - pkg/cli/codemod_sandbox_fields_test.go
  - pkg/cli/fix_codemods.go
  - pkg/cli/fix_codemods_test.go
  - pkg/parser/schema_test.go
  - pkg/parser/schemas/main_workflow_schema.json
  - pkg/workflow/compiler_validators.go
  - pkg/workflow/compiler_validators_test.go
  - pkg/workflow/copilot_byok_extra_fields_compilation_test.go
  - pkg/workflow/engine_api_targets.go
  - pkg/workflow/firewall.go
  - pkg/workflow/frontmatter_extraction_security.go
  - pkg/workflow/sandbox.go
  - pkg/workflow/sandbox_agent_images.go
  - pkg/workflow/strict_mode_sandbox_validation.go
  - pkg/workflow/strict_mode_sandbox_validation_test.go
  - specs/awf-config-sources-spec.md
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 · copilot · gpt54 · 56.8 AIC · ⌖ 7.28 AIC · ⊞ 18.8K · ◷
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.

Skills-Based Review 🧠

Applied /tdd and /grill-with-docs (via pr-triage) — requesting changes: a confirmed logic bug in the codemod plus lingering doc inconsistencies from an unresolved earlier review pass.

📋 Key Themes & Highlights

Key Themes

  • Codemod correctness (/tdd): reproduced the previously-flagged duplicate-key bug in pkg/cli/codemod_sandbox_fields.go — when both the old and new spelling of a field already coexist (e.g. allowWrite and allow-write), the rename produces two identical allow-write: keys, which is invalid/ambiguous YAML. No test currently covers this partially-migrated scenario.
  • Documentation consistency (/grill-with-docs): docs/src/content/docs/reference/sandbox.md, docs/src/content/docs/reference/faq.md, and docs/src/content/docs/reference/self-hosted-runners.md still list the now-rejected camelCase image role names (apiProxy, cliProxy, buildTools, etc.) even though the adjacent examples were migrated to kebab-case. These are the same gaps an earlier automated review pass already flagged and remain unaddressed in the current diff.

Positive Highlights

  • ✅ The core schema/parser/compiler rename is comprehensive and consistent (pkg/workflow/frontmatter_extraction_security.go, strict_mode_sandbox_validation.go, schema, tests all aligned).
  • ✅ sandboxImageRoleFromFrontmatter cleanly bridges the kebab-case frontmatter spelling to AWF's required camelCase runtime JSON without leaking the old spelling into the public API.
  • ✅ New schema tests explicitly assert camelCase fields are rejected — good regression coverage for the breaking change itself.

Please fix the codemod duplicate-key handling (add a collision check + regression test) and sweep the remaining doc files for leftover camelCase role names before merge.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 64.6 AIC · ⌖ 13.7 AIC · ⊞ 10K
Comment /matt to run again

Comments that could not be inline-anchored

pkg/cli/codemod_sandbox_fields.go:121

[/tdd] Confirmed via a quick reproduction test: when a mapping already has both spellings (e.g. allowWrite and allow-write), this codemod renames the old key without checking for a collision, producing two identical allow-write: keys in the output YAML.

<details>
<summary>💡 Reproduction and fix idea</summary>

Running the codemod against:

sandbox:
  agent:
    config:
      filesystem:
        allowWrite: [/workspace]
        allow-write: [/already-migrated]

produces:
``…

docs/src/content/docs/reference/sandbox.md:248

[/grill-with-docs] The example above uses api-proxy, but this role list and the required-role rule on the next line still teach readers the rejected camelCase spellings (apiProxy, cliProxy, buildTools, dohProxy, enclaveScript, enclaveAgent, enclaveMcpServer, dindStaging). A reader copying these names will get a schema-validation error.

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

Replace with: squid, agent, api-proxy, cli-proxy, build-tools, doh-proxy, `encl…

docs/src/content/docs/reference/faq.md:203

[/grill-with-docs] This line still lists the rejected camelCase role names apiProxy, cliProxy, buildTools even though the example three lines above was migrated to api-proxy. Update the prose to the kebab-case spellings so the doc is internally consistent.

@copilot please address this.

docs/src/content/docs/reference/self-hosted-runners.md:242

[/grill-with-docs] cliProxy and buildTools here are now-rejected spellings; use cli-proxy and build-tools so this cross-reference matches the migrated schema.

@copilot please address this.

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

Impeccable Skills Review — Normalize sandbox frontmatter fields to kebab-case

Change type: refactor_cleanup (schema/parser field rename). This diff is backend Go/JSON/docs with no UI surface, so Impeccable's UI-focused modes (distill/extract/critique/audit) don't map directly; I applied a correctness/security-focused review instead per the fallback rule.

Verification performed

  • Built the repo (go build ./...) — succeeds.
  • Ran targeted unit tests (pkg/cli codemod tests, pkg/parser schema tests) — all pass.
  • Wrote ad-hoc regression tests to probe the codemod's line-transform logic:
    • Confirmed the duplicate-key bug already flagged in the existing review thread on pkg/cli/codemod_sandbox_fields.go:125: when a mapping has both allowWrite and allow-write siblings, the codemod renames the old key unconditionally, producing two identical allow-write: keys in the emitted YAML (verified reproduction, invalid YAML output). This is a real, blocking defect for partially-migrated workflows and should be fixed (e.g., skip the rename or drop/warn when the target key already exists as a sibling) before merge.
    • Sibling-key handling (filesystem + network under the same parent) works correctly — no false positives there.
    • Sequence/list items (targets: as a list of maps) are correctly left untouched since the codemod tracks mapping stacks, not list items — no additional bug found here.
    • Confirmed pkg/workflow/sandbox_agent_images.go's sandboxImageRoleFromFrontmatter and the AWF JSON output structs (AWFAPITargetConfig etc. in awf_config.go) correctly retain camelCase for the generated AWF runtime config, matching the PR's stated design (kebab-case frontmatter, camelCase preserved only in generated AWF JSON).
    • Checked docs/src/content/docs/reference/mcp-gateway.md's entrypointArgs references — these document the generated MCP gateway config JSON (a different schema from sandbox.mcp.entrypoint-args frontmatter), so they are correctly left as camelCase and are not stale.

Outstanding issues (already surfaced by existing review comments — not duplicated here)

The existing Copilot review thread already flags, and I independently confirmed as accurate:

  1. pkg/cli/codemod_sandbox_fields.go:125 — duplicate-key bug (confirmed reproducible, blocking).
  2. docs/src/content/docs/reference/faq.md:223, docs/src/content/docs/reference/sandbox.md:243, docs/src/content/docs/reference/self-hosted-runners.md:236 — stale camelCase role names (apiProxy, cliProxy, buildTools, etc.) left in prose describing the now-rejected schema.
  3. pkg/workflow/sandbox.go:122 — stale extraHeaders example in a doc comment.

No new high-signal issues found beyond these. Recommending Request Changes until the duplicate-key codemod bug (#1) is fixed, since it can silently corrupt frontmatter for any workflow with a partially-migrated sandbox block.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 158.2 AIC · ⌖ 13.4 AIC · ⊞ 8.1K

line, _ = findAndReplaceInLine(line, key, replacement)
key = replacement
modified = true
}

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.

Confirmed via reproduction: when a mapping already has both spellings (e.g. allowWrite and allow-write as siblings), normalizeSandboxFieldLines renames allowWrite -> allow-write unconditionally without checking whether the target key already exists in the same mapping. This produces invalid YAML with two duplicate allow-write: keys, which will silently corrupt any partially-migrated workflow file when gh aw fix runs.

Repro (frontmatter):

sandbox:
  agent:
    config:
      filesystem:
        allowWrite: [/workspace]
        allow-write: [/other]

Output after codemod:

        allow-write: [/workspace]
        allow-write: [/other]

Suggested fix: before renaming, check if replacement already exists as a sibling key in the current mapping (track keys seen at each stack level) and skip/warn instead of blindly overwriting.

@copilot please address this.

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.

Fixed in 94834af: gh aw fix now reports a guided error when old and canonical sandbox keys coexist, leaving the file unchanged. Added block- and flow-mapping collision tests.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot PR #64302 still needs forward progress. Please review the open feedback, refresh the branch, and run the pr-finisher skill before handing it back to maintainers.

Open review signals:

  • PR Code Quality Reviewer requested changes and flagged a codemod migration gap for inline YAML mappings.

Branch refresh:

  • I requested a branch update from the base branch for this PR.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 9.07 AIC · ⌖ 8.61 AIC · ⊞ 9.7K · ◷
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

Congratulations @Copilot 🎉 — this PR looks ready for review! The sandbox field normalization is well-structured with parser updates, migration codemod, test coverage, and documentation.

Generated by ✅ Contribution Check · copilot · auto · 43.7 AIC · ⌖ 6.67 AIC · ⊞ 9.1K · ◷

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

Copilot AI commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Ran the pr-finisher skill. Published review fixes in 94834af; local formatting, lint, build, and impacted tests pass. CI on this new HEAD still needs a maintainer re-trigger before merge.

@copilot PR #64302 still needs forward progress. Please review the open feedback, refresh the branch, and run the pr-finisher skill before handing it back to maintainers.

Open review signals:...

Addressed the inline YAML migration gap and outstanding documentation/collision feedback in 94834af. The branch already contains current main; the local pre-push gate passes. CI on the agent's new HEAD needs a maintainer re-trigger.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan merged commit cff4a5c into main Sep 29, 2026
34 checks passed
@pelikhan
pelikhan deleted the copilot/normalize-sandbox-fields branch September 29, 2026 18:10
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.90.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants