[pr-clusters] Merged PR clusters - 2026-11-29 - run 46245325031/1

未关闭
#986 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
github-actions, node.js, typescript
领域
data, devtools

调研方向

Start with the generated Rig workflow in the issue body and the referenced merged-prs.json input. Trace the component extraction, IDF-weighted graph, and label propagation stages, then compare their clusters with the listed PR themes and limitations. Done means the clustering results and validation meet the intended behavior, though the issue does not specify a particular change or acceptance criteria.

由索引模型根据 Issue 内容生成。

描述

ai-agent automation
Overview
Top three clusters
Rank Theme PRs % of corpus Summary
1 Rig samples and Claude compatibility (g00734) 10 20.8% Batches of new rig samples and catalog refreshes, Claude dynamic-workflow compatibility updates, Anthropic SDK contract coverage, a stdin fix for a fixture generator sample.
2 Copilot integration CI fixes (g00890) 9 18.8% Repairs to CI integration workflows: Copilot credentials and model selection, Pi results, Codex fixture permissions, timeouts.
3 Agentic workflow and Copilot SDK maintenance (g00765) 7 14.6% gh-aw and Copilot CLI/SDK upgrades, installation fixes, pinning, Monthly PR Clusters and Action Failure Repair workflows.
Cluster details

Outside the top three: 5 clusters (21 PRs... see below) and 7 unclassified PRs.
Remaining clusters: g00751 npm dependency updates and installs (4), g00744 rig.ts header and lint maintenance (3), g00917 decomposition benchmark reliability (3), g00941 Claude workflow compatibility and guidance (3), g00831 Microsoft npm feed and 1ES setup (2) — 15 PRs in 5 clusters.

Unclassified (7), all because no other PR shared a non-generic component in the model's extracted wording: #894 (gemini integration docs), #927 (claude port samples doc links), #931 (launcher tests/release), #932 (dockerfile audit sample), #933 (integration samples model), #934 (actions repair workflow), #961 (rig.ts header; arguably belongs with g00744).

Strategy comparison
  • History consulted: all 12 records in repo memory (37680026048-1, 38039912415-2, 38126880290-1, 40477786734-1, 40661045982-1, 45005503491-1, 45361254701-1, 45553032858-1, 45581461634-1, 45771811713-1, 45970215617-1, 46128492209-1); full source of the five most recent read.
  • Nearest prior: closed-vocabulary facet extraction (45361254701-1, never executed) and question-signature Hamming agglomeration (46128492209-1).
  • Behavioral change: a model extracts open-vocabulary component names per PR (title + 300-char body excerpt, batches of 6); TypeScript builds an IDF-weighted shared-component graph (components on >30% of PRs ignored) and runs deterministic weighted label propagation. Membership emerges from graph community detection rather than model-declared themes, seeds, signatures, bisection, or pairwise verdicts. 16 model calls.
  • Limitations: wording differences isolate PRs (7 unclassified); label propagation merged adjacent concerns; no measured comparison against other strategies, so no claim of being better.
  • Lessons: add a component-vocabulary canonicalization pass; use a stricter edge threshold or modularity check.
Rig source

SHA-256: ce345d37ef09bf9c9f5dcc2e5d17f57a0ffa5f71ddc27d6e51b8a1deef955556 (7396 bytes). Repo-memory record: 46245325031-1.json (branch memory/pr-cluster-rigs; persistence is performed by the trusted job).

Complete generated Rig source
import { agent, s, workflow } from "rig";
import { readFileSync } from "node:fs";

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

