Conversation
Update three workflows that use cache-memory with round-robin rotation so that a cold start (absent or empty cache) selects a random position in the list rather than always starting at the same fixed item: - daily-function-namer: output -1 sentinel when cache is missing, then resolve to $(( RANDOM % TOTAL )) after package list is built - daily-caveman-optimizer: instruct agent to use $(( RANDOM % total_files )) for the initial index on cold start - slide-deck-maintainer: use shuf -n1 to randomly pick the first category instead of always beginning with 'documentation' Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e7394ac9-64c9-4b1b-beab-c53cab5e68ca Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e7394ac9-64c9-4b1b-beab-c53cab5e68ca Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
May 3, 2026 20:23
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts round-robin cold-start behavior for workflows that rely on cache-memory so that cache misses don’t always start at a fixed position (reducing repeated cache-miss churn on the same initial items).
Changes:
- Update
daily-function-namerpackage selection script to treat cache miss/unreadable state as a sentinel and randomize the initial index (plus add aTOTAL=0guard). - Update
daily-caveman-optimizerinstructions to randomize the initial index on cold start. - Update
slide-deck-maintainerinstructions to randomize the initial category on cold start.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/slide-deck-maintainer.md | Documents randomized category selection on cold cache for round-robin scanning. |
| .github/workflows/daily-function-namer.md | Implements cache-miss sentinel + random start index in the selection script and adds an empty-package guard. |
| .github/workflows/daily-caveman-optimizer.md | Documents random start index selection for cold-cache runs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
| # Load last_package_index from cache (default 0 if cache absent/empty) | ||
| # Load last_package_index from cache (-1 sentinel means cache is absent/empty — pick randomly later) | ||
| LAST_INDEX=$(python3 -c " | ||
| import sys, json, os |
| # On cache miss, start at a random position so repeated cold starts don't always hit the same package | ||
| if [ "$LAST_INDEX" -eq -1 ]; then | ||
| LAST_INDEX=$(( RANDOM % TOTAL )) | ||
| echo "cache_miss=true (random start at index ${LAST_INDEX})" |
|
|
||
| - If the file does not exist, start at index 0. | ||
| - If the queue in cache differs from the current file list (files added/removed), rebuild the queue from the current sorted list and reset index to 0. | ||
| - If the file does not exist, count the total number of files in the sorted list (`TOTAL=$(...)`) and pick a **random** starting index with `$(( RANDOM % TOTAL ))`. This avoids always processing the same files first when the cache is cold. |
This was referenced May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Workflows using
cache-memoryfor round-robin rotation always started from a fixed position on a cold start, causing repeated cache misses (after expiry or first run) to process the same items first every time.Changes
daily-function-namer.md— Python snippet now returns-1as a sentinel when the cache is absent/unreadable; afterTOTALis computed,-1resolves to$(( RANDOM % TOTAL )). Added an early exit guard forTOTAL=0.daily-caveman-optimizer.md— Updated instruction to use$(( RANDOM % TOTAL ))for the initial index on a cold start instead of hardcoding0.slide-deck-maintainer.md— Cold-start category selection now usesshuf -n1 -e source-code agentic-workflows documentationinstead of always defaulting todocumentation.