Repository navigation
Fix docs: custom safe-output jobs run once per run, not once per tool call - #50635
Conversation
|
Thanks for working on this documentation fix! 📚 The issue you're addressing is well-scoped and directly improves our docs' accuracy — catching and correcting the silent data loss footgun around custom job execution is valuable. Current Status
Next Steps
Keep the PR description updated as you make progress, and you're all set! 🚀
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Corrects custom safe-output job invocation documentation and clarifies job/script behavior.
Changes:
- Documents once-per-run custom jobs and
.items[]iteration. - Updates the scripts-versus-jobs comparison and secret-handling guidance.
Show a summary per file
| File | Description |
|---|---|
docs/src/content/docs/reference/custom-safe-outputs.md |
Clarifies safe-output invocation and processing models. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Balanced
| The `inputs:` schema serves as both the MCP tool definition visible to the agent and validation for the output fields written to `GH_AW_AGENT_OUTPUT`. | ||
|
|
||
| > [!IMPORTANT] | ||
| > A custom job runs **once per workflow run**, not once per tool call. If the agent calls the tool multiple times, every call is collected into the `.items[]` array of the single `GH_AW_AGENT_OUTPUT` file. Your job must iterate over `.items[]` (for example with `jq -c '.items[] | select(.type == "my_job")'`) to process all calls. Reading only `.items[0]` silently drops every call after the first — the run still succeeds, so the data loss is easy to miss. |
| > [!IMPORTANT] | ||
| > A custom job runs **once per workflow run**, not once per tool call. If the agent calls the tool multiple times, every call is collected into the `.items[]` array of the single `GH_AW_AGENT_OUTPUT` file. Your job must iterate over `.items[]` (for example with `jq -c '.items[] | select(.type == "my_job")'`) to process all calls. Reading only `.items[0]` silently drops every call after the first — the run still succeeds, so the data loss is easy to miss. | ||
| > | ||
| > Because inline [scripts](#inline-script-handlers-safe-outputsscripts) cannot access repository secrets, any per-item handler that needs a secret (for example to call an external API with a token) must be a job — and therefore must loop over `.items[]` itself. |
|
🎉 This pull request is included in a new release. Release: |
docs/reference/custom-safe-outputs.mdincorrectly claimedsafe-outputs.jobscustom jobs run once per agent tool call. The compiler emits a single job per workflow run (nostrategy: matrix), so all calls are collected into.items[]. The wrong model leads to silent data loss: implementing against it, you read.items[0]and drop every call after the first — with no error.Changes
Slower (new job per call)→Slower (one job per run), and added anInvocationrow contrasting scripts (per call) vs jobs (per run).[!IMPORTANT]note in the jobs section: the job must iterate.items[], and reading.items[0]silently drops later calls.The doc example already uses the correct once-per-run pattern:
Docs-only change; no code or workflows touched.