[pr-clusters] Merged PR clusters - 2026-11-30 - run 46386695563/1

Aperta
#999 0 commenti 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
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
ai, tooling

Direzione di ricerca

The issue describes the pr-clusters-online-registry.ts rig and its clustering workflow, but does not say what change is wanted. Start by reading that file and the linked run’s output to understand the workflow and its current behavior. The issue provides no completion criteria, so a newcomer would need the requested outcome clarified before starting.

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

Descrizione

ai-agent automation
Overview
Top three clusters
Rank Theme PRs % of corpus Summary
1 Dependency upgrades and npm registry configuration (o00751) 8 16% Upgrades dependencies, agent runtimes and tooling, and configures npm installs to use the approved registry feed.
2 Claude dynamic-workflow compatibility docs and links (o00927) 7 14% Fixes broken reference links and improves Claude-port sample guidance for dynamic-workflow conversion in rig.
3 Provider integration workflow fixes and setup docs (o00890) 6 12% Fixes provider-specific request settings, routing and credential docs so Pi, DeepSeek and Gemini integration runs reach the Rig judges.
Cluster details
  • o00751 Dependency upgrades / npm registry: dependabot bumps plus gh-aw / agent runtime upgrades and npm feed configuration. Representative: #751, #754, #765, #770, #831. All members: 751, 754, 765, 770, 831, 886, 888, 905.
  • o00927 Claude dynamic-workflow compat: Representative: #927, #941, #955, #965, #973. All members: 927, 941, 955, 965, 973, 981, 990.
  • o00890 Provider integration fixes: Representative: #890, #893, #894, #910, #915. All members: 890, 893, 894, 910, 915, 940.
Outside the top three

9 further clusters hold 25 PRs: o00734 new rig samples (5: 734, 926, 945, 954, 964); o00934 Actions failure repair (4: 934, 935, 948, 978); o00744 rig.ts header refresh (3: 744, 906, 961); o00916 Copilot integration driver (3: 916, 923, 947); o00891 integration test coverage (2: 891, 892); o00914 dependency setup before firewall (2: 914, 917); o00924 decomposition benchmark reliability (2: 924, 946); o00932 samples runnable in stdin mode (2: 932, 977); o00933 retired model updates (2: 933, 938).

4 PRs are unclassified, each because it opened its own cluster and attracted no peers: #931 (launcher test fixture flakiness in release preflight), #949 (schema helper and workflow authoring guidance), #950 (Codex integration fixture environment fixes), #993 (native structured-output support and engine capability docs).

Strategy comparison
  • History consulted: all 13 records (37680026048-1, 38039912415-2, 38126880290-1, 40477786734-1, 40661045982-1, 45005503491-1, 45361254701-1, 45553032858-1, 45581461634-1, 45771811713-1, 45970215617-1, 46128492209-1, 46245325031-1); full source read for the five most recent plus the map-reduce and seed-assign rigs.
  • Strategy: chronological online registry clustering. PRs sorted by mergedAt are streamed in batches of 5; a model sees the evolving registry (id, size, label, summary) and places each PR into an existing cluster or opens a new one, optionally refining labels; one final model call proposes merges; TypeScript validates every response, assigns IDs, ranks, and turns singletons into unclassified. 11 model calls.
  • Nearest prior: map-reduce-local-group-merge (45581461634-1), also seed-and-assign (45970215617-1).
  • Behavioral differences: map-reduce chunked by PR number into independent chunks with a descriptor-only reduce; seed-and-assign fixed lexical anchors. Here the process is sequential and stateful, the cluster set is open-ended, later PRs see earlier clusters, and labels are refined in-stream. No seeds, vocabulary, graph or recursion.
  • Evidence: title plus 250-char URL-stripped body excerpt, merge time.
  • Limitations: order effects (early clusters absorb later PRs); singletons are only unclassified, not re-attempted; no measured comparison with other strategies, so no claim of being better.
  • Lessons: run_rig worked first try; node lint/typecheck commands worked; consider a second pass to re-place singletons.
Rig source

Source SHA-256: fe3d93a19fd9ef09e5a9773367beaa2de97013086cf0ac8555fa7b4f8e9d4bb1 (7399 bytes). Repo-memory record: 46386695563-1.json (branch memory/pr-cluster-rigs; persisted by the trusted job after this run).

pr-clusters-online-registry.ts
import { agent, s, workflow } from "rig";
import { readFileSync } from "node:fs";

type Pr = { number: number; title: string; body?: string; mergedAt: string };
type Cl = { label: string; summary: string; prs: number[] };

// Agent role: place each PR of a chronological batch into an existing cluster or open a new one.
const placeBatch = agent({
  name: "placeBatch",
  model: "small",
  input: s.object({ registry: s.string, batch: s.string }),
  output: s.object({
    placements: s.array(s.object({ pr: s.int, cluster: s.string })),
    newClusters: s.array(s.object({ key: s.string, label: s.string, summary: s.string })),
    updates: s.array(s.object({ id: s.string, label: s.string, summary: s.string })),
  }),
  instructions:
    "REGISTRY lists current clusters as 'id | size | label | summary' (may be empty). BATCH lists PRs as 'number | title | body excerpt'. For every BATCH PR give placement cluster = an existing registry id, or 'new:<key>' for a new cluster whose key you also declare in newClusters with a specific engineering-concern label and a one-sentence summary. Several PRs may share one new key. Prefer joining an existing cluster only when the concern is genuinely the same. Optionally refine an existing cluster label/summary in updates (else empty). Every batch number exactly once; use only listed numbers and ids.",
});

// Agent role: propose merges of near-duplicate clusters from the final registry.
const consolidate = agent({
  name: "consolidate",
  model: "small",
  input: s.object({ registry: s.string }),
  output: s.object({
    merges: s.array(s.object({ ids: s.array(s.string), label: s.string, summary: s.string })),
  }),
  instructions:
    "REGISTRY lists clusters as 'id | size | label | summary'. Return merges only for clusters describing the same engineering concern; each merge lists 2+ ids, a merged label and a one-sentence summary. Each id appears in at most one merge. Return an empty list if none should merge.",
});

const clean = (t = "") => t.replace(/https?:\S+/g, "").replace((s/redacted)+/g, " ").trim();
const text = (v: string, what: string) => {
  if (!v.trim()) throw new Error(`empty ${what}`);
  return v.trim();
};

