Skip to content

feat(cli): add per-launch agent reasoning effort - #5994

Merged
Kitenite merged 2 commits into
ParadevAI:mainfrom
Roshvan:agent-thinking
Jul 28, 2026
Merged

Kitenite merged 2 commits into
ParadevAI:mainfrom
Roshvan:agent-thinking

Conversation

@Roshvan

@Roshvan Roshvan commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add --effort <level> to both superset agents create and superset workspaces create
  • carry the launch override through the TypeScript SDK and host service
  • validate agent-specific effort values before starting an agent or creating a worktree
  • document the supported levels and the default behavior across CLI and SDK
  • add focused CLI/host tests plus checked-in E2E evidence

UX contract

--effort is an explicit per-launch override. Omitting it passes no effort argument at all, so the underlying agent keeps its own configured default; Superset does not silently force medium.

The existing desktop New Workspace picker remains the visual launch control and continues to remember the last selection per agent. The CLI and SDK now expose the same underlying capability without introducing a second, potentially conflicting global default in Settings → Agents.

Invalid or unsupported values fail before side effects and report the choices for the selected agent.

End-to-end verification

Targeted the exact development instance for this worktree:

  • worktree: agent-thinking
  • desktop renderer: http://localhost:3105/#/workspaces
  • user journey: compiled CLI → local host service → new worktree → terminal agent → desktop workspace pane

Positive workspace lifecycle

Ran the compiled CLI with workspaces create --agent codex --effort high. It created a real worktree, launched Codex, and the desktop terminal showed both the high launch state and the E2E_WORKSPACE_EFFORT_OK response. The process argv independently contained -c model_reasoning_effort=high.

CLI-created Codex session showing high reasoning effort and the E2E marker

Desktop consistency

Opened the real New Workspace flow, selected Codex, and chose xHigh. This confirms the CLI addition uses the same agent-specific effort vocabulary already exposed by the installed desktop UI.

Desktop New Workspace flow with Codex and xHigh selected

Failure and default paths

  • agents create --agent codex --effort max failed with Unsupported reasoning effort and listed low, medium, high, xhigh.
  • workspaces create --agent codex --effort max failed before creating either the requested branch or workspace.
  • agents create --agent codex without --effort launched successfully; the observed process argv contained no model_reasoning_effort override.
  • workspaces create --agent codex --effort high returned a workspace and agent session, and the agent completed with the expected marker.

Automated gates

  • bun test packages/shared/src/agent-models.test.ts packages/host-service/src/trpc/router/agents/agents.test.ts packages/cli/src/commands/agents/create/command.test.ts packages/cli/src/commands/workspaces/create/command.test.ts — 42 passed
  • bun run lint — clean across 5,341 files
  • bun run typecheck — 35/35 tasks passed
  • bun run --filter @superset/cli build — passed
  • bun run --filter @superset/sdk build — ESM, CJS, and declaration build passed
  • GitHub CI — build, test, typecheck, lint, Sherif, version sync, and all three packaged CLI builds passed on this commit

Cleanup

After capture, the E2E workspace was deleted through the CLI, its test branch and empty worktree root were removed, all launched agents and dev servers were stopped, the disposable Docker stack and volume were deleted, the allocated port block was released, and generated auth/config/env files were removed.


Open in Stage

Summary by cubic

Adds a per-launch reasoning effort override to agent spawns across the CLI, SDK, and host. Users can set agent-specific levels or use the agent default; invalid values fail fast with clear choices, including during workspace creation.

  • New Features
    • CLI: superset agents create and superset workspaces create accept --effort <level>; on workspaces it requires --agent. Omitting --effort uses the agent’s default.
    • SDK: @superset/sdk adds optional effort to client.agents.create and to each agent entry in client.workspaces.create.
    • Host service: validates effort per agent (including rejecting overrides for agents that don’t support it), preflights effort during workspace creation to avoid side effects, and forwards valid values to the agent.
    • Docs: CLI and SDK refs updated with an “Agent effort levels” table per agent. Removed PR-evidence images.
    • Tests: added CLI and host tests for forwarding, omission, and validation paths.

Written for commit 25c72d5. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added an optional effort setting when launching agents through the CLI and SDK.
    • Workspace creation now supports configuring effort for spawned agents.
    • Supported effort levels vary by agent; omitted values use the agent default.
    • Invalid or unsupported effort settings are rejected with clear feedback.
  • Documentation

    • Updated CLI and SDK references with effort options, examples, supported levels, and usage requirements.
    • Added desktop product guidelines covering personas, design principles, branding, and accessibility.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds optional agent reasoning-effort overrides across SDK and CLI APIs, validates supported values in the host service, checks workspace launches before dispatch, and updates related documentation. Also adds a desktop product specification.

Changes

Agent effort override flow

Layer / File(s) Summary
Public effort contracts and reference documentation
packages/sdk/..., apps/docs/content/docs/...
SDK agent and workspace launch shapes now accept optional effort values, with updated API and CLI documentation describing supported levels and defaults.
CLI effort options and forwarding
packages/cli/src/commands/...
Agent and workspace creation commands accept effort options, enforce --effort with --agent for workspaces, forward values, and test explicit and omitted effort cases.
Host effort validation and launch enforcement
packages/host-service/src/trpc/router/agents/...
Agent effort selections are validated against resolved agent capabilities before terminal or Superset launches, with BAD_REQUEST and NOT_FOUND errors covered by tests.
Workspace agent pre-dispatch validation
packages/host-service/src/trpc/router/workspaces/workspaces.ts
Workspace creation validates each requested agent launch before continuing with workspace setup and dispatch.

Desktop product specification

Layer / File(s) Summary
Desktop product specification
apps/desktop/PRODUCT.md
Adds product scope, personas, positioning, brand guidance, design principles, and accessibility requirements for the desktop app.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant SDK
  participant HostService
  participant AgentConfig
  CLI->>SDK: create agent or workspace with effort
  SDK->>HostService: send effort in launch payload
  HostService->>AgentConfig: resolve supported effort levels
  AgentConfig-->>HostService: return agent capability
  HostService-->>CLI: accept launch or return validation error
Loading

Possibly related PRs

Suggested reviewers: avipeltz

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise, conventional, and accurately summarizes the main change: adding per-launch agent reasoning effort.
Description check ✅ Passed The description covers the change, rationale, testing, and validation details, so it is mostly complete despite not matching the template headings exactly.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ghost

ghost commented Jul 27, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 5 individual chapters for you:

Title
1 Update SDK types and configuration
2 Implement agent effort validation in host service
3 Integrate effort validation into workspace creation
4 Add effort flag to CLI commands
5 Document effort levels and CLI usage
Open in Stage

Chapters generated by Stage for commit 25c72d5 on Jul 28, 2026 9:33pm UTC.

@Roshvan
Roshvan marked this pull request as ready for review July 27, 2026 19:41

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/commands/workspaces/create/command.ts`:
- Around line 61-66: Update the validation around options.effort in the
workspace creation command to treat any value other than undefined, including an
explicitly empty string, as supplied; retain the !options.agent dependency check
and existing CLIError behavior.

In `@packages/host-service/src/trpc/router/agents/agents.ts`:
- Around line 177-225: Reject explicitly supplied empty effort values instead of
treating them as omitted: in validateAgentEffortSelection and
validateAgentLaunchEffort, return only when effort === undefined. Add a
regression assertion in
packages/host-service/src/trpc/router/agents/agents.test.ts lines 99-137 that
validateAgentEffortSelection("codex", "Codex", "") throws a BAD_REQUEST
TRPCError.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ca16bbe-14e9-4bd6-af60-ae7f1ab181fb

📥 Commits

Reviewing files that changed from the base of the PR and between 97e0446 and db3b68e.

⛔ Files ignored due to path filters (2)
  • apps/docs/public/images/cli/agent-reasoning-effort-cli-e2e.png is excluded by !**/*.png
  • apps/docs/public/images/cli/agent-reasoning-effort-desktop.png is excluded by !**/*.png
📒 Files selected for processing (15)
  • apps/desktop/PRODUCT.md
  • apps/docs/content/docs/cli/cli-reference.mdx
  • apps/docs/content/docs/sdk/reference.mdx
  • packages/cli/src/commands/agents/create/command.test.ts
  • packages/cli/src/commands/agents/create/command.ts
  • packages/cli/src/commands/workspaces/create/command.test.ts
  • packages/cli/src/commands/workspaces/create/command.ts
  • packages/host-service/src/trpc/router/agents/agents.test.ts
  • packages/host-service/src/trpc/router/agents/agents.ts
  • packages/host-service/src/trpc/router/agents/index.ts
  • packages/host-service/src/trpc/router/workspaces/workspaces.ts
  • packages/sdk/api.md
  • packages/sdk/src/resources/agents.ts
  • packages/sdk/src/resources/workspaces.ts
  • packages/sdk/tsconfig.json

Comment on lines +61 to +66
if (options.effort && !options.agent) {
throw new CLIError(
"--effort requires --agent",
"Pass --agent <id> alongside --effort",
);
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Treat an explicitly empty --effort as supplied.

--effort "" bypasses this truthiness check, so workspace creation proceeds without an agent instead of enforcing the documented dependency. Check for undefined and add an empty-value test.

Proposed fix
-		if (options.effort && !options.agent) {
+		if (options.effort !== undefined && !options.agent) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (options.effort && !options.agent) {
throw new CLIError(
"--effort requires --agent",
"Pass --agent <id> alongside --effort",
);
}
if (options.effort !== undefined && !options.agent) {
throw new CLIError(
"--effort requires --agent",
"Pass --agent <id> alongside --effort",
);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/commands/workspaces/create/command.ts` around lines 61 - 66,
Update the validation around options.effort in the workspace creation command to
treat any value other than undefined, including an explicitly empty string, as
supplied; retain the !options.agent dependency check and existing CLIError
behavior.

