[pr-clusters] Merged PR clusters - 2026-11-27 - run 45970215617/1

Đang mở
#969 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, node.js, typescript
Lĩnh vực
devtools, tooling

Hướng nghiên cứu

Read the generated Rig source embedded in the issue and the run details at https://github.com/githubnext/rig/actions/runs/45970215617. The issue documents the seed-and-assign clustering workflow, its validation, and known limitations; the final section is truncated, so inspect the complete issue and repository context to identify any requested change. Done criteria are not specified in the visible payload.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

ai-agent automation
Overview
Top three clusters
Rank Theme PRs % of corpus Summary
1 Provider integration and CI repair (s00891) 11 25.0% Testing and documenting provider integrations, fixing credentials, model and lint failures in CI and sample workflows, and adding automated Actions repair.
2 Agentic workflow setup and dependency fixes (s00888) 6 13.6% Installation, dependency resolution, image pinning and launcher fixes in agentic and release workflows.
3 Claude dynamic-workflow compatibility improvements (s00927) 5 11.4% Four PRs share the title "Improve Claude dynamic-workflow compatibility for rig"; the fifth is a related schema and workflow guidance improvement.
Cluster details
  • s00891 Provider integration and CI repair: PRs #891, #892, #894, #910, #915. All members: 891, 892, 894, 910, 915, 916, 932, 933, 934, 935, 938.
  • s00888 Agentic workflow setup and dependency fixes: #888, #914, #923, #931, #947. All members: 888, 914, 923, 931, 947, 948.
  • s00927 Claude dynamic-workflow compatibility: #927, #941, #949, #955, #965.
Outside the top three

5 more clusters hold 16 PRs, and 6 PRs are unclassified:

  • s00765 Microsoft tooling and runtime upgrades (4): 765, 831, 886, 905
  • s00744 rig.ts header summary updates (3): 744, 906, 961
  • s00751 Dependency version bumps (3): 751, 754, 770
  • s00890 Copilot Responses and Pi model routing (3): 890, 893, 940
  • s00917 Decomposition benchmark reliability fixes (3): 917, 924, 946

Unclassified PRs and reasons:

  • 734, 926, 945, 954, 964: add new rig samples and refresh the catalog; no seed exemplar covered sample authoring.
  • 950: Codex integration fixture TMPDIR permissions fix; no seed covered fixture or subprocess environment fixes.
Strategy comparison
  • History consulted: 10 records (37680026048-1, 38039912415-2, 38126880290-1, 40477786734-1, 40661045982-1, 45005503491-1, 45361254701-1, 45553032858-1, 45581461634-1, 45771811713-1). I read all strategy descriptions, outcomes and lessons, plus the full source of the three records that embed it (45553032858, 45581461634, 45771811713). Other records' sources were absent or not embedded.
  • Nearest prior: divisive-recursive-bisection (45771811713-1).
  • Behavioral change: the prior strategy was top-down. The model saw the whole set and invented splits until it judged parts coherent. This run uses TF-IDF with farthest-first selection in TypeScript to choose up to 8 exemplar seed PRs. Models then classify each remaining PR, in batches of 6, to the closest seed or to none, which is a constrained nearest-exemplar assignment. The model does not decide the partition structure. Seeds that attract no PR become unclassified. One describe call per cluster supplies label and summary.
  • Evidence: title (double weight) and a URL-stripped 400-character body excerpt for seeding, and title plus a 250-character excerpt for assignment.
  • Limitations: seed choice bounds what can cluster. Five sample-addition PRs form an obvious theme but were left unclassified because no seed covered it. No measured comparison with other strategies was made, so no claim of improvement.
  • Lessons: let the "none" PRs form clusters in a second pass; write results to a distinct filename because a stale pr-clusters-result.json exists.
Rig source

SHA-256: d2cce7f2d1d5768e8ea4e13530a0e9c3ade83a01e2e7edab998e717676fc35bb (7,331 bytes). Repo-memory record: pr-cluster-rigs/45970215617-1.json.

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: assign each PR in a batch to the closest seed exemplar PR, or to none.
const assignBatch = agent({
  name: "assignBatch",
  model: "small",
  input: s.object({ seeds: s.string, batch: s.string }),
  output: s.object({
    assignments: s.array(s.object({ pr: s.int, seed: s.int, reason: s.string })),
  }),
  instructions:
    "SEEDS lists exemplar PRs as 'number | title'. BATCH lists PRs as 'number | title | body excerpt'. For every BATCH PR, choose the seed number whose engineering concern it most closely shares, or seed=0 if no seed fits. Give a short reason. Every batch number must appear exactly once. Use only listed numbers.",
});

// 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 STOP = new Set("the a an and or of to for in on with add fix update from by is be as at this that into new use using via rig are was not all can will its".split(" "));
const clean = (t = "") => t.replace(/https?:\S+/g, "").replace((s/redacted)+/g, " ").trim();
const tok = (p: Pr) =>
  `${p.title} ${p.title} ${clean(p.body).slice(0, 400)}`
    .toLowerCase()
    .split(/[^a-z0-9]+/)
    .filter((w) => w.length > 2 && !STOP.has(w));

// Workflow role: seed-and-assign clustering: TypeScript picks exemplar seeds by farthest-first TF-IDF, models assign PRs to seeds, then clusters are named.
export default workflow({
  meta: {
    name: "seed-and-assign-clustering",
    description: "Farthest-first exemplar seeds, batch model assignment to seeds, cluster naming, TypeScript validation",
    phases: ["Seed", "Assign", "Describe", "Validate"],
  },
  body: async ({ call, phase }) => {
    const corpus = JSON.parse(readFileSync("/tmp/gh-aw/agent/merged-prs.json", "utf8"));
    const prs: Pr[] = corpus.prs;
    const byNum = new Map(prs.map((p) => [p.number, p]));
    if (prs.length === 0 || byNum.size !== prs.length) throw new Error("bad corpus");

    phase("Seed");
    const docs = prs.map((p) => tok(p));
    const df = new Map<string, number>();
    docs.forEach((d) => new Set(d).forEach((w) => df.set(w, (df.get(w) ?? 0) + 1)));
    const vecs = docs.map((d) => {
      const v = new Map<string, number>();
      d.forEach((w) => v.set(w, (v.get(w) ?? 0) + 1));
      let norm = 0;
      for (const [w, c] of v) {
        const x = (1 + Math.log(c)) * Math.log(1 + prs.length / (df.get(w) ?? 1));
        v.set(w, x);
        norm += x * x;
      }
      norm = Math.sqrt(norm) || 1;
      for (const [w, x] of v) v.set(w, x / norm);
      return v;
    });
    const cos = (a: Map<string, number>, b: Map<string, number>) => {
      let t = 0;
      for (const [w, x] of a) t += x * (b.get(w) ?? 0);
      return t;
    };
    const k = Math.max(2, Math.min(8, Math.floor(prs.length / 4)));
    const central = prs.map((_, i) => vecs.reduce((acc, v) => acc + cos(vecs[i], v), 0));
    const chosen = [central.indexOf(Math.max(...central))];
    while (chosen.length < k && chosen.length < prs.length) {
      let best = -1;
      let bestD = -1;
      prs.forEach((_, i) => {
        if (chosen.includes(i)) return;
        const d = 1 - Math.max(...chosen.map((c) => cos(vecs[i], vecs[c])));
        if (d > bestD) {
          bestD = d;
          best = i;
        }
      });
      chosen.push(best);
    }
    const seeds = chosen.map((i) => prs[i].number);
    const seedSet = new Set(seeds);
    const seedText = seeds.map((n) => `${n} | ${byNum.get(n)!.title}`).join("\n");

    phase("Assign");
    const rest = prs.filter((p) => !seedSet.has(p.number)).sort((a, b) => a.number - b.number);
    const batches: Pr[][] = [];
    for (let i = 0; i < rest.length; i += 6) batches.push(rest.slice(i, i + 6));
    if (batches.length + seeds.length > 38) throw new Error("call budget exceeded");
    const members = new Map<number, number[]>(seeds.map((n) => [n, [n]]));
    const none = new Map<number, 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(
            assignBatch,
            { seeds: seedText, batch: b.map((p) => `${p.number} | ${p.title} | ${clean(p.body).slice(0, 250)}`).join("\n") },
            { label: `batch${g + i}` },
          ),
        ),
      );
      res.forEach((r, i) => {
        if (!r) throw new Error(`missing assignment response ${g + i}`);
        const want = new Set(group[i].map((p) => p.number));
        const seen = new Set<number>();
        for (const a of r.assignments) {
          if (!want.has(a.pr) || seen.has(a.pr)) throw new Error(`invalid or duplicate PR ${a.pr}`);
          if (a.seed !== 0 && !seedSet.has(a.seed)) throw new Error(`unknown seed ${a.seed}`);
          seen.add(a.pr);
          if (a.seed === 0) none.set(a.pr, a.reason.trim() || "No seed exemplar fits");
          else members.get(a.seed)!.push(a.pr);
        }
        if (seen.size !== want.size) throw new Error(`batch ${g + i}: incomplete coverage`);
      });
    }

    const unclassified: { pr: number; reason: string }[] = [...none].map(([pr, reason]) => ({ pr, reason }));
    const groups: number[][] = [];
    for (const [seed, m] of members) {
      if (m.length >= 2) groups.push(m.sort((a, b) => a - b));
      else unclassified.push({ pr: seed, reason: "Seed exemplar attracted no other PRs" });
    }

    phase("Describe");
    const described = await Promise.all(
      groups.map((m, i) =>
        call(describeCluster, { members: m.map((n) => `${n} | ${byNum.get(n)!.title}`).join("\n") }, { label: `describe${i}` }),
      ),
    );
    const clusters = groups
      .map((m, i) => {
        const d = described[i];
        if (!d || !d.label.trim() || !d.summary.trim()) throw new Error("missing cluster description");
        return { id: `s${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");
    unclassified.sort((a, b) => a.pr - b.pr);
    const seenAll = new Set<number>();
    for (const n of [...clusters.flatMap((c) => c.prs), ...unclassified.map((u) => u.pr)]) {
      if (!byNum.has(n) || seenAll.has(n)) throw new Error(`invalid or duplicate PR ${n}`);
      seenAll.add(n);
    }
    if (seenAll.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: "Seed-and-assign: TF-IDF farthest-first exemplar seeds, model assigns batches of PRs to seeds, then cluster naming",
      totalPrs: prs.length,
      seeds,
      modelCalls: batches.length + groups.length,
      clusters,
      topThree: clusters.slice(0, 3).map((c) => c.id),
      unclassified,
    };
  },
});
Validation and attempts
  • Source attempts: 1. Lint passed, typecheck passed, no repairs needed.
  • Executions: 1 via run_rig, succeeded with 14 model calls (limit 40, concurrency 3).
  • Independent check with node against the corpus: 44 PRs, each covered exactly once, no unknown or duplicate numbers, window matches, cluster IDs unique, sizes equal unique PR counts, ranking is size descending then ID ascending.
  • Repo-memory record 45970215617-1.json was written and passed size validation. Persistence is done by the trusted job after this run.
  • Workflow run: https://github.com/githubnext/rig/actions/runs/45970215617

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

Ngôn ngữ chính
TypeScript
Star
16
Fork
0
Merge trung bình
2 giờ 7 phút
Pull request đã merge (30 ngày)
44

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của githubnext/rig

Tất cả issue của githubnext/rig

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.