Skip to content

Commit ed2f6c7

Browse files
Copilotmrjf
andcommitted
Keep batched push-wiki from PR #279, add max:5 config, fix backslash pipe
Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent fd85305 commit ed2f6c7

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

workflows/agentic-wiki-writer.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ safe-outputs:
4747
protected-files: fallback-to-issue
4848
jobs:
4949
push-wiki:
50+
max: 5
5051
description: >
5152
Push generated wiki pages to the repository wiki.
5253
Pass a JSON object mapping filenames to markdown content.
@@ -240,11 +241,11 @@ If there is no `source-map.json` (first run), regenerate all pages.
240241

241242
**MANDATORY CONSTRAINTS — read carefully before generating any content:**
242243

243-
- **Send all wiki pages in a single `push-wiki` call.** Do NOT batch across multiple calls — only one `push-wiki` output is allowed per run.
244+
- **Never generate more than 4 pages per `push-wiki` call.** If there are more than 4 pages to generate, process them in sequential batches of up to 4, calling `push-wiki` once per batch.
244245
- **Never spawn a sub-agent or background agent to generate pages.** Generate all pages directly in the main conversation loop.
245246
- **Each page must be kept under 3 KB of markdown.** Keep pages focused and concise.
246-
- **The total `push-wiki` JSON payload must stay under 90 KB.** If the payload would exceed this limit, reduce page content (shorten pages, remove examples) until it fits.
247-
- **If a `push-wiki` call fails with an API error**, it is likely a timeout caused by a large payload. Reduce page content (shorten the longest pages) and retry up to 2 times. If it still fails, the error is unrecoverable — report it and stop.
247+
- **Each `push-wiki` JSON payload must stay under 30 KB total.** If a batch would exceed 30 KB (including the sidebar), split it into a smaller batch.
248+
- **If a `push-wiki` call fails with an API error**, it is likely a timeout caused by a large payload. Retry up to 2 times with progressively smaller batches (halving the batch size each retry, minimum 1 page per call). If a single-page call also fails, the error is unrecoverable — report it and stop.
248249

249250
For each page that needs regeneration:
250251

@@ -264,19 +265,26 @@ Before finalizing each page, review your generated content against the **Self-Re
264265

265266
**Do NOT use sub-agents or background agents for page generation.** Generate all pages directly in the main conversation loop.
266267

267-
Construct wiki page content as strings and pass them to the `push-wiki` safe-output as a **single JSON call containing all pages** (including `_Sidebar.md`). Only one `push-wiki` output is allowed per run — do NOT call `push-wiki` more than once.
268+
Construct wiki page content as strings and pass them to the `push-wiki` safe-output as JSON objects. **Push in batches of at most 4 pages per call** to avoid API timeouts:
268269

269-
1. Build a single JSON object mapping every filename to its markdown content.
270-
2. Include `_Sidebar.md` (generated following the **Sidebar Generation** rules below) in the same JSON object.
271-
3. Before calling `push-wiki`, estimate the total JSON payload size. **If the payload would exceed 90 KB**, shorten the longest pages (trim examples, reduce prose) until it fits.
272-
4. Call `push-wiki` exactly once with the complete JSON object.
273-
5. **If the `push-wiki` call fails with an API or timeout error**, reduce page content (shorten the longest pages) and retry up to 2 times. If it still fails, the error is unrecoverable — report it and stop.
270+
1. Divide the full list of pages into batches of up to 4 pages each.
271+
2. For each batch, build a JSON object mapping filenames to markdown content.
272+
3. Include `_Sidebar.md` (generated following the **Sidebar Generation** rules below) **only in the final batch**.
273+
4. Before calling `push-wiki`, estimate the total JSON payload size. **If the payload exceeds 30 KB, reduce the batch size** (use 2 pages per call or fewer) until it fits.
274+
5. Call `push-wiki` once per batch. Proceed to the next batch only after the current call succeeds.
275+
6. **If a `push-wiki` call fails with an API or timeout error**, halve the current batch size (minimum 1 page per call) and retry up to 2 times. API errors during generation are most often caused by large response payloads, not transient network issues. If a single-page call still fails, the error is unrecoverable — report it and stop.
274276

275-
The JSON object looks like:
277+
A single-batch JSON object looks like:
276278
```json
277279
{
278280
"Home.md": "Welcome to the project...\n\n## Overview\n...",
279-
"Architecture.md": "## System Design\n...",
281+
"Architecture.md": "## System Design\n..."
282+
}
283+
```
284+
285+
The final batch must add the sidebar:
286+
```json
287+
{
280288
"Getting-Started.md": "## Prerequisites\n...",
281289
"_Sidebar.md": "- [[Home|Home]]\n- [[Architecture|Architecture]]\n..."
282290
}

0 commit comments

Comments
 (0)