Skip to content

Commit b2506c6

Browse files
CopilotlpcoxCopilot
authored
fix: tolerate permission-blocked safe outputs in Smoke Codex (#2116)
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: Landon Cox <landon.cox@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c1877ce commit b2506c6

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

.github/workflows/smoke-codex.lock.yml

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/smoke-codex.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,32 @@ post-steps:
5757
- name: Validate safe outputs were invoked
5858
run: |
5959
OUTPUTS_FILE="${GH_AW_SAFE_OUTPUTS:-${RUNNER_TEMP}/gh-aw/safeoutputs/outputs.jsonl}"
60+
61+
# Detect permission-blocked writes (PR runs with read-only permissions)
62+
PERMISSION_BLOCKED=false
63+
for LOG_FILE in "/tmp/gh-aw/agent-stdio.log" "${RUNNER_TEMP}/gh-aw/agent-stdio.log"; do
64+
if [ -f "$LOG_FILE" ] && grep -qE 'blocked by permissions in this environment|GraphQL operation denied' "$LOG_FILE"; then
65+
PERMISSION_BLOCKED=true
66+
echo "::warning::Detected permission-blocked write actions in agent output; relaxing safe-output checks."
67+
break
68+
fi
69+
done
70+
6071
if [ ! -s "$OUTPUTS_FILE" ]; then
72+
if [ "$PERMISSION_BLOCKED" = true ]; then
73+
echo "Safe outputs empty but permissions were blocked — skipping validation."
74+
exit 0
75+
fi
6176
echo "::error::No safe outputs were invoked. Smoke tests require the agent to call safe output tools."
6277
exit 1
6378
fi
6479
echo "Safe output entries found: $(wc -l < "$OUTPUTS_FILE")"
6580
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
6681
if ! grep -q '"add_comment"' "$OUTPUTS_FILE"; then
82+
if [ "$PERMISSION_BLOCKED" = true ]; then
83+
echo "add_comment missing but permissions were blocked — skipping."
84+
exit 0
85+
fi
6786
echo "::error::Agent did not call add_comment on a pull_request trigger."
6887
exit 1
6988
fi

0 commit comments

Comments
 (0)