Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[rig-decomposition-bench] Daily rig decomposition benchmark — 2026-10-28 — no result (task picker failed)

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃

调研方向

Start with the benchmark workflow shown in the issue and inspect the task-picker agent configuration, its schema, and the call(picker, ...) result handling. The issue says the picker returned null but does not identify why, and explicitly says the root cause was not investigated. Determine whether the failure can be diagnosed from the captured output; done means identifying a concrete cause and a way to prevent or report this failed run usefully.

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

描述

ai-agent automation

Result: benchmark did not complete

The benchmark program typechecked and ran exactly once. It exited with code 0 in under a few minutes, but the task-picker agent returned null, so no later phase ran.

Captured stdout (bench_output.json):

{
  "error": "task picker returned null",
  "status": "fail"
}

Captured stderr: empty (0 bytes).

Task

Not chosen. The picker (small, maxTurns: 2, repair()) returned null. There is no title, domain, description or success criteria.

Timing comparison

Single-call (ms) Decomposed (ms) Decomposed status
not run not run not run

Decomposition attempts

None. No task was available, so the writer was never called. Source generation, typecheck and execute were all skipped for attempts 1 and 2. There was no error text and nothing to fix.

Grading

Not run. There are no scores, no winner and no rationale.

Single-call solution

Not produced.

Decomposed program and solution

No decomposed program source or decomposed solution was produced.

Setup notes

  • npm install had to be run in .github/skills/rig before --typecheck would pass. Without it, @types/node was missing and process and node:child_process failed to resolve. The skill install did not provide node_modules.
  • The node version was v22.23.4. The skill's package.json requires node >=24, which produced an EBADENGINE warning.
  • The root cause of the picker's null was not investigated. The prompt said not to debug or re-run after the single run.
Benchmark program (Step 1)
import { agent, workflow, s, repair, configureAgent, copilotEngine } from "rig";

configureAgent(copilotEngine());

const DEADLINE = Date.now() + 25 * 60_000;
const left = () => DEADLINE - Date.now();

const SKELETON = `import { agent, workflow, s } from "rig";

// Agent role: <role>
const analyze = agent({ model: "small", instructions: "...", output: s.string });

// Workflow role: combines the agents' outputs into the final solution
export default workflow({
  meta: { name: "decomposed-solution", description: "..." },
  body: async ({ call }) => {
    const analysis = await call(analyze, "...");
    return { solution: analysis ?? "" };
  },
});`;

const RULES = `Rules for the program (rig API, imports ONLY from "rig"):
- Import only from "rig". No required input on the root. Export the root via \`export default\` without invoking it. No console.log.
- Use at least two agents, each preceded by a \`// Agent role: ...\` comment; choose model "small" for simple sub-steps and "medium" or "large" for harder ones.
- The final answer must combine the agents' outputs, not come from one agent solving everything.
- A workflow() spec accepts ONLY meta, an optional input, and body. It has no output or execute field; the final { solution } object is simply what body returns. An agent() root instead declares output: s.object({ solution: s.string }).
- Agents are called inside body with \`await call(agent, "prompt string")\`, which returns the output or null on failure.
- Use s.string for every agent whose result is source text or free-form solution. Do not wrap large solutions in object schemas.
- Required shape (abridged to one agent; you need at least two):
\`\`\`ts
${SKELETON}
\`\`\`
Return ONLY the complete TypeScript source (no commentary).`;

const taskSchema = s.object({
  title: s.string,
  domain: s.string,
  description: s.string,
  criteria: s.array(s.string),
});

// Agent role: pick a complicated, gradeable task suited to multi-agent decomposition.
const picker = agent({
  model: "small",
  maxTurns: 2,
  addons: [repair()],
  instructions:
    "Pick ONE concrete, complicated task a person or team might face in a single day that would naturally benefit from being split across sub-agents running different models: multi-source research and synthesis, a multi-file coding task with design/implementation/review phases, a structured report combining independent analyses, or a multi-step data transformation pipeline. It must be self-contained (no external files or live web access) and concrete enough to grade. Vary the domain from run to run (pick randomly). Return title, domain, description, and 3-6 concrete checkable success criteria.",
  output: taskSchema,
});

// Agent role: solve the whole task alone in one turn.
const single = agent({
  model: "medium",
  maxTurns: 1,
  instructions:
    "Solve the whole task yourself, in a single response, addressing every success criterion. No delegation, no tools. Return the complete solution verbatim (Markdown code fences allowed).",
  output: s.string,
});

// Agent role: write or fix a rig program that decomposes the task.
const writer = agent({
  model: "medium",
  maxTurns: 1,
  instructions: "You write self-contained rig TypeScript programs. Follow the stated rules exactly.",
  output: s.string,
});

const gradeSchema = s.object({
  singleScore: s.number,
  decomposedScore: s.number,
  winner: s.enum("single-call", "decomposed", "tie"),
  rationale: s.string,
});

// Agent role: grade both solutions on content correctness and completeness only.
const grader = agent({
  model: "large",
  maxTurns: 1,
  instructions:
    "Score each solution 0-10 on how completely and correctly it satisfies the success criteria. Judge only correctness and completeness of content: not length, and not which approach produced it. Pick winner single-call, decomposed, or tie, and explain the comparison.",
  output: gradeSchema,
});

type Run = { code: number | null; stdout: string; stderr: string; timedOut: boolean };

