Skip to content

Make sample 318 stdin-runnable for the daily Rig sampler - #303

Merged
pelikhan merged 2 commits into
mainfrom
copilot/rig-sample-report-fix
Jul 30, 2026
Merged

Make sample 318 stdin-runnable for the daily Rig sampler#303
pelikhan merged 2 commits into
mainfrom
copilot/rig-sample-report-fix

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

The daily Rig sample report failed on 318-ts-barrel-re-exporter.md because the exported root agent required structured input, while markdown samples are executed through the stdin launcher and must expose an input-free root. This updates the sample to match the launcher contract without changing runtime behavior.

  • Root contract

    • Removed required root input from 318-ts-barrel-re-exporter.md
    • Kept the sample as a single exported agent so it remains runnable by the sampler and launcher
  • Sample behavior

    • Scoped the sample to a concrete target: skills/rig/engines
    • Switched file emission from p.writeInput(...) to a fixed temp path via p.writeOutput(...)
    • Added barrelContent to the declared output so the generated barrel is both returned and written
  • Sample shape

    • Preserved the barrel re-export example and export-symbol extraction tool
    • Kept the sample within the markdown sample constraints, including the required role annotation and compact code size
const tsBarrelReExporter = agent({
  model: "small",
  instructions: p`Generate a TypeScript barrel for skills/rig/engines ... ${p.writeOutput("barrelContent", "/tmp/rig-barrel.ts")}`,
  output: s.object({
    barrelContent: s.string,
    exports: s.array(s.string),
    outputFile: s.path,
    totalExports: s.int,
    filesScanned: s.int,
  }),
});

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix daily rig sample report issues Make sample 318 stdin-runnable for the daily Rig sampler Jul 30, 2026
Copilot AI requested a review from pelikhan July 30, 2026 10:54
@pelikhan
pelikhan marked this pull request as ready for review July 30, 2026 11:24
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /codebase-design — no blocking issues, but two readability suggestions.

📋 Key Themes & Highlights

Key Themes

  • Readability regression: the instructions, tool definition, and output schema were compressed into one-liners. For a sample file that exists to teach, this is a net negative — multi-line form is the convention throughout the rest of the sample directory.
  • Root contract fix is correct: removing input and switching to p.writeOutput with a fixed temp path is exactly the right way to satisfy the stdin-launcher contract.

Positive Highlights

  • ✅ Root cause correctly identified and fixed (input-free root required by stdin launcher)
  • barrelContent added to output so the generated barrel is both returned and written
  • p.writeInputp.writeOutput switch is semantically accurate
  • repair() addon retained

Not Addressed (out of scope, but worth noting)

  • No regression test guards against the sampler failure recurring — this is an existing gap in the test suite, not introduced by this PR.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 29.5 AIC · ⌖ 4.28 AIC · ⊞ 6.3K
Comment /matt to run again

totalExports: s.int,
filesScanned: s.int,
}),
instructions: p`Generate a TypeScript barrel for skills/rig/engines from ${p.bash("find skills/rig/engines -name '*.ts' -not -name 'index.ts' -not -name '*.d.ts' | head -20")}. Use extractExportedSymbols for each file, set outputFile to /tmp/rig-barrel.ts, write barrelContent to ${p.writeOutput("barrelContent", "/tmp/rig-barrel.ts")}, and return the declared output.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] The instructions are now a single dense line, sacrificing the readability that made the original multi-line template literal easy to scan.

💡 Suggested refactor

Split the template literal across lines:

instructions: p`Generate a TypeScript barrel for skills/rig/engines
from ${p.bash("find skills/rig/engines -name '*.ts' -not -name 'index.ts' -not -name '*.d.ts' | head -20")}.
Use extractExportedSymbols for each file, set outputFile to /tmp/rig-barrel.ts,
write barrelContent to ${p.writeOutput("barrelContent", "/tmp/rig-barrel.ts")},
and return the declared output.`,

This matches the style of other samples and keeps each prompt step scannable at a glance.

const symbols = [...content.matchAll(/^export\s+(?:(?:default\s+)?(?:function|class|const|let|var|type|interface|enum)\s+(\w+)|(\{[^}]+\}))/gm)].flatMap((match) => match[1] ? [match[1]] : match[2]!.replace(/[{}]/g, "").split(",").map((name) => name.trim().split(/\s+as\s+/)[0].trim()).filter(Boolean));
return { filePath, symbols };
},
})],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] The tool definition and output schema are now one-liners, which keeps file size down but harms readability in a sample whose purpose is to teach. Samples are documentation first.

💡 Suggested refactor

Expand the output schema and tool definition to multi-line form, consistent with every other sample in the directory:

  output: s.object({
    barrelContent: s.string,
    exports: s.array(s.string),
    outputFile: s.path,
    totalExports: s.int,
    filesScanned: s.int,
  }),

Similarly, break the tool handler body out of the one-liner .flatMap chain for legibility.

@pelikhan
pelikhan merged commit a6c9876 into main Jul 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rig-sampler] Daily Rig sample report — 2026-07-30

2 participants