fix(agents): persist agent type provider chain and failover #931

Merged
charles merged 1 commit from fix/agent-type-provider-dispatch into main 2026-05-07 22:47:25 +00:00
Collaborator

Summary

Agent type Provider edits in the dashboard were not persisted: putAgentConfig only called identity, container, routing, and service-config endpoints, so provider chain / failover / token cap never reached SQLite.

Changes

  • PUT /api/agent-types/:name/dispatch — persist provider_chain_json, failover_json, and usage_threshold_tokens on agent_type_config with validation via parseProviderChain.
  • Web: extend putAgentConfig to call dispatch when dispatch fields differ; include usage_threshold_tokens in composed fetchAgentConfig snapshot.
  • GET derived: merge DB dispatch over factory type config; tighten types for provider chain overlay.
  • Revisions: restore path for agent_type_config revisions.
  • Migration 0009: add dispatch columns via addProviderDispatchColumnsIfPresent (safe when agent_type_config is missing — legacy stub DBs).
  • fix: invalidate instance skill queries with a prefix after type-level skill saves.

Testing

just qa (pre-push hook passes).

## Summary Agent type **Provider** edits in the dashboard were not persisted: `putAgentConfig` only called identity, container, routing, and service-config endpoints, so provider chain / failover / token cap never reached SQLite. ## Changes - `PUT /api/agent-types/:name/dispatch` — persist `provider_chain_json`, `failover_json`, and `usage_threshold_tokens` on `agent_type_config` with validation via `parseProviderChain`. - Web: extend `putAgentConfig` to call dispatch when dispatch fields differ; include `usage_threshold_tokens` in composed `fetchAgentConfig` snapshot. - GET `derived`: merge DB dispatch over factory type config; tighten types for provider chain overlay. - Revisions: restore path for `agent_type_config` revisions. - Migration `0009`: add dispatch columns via `addProviderDispatchColumnsIfPresent` (safe when `agent_type_config` is missing — legacy stub DBs). - **fix:** invalidate instance skill queries with a prefix after type-level skill saves. ## Testing `just qa` (pre-push hook passes).
fix(agents): persist agent type provider chain and failover
Some checks failed
qa / dockerfile (pull_request) Successful in 11s
qa / sql-layer-check (pull_request) Successful in 13s
qa / i18n-string-check (pull_request) Successful in 15s
qa / db-schema (pull_request) Successful in 26s
qa / qa-1 (pull_request) Failing after 10m6s
qa / qa (pull_request) Failing after 0s
ddf660c766
- Add PUT /api/agent-types/:name/dispatch and wire putAgentConfig to save
  provider_chain, failover, and usage cap to agent_type_config.
- Extend agent_type_config schema, GET derived merge, and config revision
  restore for agent_type_config.
- Migration 0009: add dispatch columns via TS helper so legacy stub DBs
  without agent_type_config do not fail migration.
- Invalidate instance skill queries on type-level skill updates (prefix).

Co-authored-by: Cursor <cursoragent@cursor.com>
reviewer left a comment

Code logic looks correct: schema/migration/resolver/endpoint/web client changes are consistent, addProviderDispatchColumnsIfPresent is safe for legacy stubs, revision path for agent_type_config is wired up, query prefix invalidation fix is right.

- **ci**: CI run #3190 is red (https://forge.jacquin.app/charles/claude-hooks/actions/runs/1668) — cannot approve a failing PR. Fix the failing job and push a new commit. Code logic looks correct: schema/migration/resolver/endpoint/web client changes are consistent, `addProviderDispatchColumnsIfPresent` is safe for legacy stubs, revision path for `agent_type_config` is wired up, query prefix invalidation fix is right.
feat(secrets): persist operator admin PAT, hard-fail rotate-secret without it
All checks were successful
qa / sql-layer-check (pull_request) Successful in 14s
qa / i18n-string-check (pull_request) Successful in 14s
qa / dockerfile (pull_request) Successful in 15s
qa / db-schema (pull_request) Successful in 40s
qa / qa-1 (pull_request) Successful in 2m8s
qa / qa (pull_request) Successful in 0s
a00628a73c
Onboarding apply now stores the admin token under a per-forge secret name
(FORGEJO_ADMIN_TOKEN / GITLAB_ADMIN_TOKEN) after a successful mint, so
later repo-admin operations can reuse it without re-prompting. The
rotate-secret route reads that secret instead of grabbing any agent
token (which lacks admin scope on operator-owned repos and silently
502'd) and returns 412 with a clear message when the secret is absent.
The existing /secrets HTTP surface manages the value going forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
charles force-pushed fix/agent-type-provider-dispatch from a00628a73c
All checks were successful
qa / sql-layer-check (pull_request) Successful in 14s
qa / i18n-string-check (pull_request) Successful in 14s
qa / dockerfile (pull_request) Successful in 15s
qa / db-schema (pull_request) Successful in 40s
qa / qa-1 (pull_request) Successful in 2m8s
qa / qa (pull_request) Successful in 0s
to ddf660c766
Some checks failed
qa / dockerfile (pull_request) Successful in 11s
qa / sql-layer-check (pull_request) Successful in 13s
qa / i18n-string-check (pull_request) Successful in 15s
qa / db-schema (pull_request) Successful in 26s
qa / qa-1 (pull_request) Failing after 10m6s
qa / qa (pull_request) Failing after 0s
2026-05-07 22:33:29 +00:00
Compare
charles deleted branch fix/agent-type-provider-dispatch 2026-05-07 22:47:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!931
No description provided.