// Workflow role: chronological online clustering with an evolving cluster registry, then consolidation.
export default workflow({
  meta: {
    name: "online-registry-clustering",
    description: "Chronological batches placed into an evolving model-maintained cluster registry, consolidated once, validated in TypeScript",
    phases: ["Place", "Consolidate", "Validate"],
  },
  body: async ({ call, phase }) => {
    const corpus = JSON.parse(readFileSync("/tmp/gh-aw/agent/merged-prs.json", "utf8"));
    const prs: Pr[] = [...corpus.prs].sort((a: Pr, b: Pr) => a.mergedAt.localeCompare(b.mergedAt) || a.number - b.number);
    const byNum = new Map(prs.map((p) => [p.number, p]));
    if (prs.length === 0 || byNum.size !== prs.length) throw new Error("bad corpus");

    phase("Place");
    const reg = new Map<string, Cl>();
    let next = 1;
    const batches: Pr[][] = [];
    for (let i = 0; i < prs.length; i += 5) batches.push(prs.slice(i, i + 5));
    if (batches.length + 1 > 38) throw new Error("call budget exceeded");
    const show = () => [...reg].map(([id, c]) => `${id} | ${c.prs.length} | ${c.label} | ${c.summary}`).join("\n");
    for (const [bi, b] of batches.entries()) {
      const r = await call(
        placeBatch,
        { registry: show() || "(empty)", batch: b.map((p) => `${p.number} | ${p.title} | ${clean(p.body).slice(0, 250)}`).join("\n") },
        { label: `place${bi}` },
      );
      if (!r) throw new Error(`missing placement ${bi}`);
      const want = new Set(b.map((p) => p.number));
      const keys = new Map<string, string>();
      for (const n of r.newClusters) {
        if (keys.has(n.key)) throw new Error(`duplicate new key ${n.key}`);
        keys.set(n.key, `c${next++}`);
      }
      const seen = new Set<number>();
      const joined: [string, number][] = [];
      for (const pl of r.placements) {
        if (!want.has(pl.pr) || seen.has(pl.pr)) throw new Error(`invalid or duplicate PR ${pl.pr}`);
        seen.add(pl.pr);
        const key = pl.cluster.startsWith("new:") ? pl.cluster.slice(4) : "";
        const id = key ? keys.get(key) : pl.cluster;
        if (!id || (!key && !reg.has(id))) throw new Error(`unknown cluster ${pl.cluster}`);
        joined.push([id, pl.pr]);
      }
      if (seen.size !== want.size) throw new Error(`batch ${bi}: incomplete coverage`);
      for (const u of r.updates) {
        const c = reg.get(u.id);
        if (!c) throw new Error(`update for unknown cluster ${u.id}`);
        c.label = text(u.label, "label");
        c.summary = text(u.summary, "summary");
      }
      for (const n of r.newClusters) reg.set(keys.get(n.key)!, { label: text(n.label, "label"), summary: text(n.summary, "summary"), prs: [] });
      for (const [id, pr] of joined) {
        const c = reg.get(id);
        if (!c) throw new Error(`unknown cluster ${id}`);
        c.prs.push(pr);
      }
      for (const [id, k] of keys) if (reg.get(k)?.prs.length === 0) throw new Error(`empty new cluster ${id}`);
    }

    phase("Consolidate");
    const m = await call(consolidate, { registry: show() }, { label: "consolidate" });
    if (!m) throw new Error("missing consolidation");
    const used = new Set<string>();
    for (const mg of m.merges) {
      if (mg.ids.length < 2) throw new Error("merge needs 2+ ids");
      const head = mg.ids[0];
      for (const id of mg.ids) {
        if (!reg.has(id) || used.has(id)) throw new Error(`invalid or duplicate merge id ${id}`);
        used.add(id);
      }
      const all = mg.ids.flatMap((id) => reg.get(id)!.prs);
      for (const id of mg.ids.slice(1)) reg.delete(id);
      reg.set(head, { label: text(mg.label, "label"), summary: text(mg.summary, "summary"), prs: all });
    }

    phase("Validate");
    const clusters = [...reg.values()]
      .filter((c) => c.prs.length >= 2)
      .map((c) => {
        const members = [...c.prs].sort((a, b) => a - b);
        return { id: `o${String(members[0]).padStart(5, "0")}`, label: c.label, summary: c.summary, prs: members, size: members.length };
      })
      .sort((x, y) => y.size - x.size || x.id.localeCompare(y.id));
    const unclassified = [...reg.values()]
      .filter((c) => c.prs.length === 1)
      .map((c) => ({ pr: c.prs[0], reason: `Opened its own cluster and attracted no peers (${c.label})` }))
      .sort((x, y) => x.pr - y.pr);
    const seen = new Set<number>();
    for (const n of [...clusters.flatMap((c) => c.prs), ...unclassified.map((u) => u.pr)]) {
      if (!byNum.has(n) || seen.has(n)) throw new Error(`invalid or duplicate PR ${n}`);
      seen.add(n);
    }
    if (seen.size !== prs.length) throw new Error("incomplete coverage");
    if (new Set(clusters.map((c) => c.id)).size !== clusters.length) throw new Error("duplicate cluster id");

    return {
      repository: corpus.repository,
      window: corpus.window,
      strategy: "Chronological online clustering: batches placed into an evolving model-maintained registry (join, open or refine), one consolidation merge pass, TypeScript validation",
      totalPrs: prs.length,
      modelCalls: batches.length + 1,
      clusters,
      topThree: clusters.slice(0, 3).map((c) => c.id),
      unclassified,
    };
  },
});
Validation and attempts
  • Attempt 1 (only attempt): lint passed, typecheck passed, executed once via run_rig (11 model calls), no errors, no repairs.
  • Independent node check of the saved result (/tmp/gh-aw/agent/pr-clusters-result.json) against the corpus: window matches; all 50 PRs covered exactly once; all numbers known; 12 unique cluster IDs; sizes equal unique PR counts; ranking by size desc then ID asc; top three match.

Workflow run: https://github.com/githubnext/rig/actions/runs/46386695563

Generated by Monthly PR Clusters · copilot · auto (Claude Sonnet 5.5) · ~101 AIC · ⌖ ~2 AIC · ⊞ 10.7K · history

Lingua principale
TypeScript
Stelle
16
Fork
0
Merge medio
2h 7m
PR unite (30g)
44

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 githubnext/rig

Tutte le issue di githubnext/rig

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.