Skip to content

[rig-claude] Improve Claude dynamic-workflow compatibility for rig - #449

Merged
pelikhan merged 1 commit into
mainfrom
rig-claude-compat/2026-08-18-4f700270d7766019
Aug 20, 2026
Merged

[rig-claude] Improve Claude dynamic-workflow compatibility for rig#449
pelikhan merged 1 commit into
mainfrom
rig-claude-compat/2026-08-18-4f700270d7766019

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Compatibility gap addressed

Two documented Claude dynamic-workflow compatibility points had no automated test coverage:

  1. warnAgents advisory warning — Claude dynamic workflows emit a session-level advisory warning when many agents are scheduled. Rig maps this to a warning event emitted after warnAgents agent calls. No test verified this behavior, making it easy to regress without notice.

  2. call.json with non-object schemas — Claude dynamic workflows only support object schemas in agent(prompt, { schema }). Rig's call.json accepts any s.* schema (s.enum, s.array, s.string, etc.) — a documented rig advantage. No test covered this, so users porting Claude workflows couldn't confirm the richer schema support was real.

Why this improves transfer from Claude dynamic workflows to rig

Both tests live in the dynamic-workflow parity describe block in src/workflow.test.ts, making them immediately discoverable by anyone searching for Claude compatibility coverage. The tests serve as executable specs that:

  • Confirm the warnAgentswarning event mapping works as documented in claude-workflow-conversion.md
  • Confirm call.json is not limited to object schemas, matching the documented advantage over Claude workflows

Files changed

  • src/workflow.test.ts — added two tests to the dynamic-workflow parity describe block

Validation run

npm run typecheck  →  passed (no errors)
npx vitest run src/workflow.test.ts  →  24/24 tests passed

Remaining intentional differences

  • No effort option — use a more capable model id instead (claude-opus-4-5 over claude-haiku-3-5)
  • No agentType: "Explore" — use prompt wording plus a narrow tools list
  • Retries are turn-based (maxTurns + repair()), not process-based ({ retries })
  • No resume journal, worktree isolation, or human checkpoints
  • Budget is denominated in agent calls (limits.maxAgents), not tokens

Generated by Daily Rig Claude Dynamic Workflow Compatibility · sonnet46 64.1 AIC · ⌖ 5.31 AIC · ⊞ 5.4K ·

… call.json schema

Adds two tests to src/workflow.test.ts that cover two documented compatibility
points between Claude dynamic workflows and rig that had no automated coverage:

1. warnAgents advisory warning: verifies that a run emits exactly one 'warning'
   event when the warnAgents threshold is crossed — the rig counterpart to the
   session-level advisory warning in Claude dynamic workflows.

2. call.json with a non-object schema (s.enum): verifies that call.json accepts
   any s.* schema, not just s.object. This is a documented rig advantage over
   Claude dynamic workflows, which only support object schemas.

Both tests are placed in the 'dynamic-workflow parity' describe block, making
them discoverable by anyone porting a Claude dynamic workflow to rig.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review August 20, 2026 16:01
@pelikhan
pelikhan merged commit 0af61d8 into main Aug 20, 2026
1 check passed
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /tdd — commenting on two test-quality issues; no blocking correctness errors.

📋 Key Themes & Highlights

Key Themes

  • Weak message assertion (line 256): stringContaining("2") is too loose; pin the exact message to make the test a real executable spec.
  • Missing configureAgent teardown (line 262): the stub factory is set globally and not reset, which can leak state into unrelated tests running in the same vitest process.

Positive Highlights

  • ✅ Both tests are well-placed in the dynamic-workflow parity describe block — immediately discoverable for anyone checking Claude compatibility.
  • ✅ The call.json + s.enum test is an excellent executable spec for a documented rig advantage; the approach and stub are clean.
  • ✅ PR description is thorough and maps each test to the documented compatibility point it covers.

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

Comment thread src/workflow.test.ts
});
const warnings = events.filter((event) => event.type === "warning");
expect(warnings).toHaveLength(1);
expect(warnings[0]).toMatchObject({ type: "warning", message: expect.stringContaining("2") });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/tdd] The stringContaining("2") assertion is weak — it would pass for any message containing the digit 2. The test should pin the exact message string emitted by the runtime to be a true executable spec.

💡 Suggested assertion
expect(warnings[0]).toMatchObject({
  type: "warning",
  message: `Workflow scheduled more than 2 agents.`,
});

This matches the literal string in rig.ts: `Workflow scheduled more than ${warnAgents} agents.`

Comment thread src/workflow.test.ts
it("call.json accepts a non-object schema (s.enum) — rig advantage over Claude dynamic workflows", async () => {
// Claude dynamic workflows only support object schemas in agent(prompt, { schema }).
// rig's call.json accepts any s.* schema: s.enum, s.array, s.string, etc.
configureAgent(() => ({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/tdd] configureAgent sets a global factory but is not reset after the test. If vitest runs tests in the same process (default), subsequent tests that do not call configureAgent themselves will inherit this stub factory, causing confusing failures.

💡 Suggested fix

Add cleanup, matching the pattern used in workflow one-off agents:

it("call.json accepts a non-object schema...", async () => {
  const originalFactory = /* capture before */ undefined;
  configureAgent(() => ({ ask: async () => high, close: async () => {} }));

  // ... test body ...

  // reset at the end, or use afterEach in a describe block
});

Or wrap this test (and the one-off agents tests) in a shared describe with an afterEach(() => configureAgent(defaultAgentFactory())) to keep teardown in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant