Skip to content

Commit 5977aa5

Browse files
authored
Merge pull request #2847 from Hack23/copilot/fix-agent-job-failure
refactor: remove repo-memory usage and lock-file patching, favor cache-memory
2 parents dbfdc9b + c95e0d4 commit 5977aa5

21 files changed

Lines changed: 33 additions & 39 deletions

.github/copilot-instructions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,9 @@ tools:
165165
agentic-workflows: true # Workflow introspection (status, compile, logs, audit, checks)
166166
bash: true # Shell commands
167167
playwright: # Browser automation (where needed)
168-
repo-memory: # Persistent memory across runs
169-
branch-name: memory/news-generation
168+
cache-memory: # Session state persisted via GitHub Actions cache (retention configured per workflow, eviction-dependent)
169+
key: news-${{ github.workflow }}-${{ inputs.article_date || 'today' }}
170+
retention-days: 14
170171
```
171172

172173
### MCP Server Configuration (All Workflows)

.github/prompts/00-base-contract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Print `agent_minute` (helper in [`01-bash-and-shell-safety.md §Time-budget self
9797
| Aggregate + render all 14 languages | **36 – 40** | Blocked at minute 40 → commit analysis-only and PR anyway. |
9898
| Stage + commit + sandbox handoff + PR | **40 – 42** | Hard deadline **45**. |
9999

100-
No per-phase checkpoint PRs. No repo-memory push steps.
100+
No per-phase checkpoint PRs. No unnecessary memory push steps.
101101

102102
## Output contract
103103

.github/prompts/07-commit-and-pr.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ Every news workflow declares `tools.cache-memory:` keyed by `news-${{ github.wor
149149
2. After a successful Pass 1 (or after the analysis gate passes), copy the produced `.md` artifacts back to `/tmp/gh-aw/cache-memory/$ARTICLE_DATE/$SUBFOLDER/` so they are available for persistence if the workflow later fails during PR publication or another post-agent stage.
150150
3. The agent only writes to `/tmp/gh-aw/cache-memory/`; no safe-output call persists cache-memory. The compiled workflow's cache-update step runs only after a successful agent job (`needs.agent.result == 'success'`), so recovery is reliable for **post-agent failures** (PR-publication problems) but **not** for agent-job failures or timeouts.
151151

152+
**Checkout settings:** `fetch-depth: 1` is sufficient for `cache-memory`. gh-aw manages a self-contained git repo inside `/tmp/gh-aw/cache-memory/` independently of the main workspace. No special `checkout.fetch:` or `fetch-depth: 0` setting is required. Git user identity is configured by the dedicated "Configure Git credentials" step in compiled workflows, not by `actions/checkout`.
153+
154+
**Resilience:** The compiled `Commit cache-memory changes` and `Check cache-memory git integrity` steps run with `if: always()`. If a corrupted or missing `.git` directory from a restored cache causes a transient failure, the subsequent integrity-check step detects and reseeds the git repo so the artifact upload can still succeed. Cache-memory failures should not block article generation — the primary output is always committed to `analysis/daily/`.
155+
152156
Cache-memory is a recovery mechanism for the next run, not a substitute for committing real files on disk under `analysis/daily/`.
153157

154158
## PR creation resilience (`fallback-as-issue`, `if-no-changes`, host-side PAT fallback)

.github/skills/gh-aw-README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,9 @@ tools:
229229
agentic-workflows: true # Workflow introspection (status, compile, logs, audit, checks)
230230
bash: true # Shell command execution
231231
playwright: # Browser automation (optional, for visual validation)
232-
repo-memory: # Persistent memory across workflow runs
233-
branch-name: memory/news-generation
234-
allowed-extensions: [".md", ".json"]
235-
max-file-size: 51200
236-
max-file-count: 50
237-
max-patch-size: 51200
232+
cache-memory: # Session state persisted via GitHub Actions cache (retention configured per workflow)
233+
key: news-${{ github.workflow }}-${{ inputs.article_date || 'today' }}
234+
retention-days: 14
238235
```
239236

240237
### Available `agentic-workflows:` Tools

.github/skills/gh-aw-mcp-configuration/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ For Copilot coding agent sessions (not agentic workflows), MCP servers are confi
17921792
- [ ] Version MCP server APIs
17931793
- [ ] Implement graceful degradation
17941794
- [ ] Use timeout for all MCP operations
1795-
- [ ] **Prefer `repo-memory:` and `cache-memory:` over `@modelcontextprotocol/server-memory`** — gh-aw native tools are persistent across runs; generic MCP memory is ephemeral per process
1795+
- [ ] **Prefer `cache-memory:` over `@modelcontextprotocol/server-memory`** — gh-aw native cache-memory is persistent across runs (~7-14 days); generic MCP memory is ephemeral per process
17961796
- [ ] **Skip `@modelcontextprotocol/server-sequential-thinking`** — modern LLMs (Claude Opus 4.8, GPT-5) have native CoT; it wastes context tokens
17971797

17981798
---

.github/skills/gh-aw-workflow-authoring/SKILL.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,22 +1002,19 @@ Stagger schedules to avoid resource contention. Use `timeout-minutes: 5` for qui
10021002

10031003
### Cross-Run Memory Patterns
10041004

1005-
gh-aw provides three built-in memory mechanisms (prefer these over `@modelcontextprotocol/server-memory` which is ephemeral per run):
1005+
gh-aw provides two built-in memory mechanisms (prefer these over `@modelcontextprotocol/server-memory` which is ephemeral per run):
10061006

10071007
| Mechanism | Persistence | Scope | Use Case |
10081008
|-----------|------------|-------|----------|
1009-
| `repo-memory:` | Git-backed, permanent | Cross-workflow via shared branch | Shared state across workflows (e.g., dedup indexes, quality scores) |
1010-
| `cache-memory:` | GitHub Actions cache, ~7 days | Per-workflow or shared via key | Session state, intermediate results |
1009+
| `cache-memory:` | GitHub Actions cache, configurable via `retention-days` (eviction-dependent) | Per-workflow or shared via key | Session state, intermediate results, cross-run context |
10111010
| `cache:` | GitHub Actions cache | Per-workflow | Dependencies, build artifacts |
10121011

1013-
**Recommended: `repo-memory:`** for cross-workflow context:
1012+
**Recommended: `cache-memory:`** for cross-run context:
10141013
```yaml
10151014
tools:
1016-
repo-memory:
1017-
branch-name: memory/my-project
1018-
allowed-extensions: [".md", ".json"]
1019-
max-file-size: 10240
1020-
max-file-count: 100
1015+
cache-memory:
1016+
key: news-${{ github.workflow }}-${{ inputs.article_date || 'today' }}
1017+
retention-days: 14
10211018
```
10221019
10231020
**Avoid:** `@modelcontextprotocol/server-memory` — dies when the process ends, lost every run. Also skip `@modelcontextprotocol/server-sequential-thinking` — Claude has native CoT reasoning; it wastes context tokens.

.github/skills/github-agentic-workflows/SKILL.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,6 @@ tools:
665665
github:
666666
cache-memory:
667667
id: metrics-tracking
668-
repo-memory:
669-
id: historical-data
670-
branch: data/metrics
671668
---
672669
673670
Track metrics over time using memory:
@@ -680,8 +677,7 @@ Track metrics over time using memory:
680677
```
681678

682679
**Memory Types:**
683-
- **cache-memory**: 7-day retention (GitHub Actions cache)
684-
- **repo-memory**: Unlimited retention (Git branch)
680+
- **cache-memory**: Configurable retention via `retention-days` (GitHub Actions cache, eviction-dependent availability)
685681

686682
**Use Cases:**
687683
- Incremental data processing
@@ -898,21 +894,6 @@ Update calculations.
898894
Store results back to cache-memory.
899895
```
900896

901-
#### Repo Memory (Unlimited retention)
902-
903-
```yaml
904-
tools:
905-
repo-memory:
906-
id: long-term-metrics
907-
branch: data/metrics
908-
```
909-
910-
**Features:**
911-
- Permanent Git branch storage
912-
- Automatic conflict resolution
913-
- Full Git history
914-
- Accessible at `/tmp/gh-aw/repo-memory-{id}/`
915-
916897
### Concurrency Control
917898

918899
Limit simultaneous runs:

.github/workflows/news-committee-reports.lock.yml

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

.github/workflows/news-election-cycle.lock.yml

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

.github/workflows/news-evening-analysis.lock.yml

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

0 commit comments

Comments
 (0)