Handle permission-blocked safe-output writes in Smoke Codex workflow#2116
Handle permission-blocked safe-output writes in Smoke Codex workflow#2116
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Updates the Smoke Codex compiled lock workflow to tolerate PR-run environments where GitHub write operations are permission-blocked, preventing post-step “safe outputs” assertions from failing for the wrong reason.
Changes:
- Detects a known permission-denied signature in agent logs during the “Validate safe outputs were invoked” post-step.
- Conditionally bypasses strict safe-output assertions (non-empty outputs +
add_commenton PR triggers) only when that permission-blocked condition is detected. - Keeps existing strict validation behavior unchanged for normal runs.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/smoke-codex.lock.yml | Adds permission-blocked detection and conditional bypass logic to the safe-output validation post-step. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
| run: bash "${RUNNER_TEMP}/gh-aw/actions/commit_cache_memory_git.sh" | ||
| - name: Validate safe outputs were invoked | ||
| run: "OUTPUTS_FILE=\"${GH_AW_SAFE_OUTPUTS:-${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl}\"\nif [ ! -s \"$OUTPUTS_FILE\" ]; then\n echo \"::error::No safe outputs were invoked. Smoke tests require the agent to call safe output tools.\"\n exit 1\nfi\necho \"Safe output entries found: $(wc -l < \"$OUTPUTS_FILE\")\"\nif [ \"$GITHUB_EVENT_NAME\" = \"pull_request\" ]; then\n if ! grep -q '\"add_comment\"' \"$OUTPUTS_FILE\"; then\n echo \"::error::Agent did not call add_comment on a pull_request trigger.\"\n exit 1\n fi\n echo \"add_comment verified for PR trigger\"\nfi\necho \"Safe output validation passed\"" | ||
| run: "OUTPUTS_FILE=\"${GH_AW_SAFE_OUTPUTS:-${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl}\"\nPERMISSION_BLOCKED=false\nfor LOG_FILE in \"/tmp/gh-aw/agent-stdio.log\" \"${RUNNER_TEMP}/gh-aw/agent-stdio.log\"; do\n if [ -f \"$LOG_FILE\" ] && grep -qE 'blocked by permissions in this environment.*GraphQL operation denied' \"$LOG_FILE\"; then\n PERMISSION_BLOCKED=true\n echo \"::warning::Detected permission-blocked write actions in agent output; skipping strict safe-output checks for this run.\"\n break\n fi\ndone\nif [ ! -s \"$OUTPUTS_FILE\" ]; then\n if [ \"$PERMISSION_BLOCKED\" = true ]; then\n exit 0\n fi\n echo \"::error::No safe outputs were invoked. Smoke tests require the agent to call safe output tools.\"\n exit 1\nfi\necho \"Safe output entries found: $(wc -l < \"$OUTPUTS_FILE\")\"\nif [ \"$GITHUB_EVENT_NAME\" = \"pull_request\" ]; then\n if ! grep -q '\"add_comment\"' \"$OUTPUTS_FILE\"; then\n if [ \"$PERMISSION_BLOCKED\" = true ]; then\n exit 0\n fi\n echo \"::error::Agent did not call add_comment on a pull_request trigger.\"\n exit 1\n fi\n echo \"add_comment verified for PR trigger\"\nfi\necho \"Safe output validation passed\"" |
There was a problem hiding this comment.
In the PR-trigger add_comment check, the PERMISSION_BLOCKED bypass exits 0 without emitting any message at the point of exit. Consider emitting a specific ::warning::/::notice:: explaining that the add_comment assertion is being skipped (and ideally why) so runs are self-explanatory in the step logs.
| run: "OUTPUTS_FILE=\"${GH_AW_SAFE_OUTPUTS:-${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl}\"\nPERMISSION_BLOCKED=false\nfor LOG_FILE in \"/tmp/gh-aw/agent-stdio.log\" \"${RUNNER_TEMP}/gh-aw/agent-stdio.log\"; do\n if [ -f \"$LOG_FILE\" ] && grep -qE 'blocked by permissions in this environment.*GraphQL operation denied' \"$LOG_FILE\"; then\n PERMISSION_BLOCKED=true\n echo \"::warning::Detected permission-blocked write actions in agent output; skipping strict safe-output checks for this run.\"\n break\n fi\ndone\nif [ ! -s \"$OUTPUTS_FILE\" ]; then\n if [ \"$PERMISSION_BLOCKED\" = true ]; then\n exit 0\n fi\n echo \"::error::No safe outputs were invoked. Smoke tests require the agent to call safe output tools.\"\n exit 1\nfi\necho \"Safe output entries found: $(wc -l < \"$OUTPUTS_FILE\")\"\nif [ \"$GITHUB_EVENT_NAME\" = \"pull_request\" ]; then\n if ! grep -q '\"add_comment\"' \"$OUTPUTS_FILE\"; then\n if [ \"$PERMISSION_BLOCKED\" = true ]; then\n exit 0\n fi\n echo \"::error::Agent did not call add_comment on a pull_request trigger.\"\n exit 1\n fi\n echo \"add_comment verified for PR trigger\"\nfi\necho \"Safe output validation passed\"" | |
| run: "OUTPUTS_FILE=\"${GH_AW_SAFE_OUTPUTS:-${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl}\"\nPERMISSION_BLOCKED=false\nfor LOG_FILE in \"/tmp/gh-aw/agent-stdio.log\" \"${RUNNER_TEMP}/gh-aw/agent-stdio.log\"; do\n if [ -f \"$LOG_FILE\" ] && grep -qE 'blocked by permissions in this environment.*GraphQL operation denied' \"$LOG_FILE\"; then\n PERMISSION_BLOCKED=true\n echo \"::warning::Detected permission-blocked write actions in agent output; skipping strict safe-output checks for this run.\"\n break\n fi\ndone\nif [ ! -s \"$OUTPUTS_FILE\" ]; then\n if [ \"$PERMISSION_BLOCKED\" = true ]; then\n exit 0\n fi\n echo \"::error::No safe outputs were invoked. Smoke tests require the agent to call safe output tools.\"\n exit 1\nfi\necho \"Safe output entries found: $(wc -l < \"$OUTPUTS_FILE\")\"\nif [ \"$GITHUB_EVENT_NAME\" = \"pull_request\" ]; then\n if ! grep -q '\"add_comment\"' \"$OUTPUTS_FILE\"; then\n if [ \"$PERMISSION_BLOCKED\" = true ]; then\n echo \"::warning::Skipping add_comment validation for pull_request trigger because comment/write actions were blocked by repository permissions in this environment.\"\n exit 0\n fi\n echo \"::error::Agent did not call add_comment on a pull_request trigger.\"\n exit 1\n fi\n echo \"add_comment verified for PR trigger\"\nfi\necho \"Safe output validation passed\"" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot rebase to main and recompile |
Updated: branch is now synced with latest 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Update smoke-codex.md post-steps to detect permission-blocked write actions (common in PR runs with read-only permissions). When permissions are blocked, the safe-output validation is relaxed instead of failing. The .md source is updated (not just the lock file), and the lock file is properly recompiled via gh aw compile + postprocess. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
92de574 to
44e5e54
Compare
|
Smoke Test Results:
Status: PASS
|
|
Smoke Test: Copilot BYOK — PASS ✅
Author:
|
🔥 Smoke Test Results
Overall: PASS PR author:
|
Smoke Test: GitHub Actions Services Connectivity
All checks passed. (
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Codex was failing on PR runs when Codex attempted required write actions (PR/discussion comments, labels) but the runtime environment denied them (
403/ GraphQL denied). The workflow then failed on post-step safe-output assertions even though the root cause was permissions, not agent execution flow.What changed
smoke-codex.lock.ymlpost-stepValidate safe outputs were invokedlogic to detect the known permission-denied signature from agent logs.outputs.jsonlnon-empty andadd_commentpresence) only when that explicit permission-blocked condition is present.Why this is scoped
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/repos/actions/github-script/git/ref/tags/v9/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq .object.sha(http block)https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.68.3/usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.68.3 --jq .object.sha(http block)https://api.github.com/repos/github/gh-aw/releases/latest/usr/bin/gh gh extension install github/gh-aw --pin v0.68.7(http block)If you need me to access, download, or install something from one of these locations, you can either: