Skip to content

Commit dc975ed

Browse files
docs: consolidate WorkQueueOps and BatchOps patterns into dev.md (v5.5) (#25274)
1 parent 9b4374e commit dc975ed

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

scratchpad/dev.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Developer Instructions
22

3-
**Version**: 5.4
4-
**Last Updated**: 2026-04-07
3+
**Version**: 5.5
4+
**Last Updated**: 2026-04-08
55
**Purpose**: Consolidated development guidelines for GitHub Agentic Workflows
66

77
This document consolidates specifications from the scratchpad directory into unified developer instructions. It provides architecture patterns, security guidelines, code organization rules, and testing practices.
@@ -1915,6 +1915,50 @@ Enable debug logging to trace transformations:
19151915
DEBUG=workflow:expression_extraction gh aw compile workflow.md
19161916
```
19171917

1918+
### WorkQueueOps Pattern
1919+
1920+
WorkQueueOps processes a backlog of work items incrementally — surviving interruptions, rate limits, and multi-day horizons. Use it when operations are idempotent and progress visibility matters. Four queue strategies are available:
1921+
1922+
| Strategy | Backend | Best For |
1923+
|----------|---------|----------|
1924+
| Issue Checklist | GitHub issue checkboxes | Small batches (< 100 items), human-readable |
1925+
| Sub-Issues | Sub-issues of a parent tracking issue | Hundreds of items with per-item discussion threads |
1926+
| Cache-Memory | JSON file in `/tmp/gh-aw/cache-memory/` | Large queues, multi-day horizons, programmatic items |
1927+
| Discussion Queue | GitHub Discussion unresolved replies | Community-sourced queues, async collaboration |
1928+
1929+
**Idempotency requirements**: All WorkQueueOps workflows must be idempotent. Use `concurrency.group` with `cancel-in-progress: false` to prevent parallel runs processing the same item. Check current state before acting (label present? comment exists?).
1930+
1931+
**Concurrency control**: Set `concurrency.group` scoped to the queue identifier (e.g., `workqueue-${{ inputs.queue_issue }}`).
1932+
1933+
**Cache-memory filename convention**: Use filesystem-safe timestamps (`YYYY-MM-DD-HH-MM-SS-sss`, no colons) in filenames.
1934+
1935+
See `docs/src/content/docs/patterns/workqueue-ops.md` for complete examples.
1936+
1937+
### BatchOps Pattern
1938+
1939+
BatchOps processes large volumes of independent work items efficiently by splitting work into chunks and parallelizing where possible. Use it when items are independent and throughput matters over ordering.
1940+
1941+
**When to use BatchOps vs WorkQueueOps**:
1942+
1943+
| Scenario | Pattern |
1944+
|----------|---------|
1945+
| < 50 items, order matters | WorkQueueOps |
1946+
| 50–500 items, order doesn't matter | BatchOps (chunked) |
1947+
| > 500 items, high parallelism safe | BatchOps (matrix fan-out) |
1948+
| Items have dependencies | WorkQueueOps |
1949+
| Strict rate limits | BatchOps (rate-limit-aware) |
1950+
1951+
Four batch strategies are available:
1952+
1953+
- **Chunked processing**: Split by `GITHUB_RUN_NUMBER` page offset; each scheduled run processes one page with a stable sort key
1954+
- **Fan-out with matrix**: Use GitHub Actions `matrix` to run parallel shards; assign items by `issue_number % total_shards`; set `fail-fast: false`
1955+
- **Rate-limit-aware**: Process items in sub-batches with explicit pauses; on HTTP 429 pause 60 seconds and retry once
1956+
- **Result aggregation**: Collect results from multiple runs via cache-memory; aggregate into a summary issue
1957+
1958+
**Error handling**: Track `retry_count` per failed item; after 3 failures move to `permanently_failed` for human review. Write per-item results before advancing to the next item.
1959+
1960+
See `docs/src/content/docs/patterns/batch-ops.md` for complete examples.
1961+
19181962
---
19191963

19201964
## MCP Integration
@@ -2737,6 +2781,8 @@ These files are loaded automatically by compatible AI tools (e.g., GitHub Copilo
27372781
- [Safe Output Handler Factory Pattern](./safe-output-handlers-refactoring.md) - Refactoring status for all 11 safe output handlers to the handler factory pattern (`main(config)` returns a message handler function): per-handler status, testing strategy, and handler manager compatibility
27382782
- [Serena Tools Statistical Analysis](./serena-tools-analysis.md) - Deep statistical analysis of Serena MCP tool usage in workflow run 21560089409: tool adoption rates (26% of registered tools used), call distributions, and unused tool identification
27392783
- [GitHub API Rate Limit Observability](./github-rate-limit-observability.md) - JSONL artifact logging and OTLP span enrichment for GitHub API rate-limit visibility: `github_rate_limit_logger.cjs` helper, three usage patterns, artifact upload paths, and `jq` debugging commands
2784+
- [WorkQueueOps Design Pattern](../docs/src/content/docs/patterns/workqueue-ops.md) - Four queue strategies (issue checklist, sub-issues, cache-memory, discussion-based) for incremental backlog processing: idempotency requirements, concurrency control, and retry budgets
2785+
- [BatchOps Design Pattern](../docs/src/content/docs/patterns/batch-ops.md) - Four batch strategies (chunked, matrix fan-out, rate-limit-aware, result aggregation) for high-volume parallel processing: shard assignment, partial failure handling, and real-world label migration example
27402786

27412787
### External References
27422788

@@ -2748,6 +2794,7 @@ These files are loaded automatically by compatible AI tools (e.g., GitHub Copilo
27482794
---
27492795

27502796
**Document History**:
2797+
- v5.5 (2026-04-08): Added WorkQueueOps and BatchOps design pattern subsections to Workflow Patterns (from PR #25178: four queue strategies — issue checklist, sub-issues, cache-memory, discussion-based; four batch strategies — chunked, matrix fan-out, rate-limit-aware, result aggregation). Added 2 new Related Documentation links for `docs/src/content/docs/patterns/workqueue-ops.md` and `batch-ops.md`. Coverage: 75 spec files (2 new pattern docs).
27512798
- v5.4 (2026-04-07): Added `gh-aw.github.rate_limit.reset` OTLP span attribute to GitHub API Rate Limit Observability section (from PR #25061: ISO 8601 reset timestamp now included in conclusion spans). Coverage: 73 spec files (no new spec files).
27522799
- v5.3 (2026-04-05): Added GitHub API Rate Limit Observability subsection to MCP Integration (from PR #24694: `github_rate_limit_logger.cjs`, `GithubRateLimitsFilename` constant, artifact upload paths, OTLP span enrichment). Created new spec file `scratchpad/github-rate-limit-observability.md`. Added 1 new Related Documentation link. Coverage: 73 spec files (1 new).
27532800
- v5.2 (2026-04-04): Added Secrets in Custom Steps Validation subsection to Compiler Validation (from PR #24450: `pkg/workflow/strict_mode_steps_validation.go`). Documents `validateStepsSecrets()` behavior in strict vs. non-strict mode, `secrets.GITHUB_TOKEN` exemption, and migration guidance. Coverage: 72 spec files (no new spec files; new Go implementation only).

0 commit comments

Comments
 (0)