async function runCli(args: string[], src: string, timeoutMs: number): Promise<Run> {
  const { spawn } = await import("node:child_process");
  return new Promise((resolve) => {
    const child = spawn("node", ["rig.ts", ...args], { cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"] });
    let stdout = "";
    let stderr = "";
    let timedOut = false;
    const timer = setTimeout(() => {
      timedOut = true;
      child.kill("SIGKILL");
    }, timeoutMs);
    child.stdout.on("data", (d: unknown) => { stdout += String(d); });
    child.stderr.on("data", (d: unknown) => { stderr += String(d); });
    child.on("error", (e: Error) => {
      clearTimeout(timer);
      resolve({ code: -1, stdout, stderr: stderr + String(e), timedOut });
    });
    child.on("close", (code: number | null) => {
      clearTimeout(timer);
      resolve({ code, stdout, stderr, timedOut });
    });
    child.stdin.on("error", () => {});
    child.stdin.end(src);
  });
}

type Attempt = {
  attempt: number;
  generation: string;
  typecheck: string;
  execute: string;
  error: string;
};

function stripFence(t: string): string {
  const m = t.match(/```(?:ts|typescript|rig)?\s*\n([\s\S]*?)```/);
  return (m ? m[1] : t).trim();
}

export default workflow({
  meta: { name: "rig-decomposition-bench", description: "Compare single-call vs decomposed solving", phases: ["Pick", "Single", "Decompose", "Grade"] },
  body: async ({ call, phase }) => {
    phase("Pick");
    const task = await call(picker, "Pick a task now.");
    if (!task) return { error: "task picker returned null", status: "fail" };
    const taskText = `Title: ${task.title}\nDomain: ${task.domain}\nDescription: ${task.description}\nSuccess criteria:\n${task.criteria.map((c: string) => `- ${c}`).join("\n")}`;

    phase("Single");
    const t0 = Date.now();
    const singleSolution = (await call(single, taskText)) ?? "";
    const singleMs = Date.now() - t0;

    phase("Decompose");
    const t1 = Date.now();
    const attempts: Attempt[] = [];
    let source = "";
    let decomposedSolution = "";
    let status = "fail";
    let lastError = "";
    let prevSource = "";
    for (let i = 1; i <= 2; i++) {
      if (left() < 4 * 60_000) break;
      const rec: Attempt = { attempt: i, generation: "", typecheck: "skipped", execute: "skipped", error: "" };
      attempts.push(rec);
      let prompt: string;
      if (i === 1) {
        prompt = `Write a rig program that solves this task by decomposing it across at least two agents.\n\nTASK:\n${taskText}\n\n${RULES}`;
      } else if (prevSource.trim()) {
        prompt = `Fix this rig program. Fix precisely what the error names and preserve what already worked; do not make unrelated API edits.\n\nTASK:\n${taskText}\n\nERROR:\n${lastError}\n\nSOURCE:\n${prevSource}\n\n${RULES}`;
      } else {
        prompt = `There is no source to fix (the previous attempt produced nothing). Generate the complete program from scratch.\n\nTASK:\n${taskText}\n\n${RULES}`;
      }
      const raw = await call(writer, prompt);
      const src = raw && raw.trim() ? stripFence(raw) : "";
      if (!src) {
        rec.generation = "empty";
        rec.error = "writer returned null/empty";
        lastError = rec.error;
        prevSource = "";
        continue;
      }
      rec.generation = "ok";
      source = src;
      prevSource = src;
      const tcMs = Math.min(2 * 60_000, left());
      if (tcMs < 10_000) { rec.error = "time budget exhausted"; break; }
      const tc = await runCli(["--typecheck"], src, tcMs);
      if (tc.code !== 0) {
        rec.typecheck = tc.timedOut ? "timeout" : "fail";
        rec.error = (tc.stdout + tc.stderr).trim();
        lastError = rec.error;
        continue;
      }
      rec.typecheck = "pass";
      const exMs = Math.min(5 * 60_000, left());
      if (exMs < 10_000) { rec.execute = "skipped"; rec.error = "time budget exhausted"; break; }
      const ex = await runCli(["--server"], src, exMs);
      if (ex.code !== 0) {
        rec.execute = ex.timedOut ? "timeout" : "fail";
        rec.error = (ex.stdout + ex.stderr).trim();
        lastError = rec.error;
        continue;
      }
      try {
        const parsed = JSON.parse(ex.stdout.trim()) as { solution?: unknown };
        if (typeof parsed.solution === "string" && parsed.solution.trim()) {
          decomposedSolution = parsed.solution;
          rec.execute = "pass";
          status = "pass";
          break;
        }
        rec.execute = "fail";
        rec.error = "no solution string in stdout: " + ex.stdout.slice(0, 2000);
      } catch (e) {
        rec.execute = "fail";
        rec.error = "stdout not valid JSON: " + ex.stdout.slice(0, 2000);
      }
      lastError = rec.error;
    }
    const decomposedMs = Date.now() - t1;

    phase("Grade");
    const placeholder = "(decomposition produced no solution)";
    const grade = await call(
      grader,
      `${taskText}\n\n=== SOLUTION A (single-call) ===\n${singleSolution || "(empty)"}\n\n=== SOLUTION B (decomposed) ===\n${decomposedSolution || placeholder}`,
    );
    return { task, singleMs, decomposedMs, singleSolution, decomposedSolution, attempts, status, grade, decomposedSource: source };
  },
});

Verdict: No winner. The task picker returned null, so the benchmark produced no data this run.

Generated by Daily Rig Decomposition Benchmark · copilot · auto · ~34 AIC · ⌖ ~1 AIC · ⊞ 4K · ◷

  • expires on Nov 4, 2026, 1:02 PM UTC
主要语言
TypeScript
星标
14
派生
0
平均合并
9 小时 27 分钟
30 天内合并 PR
34

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

githubnext/rig 的其他 Issue

查看 githubnext/rig 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。