Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/aw/SHARED_PROMPT_PATTERNS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2672,11 +2672,15 @@ Then call the health gate:

> 🚨 **UNIVERSAL SAFE OUTPUT RULES — ALL WORKFLOWS MUST FOLLOW:**
>
> 1. **Call `safeoutputs___create_pull_request` as EARLY as possible** — the moment you have committed files. The safeoutputs MCP session has a finite lifetime. Successful runs call it by minute ~25. Failed runs that delayed past minute 40 got "session not found" and lost all work.
> 2. **Heartbeat PR to keep the safeoutputs session alive (`max: 2+`)** — the Streamable-HTTP safeoutputs MCP session has a ~30–35 min idle lifetime (observed in PR #1835 and run #24672037751). Every `safeoutputs___create_pull_request` call **resets the session idle timer**. If the workflow sets `create-pull-request.max: 2` or higher, call the tool once at minute ~22–25 as a **heartbeat PR** capturing work-in-progress (partial analysis + first article draft), then call it again at minute 40–45 with the polished final output. Each call creates a separate PR on a separate branch; the final PR supersedes the heartbeat. This pattern was proven in `news-translate` (`max: 5`, zero session expiries across 55-minute runs) and `news-realtime-monitor` (`max: 3`). **Single-PR workflows (`max: 1`) that delay their only call past minute 35 WILL lose all work to session expiry.**
> 3. **NEVER call `safeoutputs___noop` when artifacts exist.** Noop means "I did nothing." If you created files, you DID something and MUST create a PR. Partial work in a PR is infinitely better than lost work via noop.
> 4. **At HARD DEADLINE**: If ANY files were created → `safeoutputs___create_pull_request`. ONLY noop if truly ZERO files were created.
> 5. **Architecture reminder**: `safeoutputs___create_pull_request` records your intent. A separate `safe_outputs` job executes the PR creation AFTER the agent job ends. If the MCP session expires before you record the intent, the `safe_outputs` job is SKIPPED and all work is lost.
> 1. **Call `safeoutputs___create_pull_request` as EARLY as possible** — the moment you have committed files. The safeoutputs MCP session has a finite lifetime. Successful runs call it by minute ~18. Failed runs that delayed past minute 30 got "session not found" and lost all work.
> 2. **🫀 Analysis-only Heartbeat PR — MANDATORY first call by minute 18 (`max: 2+`)** — the Streamable-HTTP safeoutputs MCP session has a ~30–35 min idle lifetime (observed in PR #1835, run #24672037751, and **run #24722758908, 2026-04-21, `news-realtime-monitor`**). Every `safeoutputs___create_pull_request` call **resets the session idle timer**. The heartbeat PR MUST contain **only analysis artifacts and/or script-generated stubs that already exist on disk** — it MUST NOT wait for article-writing to complete. Article writing (especially multi-thousand-word EN + SV pieces) routinely takes 8–15 minutes and will blow the idle timer if done before the heartbeat. Pattern:
> - **PR #1 (analysis-only heartbeat, minute 13–18)**: Commit whatever files exist in `analysis/daily/$ARTICLE_DATE/.../` from Pass 1 (plus any script-generated article skeletons). Title: `🫀 Heartbeat - {workflow} - {date}`. Mark `draft: true` if the workflow supports it. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch.
> - **PR #2 (full content, minute 35–43)**: Commit finalized articles + Pass 2 improvements on a fresh branch. Final title. This supersedes the heartbeat.
> - `news-committee-reports` (minute 13–15 heartbeat) and `news-translate` (`max: 5`, first batch at minute ~18) have proven this pattern with zero session expiries. `news-realtime-monitor` run #24722758908 FAILED because it tried to include full articles in PR #1 — article writing took minutes 24→34, and the first safeoutputs call at minute 34 got `session not found`.
Comment on lines +2675 to +2679

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

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

These “UNIVERSAL SAFE OUTPUT RULES” now state a mandatory first heartbeat PR by minute 18 for all workflows, but several workflow prompts still prescribe later heartbeat windows (e.g. .github/workflows/news-motions.md:287 and news-propositions.md:291 use minutes 22–25; news-month-ahead.md:279 uses 19–21). Since all workflows runtime-import this shared file, this introduces conflicting guidance. Either relax this rule to allow per-workflow heartbeat timing (while keeping the “analysis-only before articles” constraint), or update the affected workflow prompts in the same change set.

Suggested change
> 1. **Call `safeoutputs___create_pull_request` as EARLY as possible** — the moment you have committed files. The safeoutputs MCP session has a finite lifetime. Successful runs call it by minute ~18. Failed runs that delayed past minute 30 got "session not found" and lost all work.
> 2. **🫀 Analysis-only Heartbeat PR — MANDATORY first call by minute 18 (`max: 2+`)** — the Streamable-HTTP safeoutputs MCP session has a ~30–35 min idle lifetime (observed in PR #1835, run #24672037751, and **run #24722758908, 2026-04-21, `news-realtime-monitor`**). Every `safeoutputs___create_pull_request` call **resets the session idle timer**. The heartbeat PR MUST contain **only analysis artifacts and/or script-generated stubs that already exist on disk** — it MUST NOT wait for article-writing to complete. Article writing (especially multi-thousand-word EN + SV pieces) routinely takes 8–15 minutes and will blow the idle timer if done before the heartbeat. Pattern:
> - **PR #1 (analysis-only heartbeat, minute 13–18)**: Commit whatever files exist in `analysis/daily/$ARTICLE_DATE/.../` from Pass 1 (plus any script-generated article skeletons). Title: `🫀 Heartbeat - {workflow} - {date}`. Mark `draft: true` if the workflow supports it. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch.
> - **PR #2 (full content, minute 35–43)**: Commit finalized articles + Pass 2 improvements on a fresh branch. Final title. This supersedes the heartbeat.
> - `news-committee-reports` (minute 13–15 heartbeat) and `news-translate` (`max: 5`, first batch at minute ~18) have proven this pattern with zero session expiries. `news-realtime-monitor` run #24722758908 FAILED because it tried to include full articles in PR #1 — article writing took minutes 24→34, and the first safeoutputs call at minute 34 got `session not found`.
> 1. **Call `safeoutputs___create_pull_request` as EARLY as possible** — the moment you have committed files. The safeoutputs MCP session has a finite lifetime. Successful runs commonly call it by minute ~18. Failed runs that delayed past minute 30 got "session not found" and lost all work.
> 2. **🫀 Analysis-only Heartbeat PR — REQUIRED as the first safeoutputs call (`max: 2+`)** — the Streamable-HTTP safeoutputs MCP session has a ~30–35 min idle lifetime (observed in PR #1835, run #24672037751, and **run #24722758908, 2026-04-21, `news-realtime-monitor`**). Every `safeoutputs___create_pull_request` call **resets the session idle timer**. The heartbeat PR MUST contain **only analysis artifacts and/or script-generated stubs that already exist on disk** — it MUST NOT wait for article-writing to complete. Article writing (especially multi-thousand-word EN + SV pieces) routinely takes 8–15 minutes and will blow the idle timer if done before the heartbeat. **Default target window is minute 13–18, unless the workflow prompt explicitly specifies another first-heartbeat window. Workflow-specific timing may vary, but the first PR must still happen before article writing and early enough to avoid session expiry.** Pattern:
> - **PR #1 (analysis-only heartbeat, workflow-specific timing; default minute 13–18)**: Commit whatever files exist in `analysis/daily/$ARTICLE_DATE/.../` from Pass 1 (plus any script-generated article skeletons). Title: `🫀 Heartbeat - {workflow} - {date}`. Mark `draft: true` if the workflow supports it. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch.
> - **PR #2 (full content, typically minute 35–43)**: Commit finalized articles + Pass 2 improvements on a fresh branch. Final title. This supersedes the heartbeat.
> - `news-committee-reports` (minute 13–15 heartbeat) and `news-translate` (`max: 5`, first batch at minute ~18) have proven this pattern with zero session expiries. Some other workflows may intentionally use slightly later first-heartbeat windows in their own prompts. `news-realtime-monitor` run #24722758908 FAILED because it tried to include full articles in PR #1 — article writing took minutes 24→34, and the first safeoutputs call at minute 34 got `session not found`.

Copilot uses AI. Check for mistakes.
> 3. **NEVER wait for articles before the first safeoutputs call.** If the workflow needs article content in a PR, that's PR #2. PR #1 exists solely to refresh the session and preserve whatever analysis has been completed. A heartbeat PR with 3 analysis files is infinitely more valuable than 10 articles lost to session expiry.
> 4. **NEVER call `safeoutputs___noop` when artifacts exist.** Noop means "I did nothing." If you created files, you DID something and MUST create a PR. Partial work in a PR is infinitely better than lost work via noop.
> 5. **At HARD DEADLINE**: If ANY files were created → `safeoutputs___create_pull_request`. ONLY noop if truly ZERO files were created.
> 6. **Architecture reminder**: `safeoutputs___create_pull_request` records your intent. A separate `safe_outputs` job executes the PR creation AFTER the agent job ends. If the MCP session expires before you record the intent, the `safe_outputs` job is SKIPPED and all work is lost. **Single-PR workflows (`max: 1`) that delay their only call past minute 30 WILL lose all work.**

### Layer 3: MCP Gateway Diagnostics (run when tools fail)

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/news-realtime-monitor.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading