Skip to content

Commit 7423d16

Browse files
authored
Treat Daily Go Function Namer cache cold starts as expected state (#31331)
1 parent 899eaf6 commit 7423d16

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/daily-function-namer.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ The script outputs:
131131

132132
Use these values directly for the rest of the workflow. Do **not** re-derive or re-compute them manually.
133133

134+
**On cold start** (`/tmp/gh-aw/cache-memory/function-namer-state.json` missing): treat this as expected initialization, not a failure. Do **not** call `missing_data` for a missing state file on first run or cold cache; run the Step 1 script as written, accept `LAST_INDEX=-1`, and continue.
135+
134136
## Step 2: Enumerate All Functions in the Package
135137

136138
Before invoking Serena, run a fast `grep` sweep across all files in the selected package to build a complete function inventory. This minimizes Serena tool calls by giving you the full picture upfront:
@@ -242,6 +244,8 @@ Use relative paths (e.g., `pkg/workflow`) matching the output of the `find pkg`
242244

243245
Prune `analyzed_packages` to the most recent 30 entries to prevent unbounded growth.
244246

247+
If the state file was missing at the start of the run, initialize it from scratch here instead of reporting missing cache data.
248+
245249
## Step 6: Create Issue with Agentic Plan
246250

247251
If any rename suggestions were found across the analyzed package, create a GitHub issue.

pkg/workflow/prompts_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,30 @@ This is a test workflow with multiple cache-memory entries.
217217
t.Logf("Successfully verified cache memory instructions handle multiple caches")
218218
}
219219

220+
func TestDailyFunctionNamerColdStartHandling(t *testing.T) {
221+
repoRoot, err := findRepoRoot()
222+
if err != nil {
223+
t.Fatalf("Failed to find repo root: %v", err)
224+
}
225+
226+
workflowFile := filepath.Join(repoRoot, ".github", "workflows", "daily-function-namer.md")
227+
content, err := os.ReadFile(workflowFile)
228+
if err != nil {
229+
t.Fatalf("Failed to read workflow file: %v", err)
230+
}
231+
232+
workflow := string(content)
233+
coldStartGuidance := "**On cold start** (`/tmp/gh-aw/cache-memory/function-namer-state.json` missing): treat this as expected initialization, not a failure. Do **not** call `missing_data` for a missing state file on first run or cold cache; run the Step 1 script as written, accept `LAST_INDEX=-1`, and continue."
234+
if !strings.Contains(workflow, coldStartGuidance) {
235+
t.Fatal("Expected daily-function-namer workflow to include explicit cold-start guidance")
236+
}
237+
238+
stepFiveGuidance := "If the state file was missing at the start of the run, initialize it from scratch here instead of reporting missing cache data."
239+
if !strings.Contains(workflow, stepFiveGuidance) {
240+
t.Fatal("Expected daily-function-namer workflow to initialize missing cold-start state instead of reporting missing data")
241+
}
242+
}
243+
220244
// ============================================================================
221245
// Playwright Prompt Tests
222246
// ============================================================================

0 commit comments

Comments
 (0)