Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Self-scan context pack: per-issue "read file:X-Y" pointers from the master DB for churn workers

Aperta
#5,521 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
44/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github, python
Ambito
devtools, tooling

Direzione di ricerca

Start by reading tests/tools/self_scan.py, the self-scan orientation doc, and the master DB schema for file_data, function_data, class_data, fcall_data, and edge_data. Build the context pack around the issue text, then check its output and token cap against the listed fixture cases and five recent closed churn issues. Done means the tests pass, each pack stays within 3,000 tokens and names files changed by the merged PRs, runtime stays under 10 seconds, and the stated doc fixes are handled.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement performance scope:infra

Why

A cost audit of nyx's churn workers (2026-10-18, 16 worker sessions, 10 merged PRs at ~$2/PR) found:

  • Workers get only the issue number and title. Each one finds the code itself, taking 5-14 grep/sed -n requests before its first edit. Orientation accounts for ~45% of worker spend, though most of that is the fixed ~40k-token starting context that every request re-reads.
  • Whole-file reads are the main trap. gitgalaxy/core/detector.py is ~135k tokens, and seven files are over 60k tokens each. The golden-master JSON fixtures run up to 606k lines.
  • The self-scan already has what is needed to point a worker straight at the code, but nothing turns it into a per-issue slice:
    • The master DB's function_data has start_line, loc, complexity, fan-in/fan-out and token_mass.
    • fcall_data holds the resolved call graph and edge_data the import edges.
    • file_data has token_mass, churn and blast radius.
    • The existing LLM brief (_llm.md) is ~137 KB (~34k tokens), too big to inject.

What

Add a tool, e.g. tests/tools/context_pack.py <issue> [--db docs/self_scan/gitgalaxy_master.db] [--max-tokens 3000]. Given an issue, it would:

  1. Pull out the paths, file names, function, class and symbol names, and backticked identifiers named in the issue body and title (gh issue view --json title,body).
  2. Resolve them against the master DB (file_data, function_data, class_data). Fuzzy-match bare names and rank matches by how often they are mentioned.
  3. For each hit, emit path:start-end (from start_line + loc), complexity and token size. Add one hop of callers and callees from fcall_data, each with its own path:start-end, and import fan-in from edge_data.
  4. Flag large files (token_mass > 8k, as dev_agent_firewall does) with "read only the named ranges".
  5. Print a Markdown block capped at about 1-3k tokens that a worker brief can include verbatim. If nothing resolves, print nothing; never pad.

Freshness: keep one DB per origin/main commit (tests/tools/self_scan.py already does delta mode, ~6-8 s; a full scan is ~1.5 min). Run the pack before the worker launches, so a stale DB is off by at most the commits since the last refresh. Line ranges are hints and the worker still reads the code.

Integration (separate PR in squid-protocol/promoter-bot): churn worker runs the tool and adds its output to prompt.md under "Where to look". That is a few lines once the tool exists.

Related cleanups found during the audit

  • CLAUDE.md:103 points agents at docs/gitgalaxy_architecture_brief.md. That file moved to the generated branch, so a local checkout has nothing there.
  • docs/agents/self-scan-orientation.md says the DB "has no line numbers". That is stale: function_data.start_line is populated.
  • Delta-mode briefs written into worker worktrees (e.g. churn-5464_galaxy_llm.md) report "0 analyzed artifact(s), 0 LOC". Either fix them or stop writing them.

Acceptance

  • context_pack.py produces a pack of 3k tokens or less for at least 5 recent closed churn issues, and for each one the pack names the file(s) the merged PR actually changed. Show the hit rate in the PR body.
  • Unit tests on a small fixture DB: exact path, bare function name, class name, no matches (empty output) and the token cap.
  • Runs in under 10 s against an existing DB. It needs no network access apart from gh issue view, and it accepts --body-file for offline use.
  • The doc fixes above.
  • Follow-up issue or PR filed on promoter-bot to wire it into churn worker.
Lingua principale
Python
Stelle
57
Fork
11
Merge medio
1h 41m
PR unite (30g)
978

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di squid-protocol/gitgalaxy

Tutte le issue di squid-protocol/gitgalaxy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.