-
Notifications
You must be signed in to change notification settings - Fork 312
feat: dynamic function budget for daily-function-namer (replace fixed 3-file limit) #22151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||
| --- | ||||||||
| name: Daily Go Function Namer | ||||||||
| description: Analyzes up to 3 Go files daily using Serena to extract function names and suggest renames that improve agent discoverability, using round-robin via cache-memory | ||||||||
| description: Analyzes Go files daily using Serena to extract function names and suggest renames that improve agent discoverability, using round-robin via cache-memory with a dynamic function budget | ||||||||
| on: | ||||||||
| schedule: daily | ||||||||
| workflow_dispatch: | ||||||||
|
|
@@ -30,8 +30,7 @@ tools: | |||||||
| cache-memory: true | ||||||||
| github: | ||||||||
| toolsets: [default, issues] | ||||||||
| bash: | ||||||||
| - "find pkg -name '*.go' ! -name '*_test.go' -type f | sort" | ||||||||
| bash: true | ||||||||
|
|
||||||||
| timeout-minutes: 30 | ||||||||
| strict: true | ||||||||
|
|
@@ -43,7 +42,7 @@ You are an AI agent that analyzes Go functions daily to improve their names for | |||||||
|
|
||||||||
| ## Mission | ||||||||
|
|
||||||||
| Each day, analyze up to **3 Go source files** using round-robin rotation across all non-test Go files in `pkg/`. For each file: | ||||||||
| Each day, analyze up to **6 Go source files** using round-robin rotation across all non-test Go files in `pkg/`, driven by a **dynamic function budget** of 25 functions per run. For each file: | ||||||||
|
|
||||||||
| 1. Extract all function and method names using Serena | ||||||||
| 2. Evaluate each name's clarity and intent | ||||||||
|
|
@@ -57,52 +56,71 @@ Each day, analyze up to **3 Go source files** using round-robin rotation across | |||||||
| - **Workspace**: ${{ github.workspace }} | ||||||||
| - **Cache**: `/tmp/gh-aw/cache-memory/` | ||||||||
|
|
||||||||
| ## Step 1: Load Round-Robin State from Cache | ||||||||
| ## Step 1: Compute File Selection with Code | ||||||||
|
|
||||||||
| Read the current rotation position from cache: | ||||||||
| Run this script to load the round-robin state, enumerate all Go files, and compute which files to analyze this run using the dynamic function budget: | ||||||||
|
|
||||||||
| ```bash | ||||||||
| cat /tmp/gh-aw/cache-memory/function-namer-state.json | ||||||||
| # Load last_index from cache (default 0 if cache absent/empty) | ||||||||
| LAST_INDEX=$(python3 -c " | ||||||||
| import sys, json, os | ||||||||
| p = '/tmp/gh-aw/cache-memory/function-namer-state.json' | ||||||||
| if os.path.exists(p): | ||||||||
| try: | ||||||||
| d = json.load(open(p)) | ||||||||
| print(d.get('last_index', 0)) | ||||||||
| except Exception: | ||||||||
| print(0) | ||||||||
| else: | ||||||||
| print(0) | ||||||||
| ") | ||||||||
|
|
||||||||
| # Enumerate all non-test Go source files in sorted order | ||||||||
| mapfile -t ALL_FILES < <(find pkg -name '*.go' ! -name '*_test.go' -type f | sort) | ||||||||
| TOTAL=${#ALL_FILES[@]} | ||||||||
|
|
||||||||
| echo "total_files=${TOTAL}" | ||||||||
| echo "last_index=${LAST_INDEX}" | ||||||||
|
|
||||||||
| # Greedy selection: up to 8 candidates, budget=25 functions, cap=6 files | ||||||||
| SELECTED=() | ||||||||
| TOTAL_FNS=0 | ||||||||
| BUDGET=25 | ||||||||
| CAP=6 | ||||||||
|
|
||||||||
| for i in $(seq 0 7); do | ||||||||
| if [ ${#SELECTED[@]} -ge $CAP ]; then | ||||||||
| break | ||||||||
| fi | ||||||||
| idx=$(( (LAST_INDEX + i) % TOTAL )) | ||||||||
| f="${ALL_FILES[$idx]}" | ||||||||
| COUNT=$(grep -c "^func " "$f" 2>/dev/null || echo 0) | ||||||||
|
||||||||
| COUNT=$(grep -c "^func " "$f" 2>/dev/null || echo 0) | |
| COUNT=$(grep -c "^func " "$f" 2>/dev/null || true) | |
| COUNT=${COUNT:-0} |
Copilot
AI
Mar 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue template placeholder Function Budget: <total_functions_analyzed> ... doesn’t correspond to any named output from Step 1 (which emits total_functions_approx). Consider aligning the placeholder/name with the script output (or clarify that it should be the approximate count) to avoid confusion when the agent fills in the issue body.
| **Function Budget**: <total_functions_analyzed> functions across <selected_count> files | |
| **Function Budget**: ~<total_functions_approx> functions across <selected_count> files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
tools.bash: truegrants unrestricted Bash execution for the agent. If least-privilege is desired, keep an explicit allowlist of the specific commands needed by the selection script (e.g.,python3,find,sort,grep,seq, etc.) instead of full Bash.