Comment on lines +177 to +225
export function validateAgentEffortSelection(
presetId: string,
label: string,
effort: string | undefined,
): void {
if (!effort) return;

const support = getAgentEffortSupport(presetId);
if (!support) {
throw new TRPCError({
code: "BAD_REQUEST",
message: `${label} does not support a reasoning effort override. Omit effort to use the agent default.`,
});
}

if (!support.efforts.some((option) => option.id === effort)) {
throw new TRPCError({
code: "BAD_REQUEST",
message: `Unsupported reasoning effort "${effort}" for ${label}. Choose one of: ${support.efforts.map((option) => option.id).join(", ")}.`,
});
}
}

/**
* Preflight a host-scoped launch before any larger workflow (such as
* workspace creation) performs side effects.
*/
export function validateAgentLaunchEffort(
db: HostDb,
input: Pick<AgentRunInput, "agent" | "effort">,
): void {
if (!input.effort) return;
if (input.agent === SUPERSET_AGENT_ID) {
validateAgentEffortSelection(
SUPERSET_AGENT_ID,
SUPERSET_AGENT_LABEL,
input.effort,
);
return;
}

const config = resolveHostAgentConfig(db, input.agent);
if (!config) {
throw new TRPCError({
code: "NOT_FOUND",
message: `No host agent config matching '${input.agent}' (tried instance id then preset id).`,
});
}
validateAgentEffortSelection(config.presetId, config.label, input.effort);

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject empty effort overrides rather than treating them as omitted.

Line 182 and Line 208 use if (!effort), so effort: "" bypasses validation. Treat only undefined as omission; then add a regression test for "".

  • packages/host-service/src/trpc/router/agents/agents.ts#L177-L225: replace both falsy guards with if (effort === undefined) return.
  • packages/host-service/src/trpc/router/agents/agents.test.ts#L99-L137: assert that validateAgentEffortSelection("codex", "Codex", "") throws BAD_REQUEST.

Based on PR objectives: explicitly supplied effort values must be validated before side effects.

📍 Affects 2 files
  • packages/host-service/src/trpc/router/agents/agents.ts#L177-L225 (this comment)
  • packages/host-service/src/trpc/router/agents/agents.test.ts#L99-L137
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/host-service/src/trpc/router/agents/agents.ts` around lines 177 -
225, Reject explicitly supplied empty effort values instead of treating them as
omitted: in validateAgentEffortSelection and validateAgentLaunchEffort, return
only when effort === undefined. Add a regression assertion in
packages/host-service/src/trpc/router/agents/agents.test.ts lines 99-137 that
validateAgentEffortSelection("codex", "Codex", "") throws a BAD_REQUEST
TRPCError.

Roshvan commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@kiet @satyan Right now you can choose an agent’s reasoning effort in the desktop app, but not when launching one through the CLI or SDK. This adds the same choice there without changing anyone’s defaults—would love your thoughts.

@Kitenite Kitenite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed and verified end to end:

  • Unit tests: 42/42 pass across agent-models, host-service agents, and both CLI command test files.
  • CLI smoke: --effort present in help for both commands; --effort without --agent fails fast client-side with the hint, before any host call.
  • Live E2E against this branch's host-service (dev desktop + CDP): invalid effort (bogus/turbo), effort on a non-supporting agent (Gemini), and effort on Superset chat all reject with the exact expected BAD_REQUEST messages — with zero side effects (no sessions, workspaces, or branches created). workspaces.create preflight rejects before worktree creation. Positive path: agents.run with effort: low spawned Claude with --effort low in the real process argv.
  • Docs: effort table matches AGENT_EFFORT_SUPPORT exactly.
  • sdk tsconfig rootDir: verified load-bearing — declaration build fails with TS5011 without it.

Pushed a cleanup commit removing the unrelated apps/desktop/PRODUCT.md and the two PR-evidence PNGs (they were unreferenced by any docs page).

One deliberate behavior change worth noting for the record: an invalid persisted effort now hard-fails the launch instead of silently degrading to the agent default (buildAgentEffortArgs' degrade path is unreachable from these entry points). Acceptable — explicit is better here — but the degrade-to-default doc comment on buildAgentEffortArgs is now stale for these callers.

Neon deploy job failures are the standard fork-PR missing-secrets limitation, unrelated to this change.

@Kitenite
Kitenite merged commit 006bda2 into ParadevAI:main Jul 28, 2026
16 of 18 checks passed
@harshithmullapudi harshithmullapudi mentioned this pull request Oct 5, 2026
2 tasks done
@Roshvan
Roshvan deleted the agent-thinking branch October 11, 2026 14:50

This branch had an error being deployed

1 failed deployment
preview — 25c72d57 Deployed Jul 28, 2026 by Kitenite via Deploy Database (Neon) #6907
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.

2 participants