// Agent role: extract the concrete components each PR touches, in open vocabulary.
const extractComponents = agent({
  name: "extractComponents",
  model: "small",
  input: s.object({ prs: s.string }),
  output: s.object({ items: s.array(s.object({ pr: s.int, components: s.array(s.string) })) }),
  instructions:
    "Each line is 'number | title | body excerpt' of a merged PR. For every listed PR return 1 to 4 short lowercase component names (1-3 words) naming the concrete subsystem, workflow, tool, dependency or artifact the PR changes, e.g. 'copilot sdk', 'integration tests', 'sample catalog', 'npm dependencies'. Reuse the same wording for the same component across PRs. 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, shared: s.string }),
  output: s.object({ label: s.string, summary: s.string }),
  instructions:
    "Each member line is 'number | title'; 'shared' lists components the members have in common. 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 norm = (c: string) => c.toLowerCase().replace(/[^a-z0-9 ]+/g, " ").replace((s/redacted)+/g, " ").trim();

// Workflow role: component-graph clustering: model extracts components, TypeScript runs IDF-weighted label propagation, models name clusters.
export default workflow({
  meta: {
    name: "component-graph-label-propagation",
    description: "Open-vocabulary component extraction, IDF-weighted PR graph, deterministic label propagation, cluster naming",
    phases: ["Extract", "Propagate", "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("Extract");
    const batches: Pr[][] = [];
    for (let i = 0; i < prs.length; i += 6) batches.push(prs.slice(i, i + 6));
    if (batches.length > 12) throw new Error("too many batches");
    const comps = new Map<number, Set<string>>();
    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(extractComponents, { prs: b.map((p) => `${p.number} | ${p.title} | ${clean(p.body).slice(0, 300)}`).join("\n") }, { label: `extract${g + i}` }),
        ),
      );
      res.forEach((r, i) => {
        if (!r) throw new Error(`missing extraction ${g + i}`);
        const want = new Set(group[i].map((p) => p.number));
        for (const it of r.items) {
          const cs = new Set(it.components.map(norm).filter(Boolean));
          if (!want.has(it.pr) || comps.has(it.pr) || cs.size === 0) throw new Error(`invalid extraction for PR ${it.pr}`);
          comps.set(it.pr, cs);
        }
        if (group[i].some((p) => !comps.has(p.number))) throw new Error(`batch ${g + i}: incomplete coverage`);
      });
    }

    phase("Propagate");
    const df = new Map<string, number>();
    comps.forEach((cs) => cs.forEach((c) => df.set(c, (df.get(c) ?? 0) + 1)));
    const maxDf = Math.floor(prs.length * 0.3);
    const idf = (c: string) => Math.log(prs.length / (df.get(c) ?? 1));
    const nums = prs.map((p) => p.number);
    const nbrs = new Map<number, Map<number, number>>(nums.map((n) => [n, new Map()]));
    for (let i = 0; i < nums.length; i++)
      for (let j = i + 1; j < nums.length; j++) {
        let t = 0;
        for (const c of comps.get(nums[i])!) if (comps.get(nums[j])!.has(c) && (df.get(c) ?? 0) <= maxDf) t += idf(c);
        if (t > 0) {
          nbrs.get(nums[i])!.set(nums[j], t);
          nbrs.get(nums[j])!.set(nums[i], t);
        }
      }
    const label = new Map<number, number>(nums.map((n) => [n, n]));
    for (let it = 0; it < 20; it++) {
      let changed = false;
      for (const n of nums) {
        const score = new Map<number, number>();
        for (const [m, x] of nbrs.get(n)!) score.set(label.get(m)!, (score.get(label.get(m)!) ?? 0) + x);
        if (score.size === 0) continue;
        let best = label.get(n)!;
        let bs = score.get(best) ?? 0;
        for (const [l, x] of score) if (x > bs || (x === bs && l < best)) { best = l; bs = x; }
        if (best !== label.get(n)) { label.set(n, best); changed = true; }
      }
      if (!changed) break;
    }
    const groupsMap = new Map<number, number[]>();
    for (const n of nums) groupsMap.set(label.get(n)!, [...(groupsMap.get(label.get(n)!) ?? []), n]);
    const multi = [...groupsMap.values()].filter((g) => g.length >= 2).map((g) => [...g].sort((a, b) => a - b));
    const unclassified = [...groupsMap.values()]
      .filter((g) => g.length === 1)
      .map((g) => ({ pr: g[0], reason: `No shared non-generic component with other PRs (${[...comps.get(g[0])!].join(", ")})` }))
      .sort((a, b) => a.pr - b.pr);
    if (batches.length + multi.length > 38) throw new Error("call budget exceeded");

    phase("Describe");
    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) => {
          const common = new Map<string, number>();
          m.forEach((n) => comps.get(n)!.forEach((c) => common.set(c, (common.get(c) ?? 0) + 1)));
          const shared = [...common].filter(([, k]) => k >= 2).map(([c]) => c).join(", ") || "none";
          return call(describeCluster, { members: m.map((n) => `${n} | ${byNum.get(n)!.title}`).join("\n"), shared }, { 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: `g${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: "Open-vocabulary component extraction per PR, IDF-weighted shared-component PR graph, deterministic label propagation, cluster naming",
      totalPrs: prs.length,
      modelCalls: batches.length + multi.length,
      clusters,
      topThree: clusters.slice(0, 3).map((c) => c.id),
      unclassified,
    };
  },
});
Validation and attempts
  • Attempt 1: lint passed, typecheck passed, executed via run_rig successfully (16 model calls). One execution, one source version; an unused variable was removed from the draft before linting.
  • Independent check (node): 48 PRs, 41 classified + 7 unclassified, full coverage, no duplicates, known PR numbers, unique IDs, sizes match, ranking by size desc / ID asc, top three and window match the corpus.
  • Run: https://github.com/githubnext/rig/actions/runs/46245325031

Generated by Monthly PR Clusters · copilot · auto (Claude Sonnet 5.5) · ~123 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 摘要。