[pr-clusters] Merged PR clusters - 2026-11-28 - run 46128492209/1

未關閉
#979 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
25/100
Issue 類型
文件
描述清晰度
需要釐清
活躍度
活躍
技術堆疊
typescript

研究方向

Start with the issue's Overview, Strategy comparison, and Validation and attempts sections to understand the report. Review the generated pr-clusters-question-signatures.ts source and the /tmp/gh-aw/agent/merged-prs.json input, then run the referenced run_rig workflow and lint/typecheck commands. The issue itself requests no change, so a concrete completion criterion must first be confirmed with a maintainer.

由索引模型根據 Issue 內容生成。

描述

ai-agent automation
Overview
  • Repository: githubnext/rig
  • Window (UTC): 2026-10-28T09:02:03.467Z (inclusive) to 2026-11-28T09:02:03.467Z (exclusive)
  • Total merged PRs: 45 · classified: 42 · unclassified: 3 · clusters: 11
Top three clusters
Rank Theme PRs % of corpus Summary
1 Rig sample additions (q00734) 6 13.3% Recurring automated [rig-tasks] PRs adding batches of rig samples, plus one making the Dockerfile audit sample runnable.
2 Provider integration fixes and updates (q00890) 6 13.3% DeepSeek/Pi Copilot Responses routing, Gemini credential docs, retired Sonnet model, router-selected models, Codex fixture permissions.
3 Claude and Anthropic SDK compatibility (q00891) 6 13.3% Repeated [rig-claude] dynamic-workflow compatibility improvements and the direct Anthropic SDK contract.

Ranking is by unique PR count descending, ties by cluster ID ascending.

Representative PRs
Outside the top three

8 further clusters hold 24 PRs: q00765 Agentic workflow tooling and dependency upgrades (5), q00744 rig.ts header updates (3), q00751 Dependency version bumps (3), q00892 CI and release workflow reliability (3), q00915 Copilot model resolution and integration fixes (3), q00923 Monthly PR Clusters Rig integration (3), q00917 Decomposition benchmark reliability fixes (2), q00934 Actions failure repair workflow (2).

Unclassified (3): #886 and #916 (no other PR within average Hamming distance 1 on the 10 answers), #949 (answered no to every question).

Strategy comparison
  • History consulted: all 11 records in repo memory (semantic themes, labels, change scope, TF-IDF average linkage, two no-strategy runs, closed-vocabulary facets, pairwise graph, map-reduce, divisive bisection, seed-and-assign); full source read for the five most recent.
  • Nearest prior: closed-vocabulary facet extraction (45361254701-1) and the TF-IDF/concern-linkage agglomeration.
  • Strategy: one model call reads all titles and designs 10 corpus-specific yes/no questions; models answer all questions per PR (batches of 5, title plus 250-char URL-stripped body excerpt), yielding a 10-bit signature; TypeScript groups identical signatures and merges by average Hamming distance ≤ 1; groups of 2+ become clusters (one naming call each); singletons and all-false signatures are unclassified. 21 model calls.
  • Behavioral difference: the evidence representation is a model-designed binary question signature rather than free keywords, a fixed facet vocabulary, TF-IDF vectors, seeds, pairwise judgments, or recursive splits; distance is Hamming over shared answers.
  • Limitations: the questions are derived from titles, so they mirror what is visible; the provider-integration cluster mixes distinct concerns. No measured comparison with other strategies, so no claim of being better.
  • Lessons: bot-generated PR families cluster cleanly; question quality drives results.
Generated Rig source

SHA-256: df5eb8e16cc02e40124decc0c178f5af057f65cf0d1099d8c7d79994a23f5fed · repo-memory record 46128492209-1.json (branch memory/pr-cluster-rigs, persisted by the trusted job after this run).

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

type Pr = { number: number; title: string; body?: string };

// Agent role: design discriminating yes/no questions from the list of PR titles.
const designQuestions = agent({
  name: "designQuestions",
  model: "small",
  input: s.object({ titles: s.string }),
  output: s.object({ questions: s.array(s.string) }),
  instructions:
    "Each line is 'number | title' of a merged PR in one repository. Write exactly 10 short, mutually independent yes/no questions that, answered per PR, would best separate these PRs into distinct themes (e.g. 'Does this PR change dependency versions?'). Each question must be answerable from a title plus short excerpt, cover a different theme, and be true for several but not most PRs.",
});

// Agent role: answer every question for each PR in a batch.
const answerQuestions = agent({
  name: "answerQuestions",
  model: "small",
  input: s.object({ questions: s.string, prs: s.string }),
  output: s.object({ items: s.array(s.object({ pr: s.int, answers: s.array(s.boolean) })) }),
  instructions:
    "Questions are numbered lines. Each PR line is 'number | title | body excerpt'. For every listed PR return one item whose answers array has exactly one boolean per question, in question order. Use only listed numbers, each exactly once.",
});

// Agent role: name a cluster from its member PRs.
const describeCluster = agent({
  name: "describeCluster",
  model: "small",
  input: s.object({ members: s.string }),
  output: s.object({ label: s.string, summary: s.string }),
  instructions:
    "Each line is 'number | title'. Return a short thematic label (max 6 words) and a one-sentence summary grounded only in these titles.",
});

const clean = (t = "") => t.replace(/https?:\S+/g, "").replace((s/redacted)+/g, " ").trim();
const NQ = 10;

// Workflow role: yes/no question signatures per PR, deterministic Hamming-distance grouping, cluster naming, validation.
export default workflow({
  meta: {
    name: "question-signature-hamming-groups",
    description: "Model designs discriminating questions, answers them per PR into binary signatures, TypeScript groups by Hamming distance",
    phases: ["Questions", "Answer", "Group", "Describe", "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.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("Questions");
    const q = await call(designQuestions, { titles: prs.map((p) => `${p.number} | ${p.title}`).join("\n") }, { label: "questions" });
    if (!q || q.questions.length !== NQ || q.questions.some((x) => !x.trim())) throw new Error("malformed question set");
    const qText = q.questions.map((x, i) => `${i + 1}. ${x}`).join("\n");

    phase("Answer");
    const batches: Pr[][] = [];
    for (let i = 0; i < prs.length; i += 5) batches.push(prs.slice(i, i + 5));
    if (batches.length > 20) throw new Error("too many batches");
    const sig = new Map<number, boolean[]>();
    for (let g = 0; g < batches.length; g += 3) {
      const group = batches.slice(g, g + 3);
      const res = await Promise.all(
        group.map((b, i) =>
          call(answerQuestions, { questions: qText, prs: b.map((p) => `${p.number} | ${p.title} | ${clean(p.body).slice(0, 250)}`).join("\n") }, { label: `answer${g + i}` }),
        ),
      );
      res.forEach((r, i) => {
        if (!r) throw new Error(`missing answer response ${g + i}`);
        const want = new Set(group[i].map((p) => p.number));
        for (const it of r.items) {
          if (!want.has(it.pr) || sig.has(it.pr) || it.answers.length !== NQ) throw new Error(`invalid answer for PR ${it.pr}`);
          sig.set(it.pr, it.answers);
        }
        if (group[i].some((p) => !sig.has(p.number))) throw new Error(`batch ${g + i}: incomplete coverage`);
      });
    }

    phase("Group");
    const ham = (a: number, b: number) => sig.get(a)!.reduce((t, x, k) => t + (x === sig.get(b)![k] ? 0 : 1), 0);
    const unclassified: { pr: number; reason: string }[] = [];
    const bySig = new Map<string, number[]>();
    for (const p of prs) {
      const key = sig.get(p.number)!.map((x) => (x ? 1 : 0)).join("");
      if (!key.includes("1")) {
        unclassified.push({ pr: p.number, reason: "Answered no to every discriminating question" });
        continue;
      }
      bySig.set(key, [...(bySig.get(key) ?? []), p.number]);
    }
    let groups = [...bySig.values()];
    const MAXAVG = 1;
    for (;;) {
      let best = Infinity;
      let bi = 0;
      let bj = 0;
      for (let i = 0; i < groups.length; i++)
        for (let j = i + 1; j < groups.length; j++) {
          let t = 0;
          for (const a of groups[i]) for (const b of groups[j]) t += ham(a, b);
          const avg = t / (groups[i].length * groups[j].length);
          if (avg < best) {
            best = avg;
            bi = i;
            bj = j;
          }
        }
      if (best > MAXAVG) break;
      groups = groups.filter((_, k) => k !== bi && k !== bj).concat([[...groups[bi], ...groups[bj]]]);
    }
    const multi = groups.filter((g) => g.length >= 2).map((g) => [...g].sort((a, b) => a - b));
    for (const g of groups.filter((x) => x.length === 1))
      unclassified.push({ pr: g[0], reason: `No other PR within average Hamming distance ${MAXAVG} on ${NQ} question answers` });
    unclassified.sort((a, b) => a.pr - b.pr);

    phase("Describe");
    if (1 + batches.length + multi.length > 38) throw new Error("call budget exceeded");
    const described: ({ label: string; summary: string } | null)[] = [];
    for (let g = 0; g < multi.length; g += 3) {
      const res = await Promise.all(
        multi.slice(g, g + 3).map((m, i) =>
          call(describeCluster, { members: m.map((n) => `${n} | ${byNum.get(n)!.title}`).join("\n") }, { label: `describe${g + i}` }),
        ),
      );
      described.push(...res);
    }
    const clusters = multi
      .map((m, i) => {
        const d = described[i];
        if (!d || !d.label.trim() || !d.summary.trim()) throw new Error("missing cluster description");
        return { id: `q${String(m[0]).padStart(5, "0")}`, label: d.label, summary: d.summary, prs: m, size: m.length };
      })
      .sort((x, y) => y.size - x.size || x.id.localeCompare(y.id));

    phase("Validate");
    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: `Model-designed ${NQ} yes/no discriminating questions, per-PR binary answer signatures, TypeScript average-Hamming agglomeration (<= ${MAXAVG}), cluster naming`,
      questions: q.questions,
      totalPrs: prs.length,
      modelCalls: 1 + batches.length + multi.length,
      clusters,
      topThree: clusters.slice(0, 3).map((c) => c.id),
      unclassified,
    };
  },
});
Validation and attempts
  • Attempt 1 (only attempt): lint passed, typecheck passed, one run_rig execution succeeded with 21 model calls (limit 40); no errors, no repairs.
  • Independent check: 45 input PRs, 45 assigned exactly once (42 clustered + 3 unclassified), all numbers known, unique cluster IDs, sizes and ranking correct, window matches the corpus.
  • Workflow run: https://github.com/githubnext/rig/actions/runs/46128492209

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

主要語言
TypeScript
星號
16
分支
0
平均合併
2 小時 7 分鐘
30 天內合併 PR
44

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

githubnext/rig 的其他 Issue

查看 githubnext/rig 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。