Skip to content

feat: add optional model and reasoning effort fields for ACP agents - #699

Merged
pikann merged 4 commits into
masterfrom
feature/add-optional-model-and-reasoning-effort-fields-for-acp-agents
Nov 4, 2026
Merged

pikann merged 4 commits into
masterfrom
feature/add-optional-model-and-reasoning-effort-fields-for-acp-agents

Conversation

@pikann

@pikann pikann commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lets a user set an optional model and reasoning effort on an ACP agent. Both are stored on the agent and applied by paca-acp-bridge when it starts a session. Leaving either empty keeps the provider's own default.

Changes

Database / API

  • Migration 000079_add_acp_model_effort.sql adds acp_model and acp_effort (TEXT NOT NULL DEFAULT '') to agents; documented in docs/architecture/database-schema.md.
  • acp_model / acp_effort are accepted on create and update (project and global agents) and returned on the agent. On update, nil means unchanged and "" clears the value; values are trimmed.

Agent-runner

  • Reads both fields and includes them in the start_turn message sent to the bridge (acp_model, acp_effort).

paca-acp-bridge

  • Effort: set through the adapter's thought_level/effort config option, passed as entered.
  • Model, claude-code provider: passed as ANTHROPIC_MODEL in the adapter's environment (provider.ModelEnv). The Claude adapter only accepts models from its own list through ACP (Invalid value for config option model otherwise), whereas the Claude CLI accepts any model name from this variable. This is what makes custom names work with a non-Anthropic ANTHROPIC_BASE_URL, and it takes precedence over model in ~/.claude/settings.json.
  • Model, other providers: set through the model config option, falling back to session/set_model, with the value passed as entered.
  • acpclient.Spawn takes extra environment entries; new NewSessionInfo, SetConfigOption and SetModel. NewSession is unchanged.
  • Best-effort by design: a rejected model or effort is logged and the turn runs on the provider default. Successful applications are logged at info level.

Web

  • New AcpModelEffortFields, used by the create-agent dialog and the agent detail page: a free-text Model input and an Effort select (Provider default, Low, Medium, High, Extra high, Max).
  • Strings added to all 9 locales.

Notes for reviewers

  • The model is free text on purpose; there is no list of models in the UI.
  • Model and effort are read when a bridge session starts, so editing them affects the next session (restart the bridge or wait for the idle session to expire), not one already running.
  • Effort is applied after the model, since the levels a model supports can differ.
  • The third-party-host case depends on the user's own environment: the bridge inherits ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN from its shell.

Testing

  • go test for apps/acp-bridge, services/api and services/agent-runner; web tsc -b, biome and vitest (i18n and agents).
  • Checked what the Claude CLI sends by running the adapter against a local fake endpoint with a dummy token: the request carried "model": "claude-sonnet-5-5" and "output_config": {"effort": "medium"} (and low when set to low).
  • Not covered: the apps/e2e Playwright specs, and a run against a real Claude host.

- Introduced AcpModelEffortFields component for model and effort selection in agent detail and creation dialogs.
- Updated agent detail and create agent dialog to manage model and effort state.
- Enhanced agent API to support acp_model and acp_effort fields.
- Modified database schema to include acp_model and acp_effort columns in agents table.
- Added necessary translations for model and effort labels in multiple languages.
- Updated relevant services and repositories to handle new fields.

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

ℹ️ No critical issues — one minor UI note inline, plus a docs gap below.

Reviewed changes

  • ACP bridge plumbing — acpclient now exposes SessionInfo/ConfigOption, SetConfigOption, and the unstable SetModel; Spawn takes extraEnv; provider.ModelEnv injects ANTHROPIC_MODEL for claude-code; the runner applies model/effort after session/new, best-effort.
  • API and persistence — acp_model/acp_effort added to the agents table (migration 000079) and threaded through domain, DTO, handler, repository, and the agent-runner dispatch payload.
  • Web UI — new AcpModelEffortFields wired into agent detail and the create dialog, with dirty-tracking, payload updates, and translations in all locales.
  • Docs — docs/architecture/database-schema.md updated.

ℹ️ Sibling agent docs left stale

docs/ai-agent/database-schema.md states it "reflects the actual current schema", but its agents DBML still omits acp_model/acp_effort, and docs/ai-agent/api-design.md's agent request/response examples do not mention them. Since this PR updated docs/architecture/database-schema.md, the duplicated ai-agent copy now diverges from it.

Technical details
# Stale sibling docs

## Affected sites
- `docs/ai-agent/database-schema.md:69-70` — `agents` DBML lists `acp_provider`/`acp_command` only.
- `docs/ai-agent/api-design.md:37,79` — agent response/create examples omit the new optional fields.

## Required outcome
- The `ai-agent` copies describe the same `agents` columns and API fields as `docs/architecture/database-schema.md`.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

  • Corrected the EFFORT_LEVELS comment so it no longer claims the hard-coded list is a superset, and documented that agent-defined effort values may fall outside it.
  • Appended a stored acp_effort that is missing from EFFORT_LEVELS as an extra SelectItem, so a value set via the API now renders in the selector instead of appearing blank.
  • Documented acp_model / acp_effort in the agents DBML of docs/ai-agent/database-schema.md and in the ACP create/update notes of docs/ai-agent/api-design.md, bringing the sibling docs in line with docs/architecture/database-schema.md.

Both points from the previous review are addressed: the selector now represents any stored effort value at its minimum bar, and the duplicated ai-agent docs no longer diverge on the new fields.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

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

ℹ️ No critical issues — one API-docs sentence is now stale after this commit's new validation.

Reviewed changes

  • Added API-side normalization/validation for acp_model / acp_effort (trim, ≤200 bytes, reject control characters) with a new AGENT_ACP_MODEL_INVALID error, code, and unit test.
  • Made ConfigOptionFor prefer the spec's category match over the id fallback, so a colliding id can no longer win, plus a regression test.
  • Refreshed the agent's model/effort on the conversation's retained state every turn, so an idle-respawned session picks up edits, plus a test.
  • Passed provider.ModelEnv (ANTHROPIC_MODEL) into Spawn, so the Claude model override is actually applied instead of only logged.
  • Dropped the duplicated thought_level id in the effort lookup and associated the effort Label with its select trigger via id/htmlFor.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment thread docs/ai-agent/api-design.md Resolved

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

✅ No new issues found.

Reviewed changes

  • Corrected the acp_model/acp_effort note in docs/ai-agent/api-design.md: it now states that Paca trims both values and rejects ones over 200 bytes or containing control characters with 400 AGENT_ACP_MODEL_INVALID, while provider-specific acceptance remains the agent's job — matching normalizeACPModelEffort.

The docs thread from the previous review is addressed and resolved.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pikann
pikann merged commit 1091729 into master Nov 4, 2026
14 checks passed
@pikann
pikann deleted the feature/add-optional-model-and-reasoning-effort-fields-for-acp-agents branch November 4, 2026 08:09
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.

1 participant