Skip to content

fix(agent-designer): model write-check rejects models the picker lists (403)#599

Merged
philmerrell merged 1 commit into
developfrom
claude/agent-designer-phase-4-ui-666b5e
Jul 8, 2026
Merged

fix(agent-designer): model write-check rejects models the picker lists (403)#599
philmerrell merged 1 commit into
developfrom
claude/agent-designer-phase-4-ui-666b5e

Conversation

@philmerrell

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #598 (merged). The model-access fix landed on the branch after #598's merge commit, so it isn't in develop yet — this PR carries just that one commit.

The bug

The Agent Designer model picker and the save path use two different access checks that disagree:

  • Catalog (populates the picker) → ModelAccessService.filter_accessible_models, which grants a model whenever its id is in the user's AppRole permissions.models.
  • Save validationModelAccessService.can_access_model, which only honors that same AppRole membership when the model record also has a non-empty allowed_app_roles (the membership check is nested under if model.allowed_app_roles:).

So a model granted purely via the user's AppRole, whose record has an empty allowed_app_roles, is listed by the picker but 403s on save — e.g. us.anthropic.claude-sonnet-4-6. The runtime resolver checks membership directly, so it would actually have allowed the model; the write check was the sole outlier.

The fix

Design-time validation now uses the same filter_accessible_models predicate the catalog uses, so "if the palette offers it, the write accepts it" holds by construction. Adds a regression test for the empty-allowed_app_roles membership grant.

Testing

  • 41 agent-designer + /agents route tests pass (incl. the new regression test).

Reviewer note

Base is develop. The diff is a single commit (128729a9) — the other Phase 4 commits are already in develop via #598.

🤖 Generated with Claude Code

The catalog lists models via ModelAccessService.filter_accessible_models,
but design-time write validation used can_access_model — and the two
disagree. filter_accessible_models grants access whenever the model id is
in the user's AppRole permissions.models; can_access_model only honors that
membership when the model record ALSO carries a non-empty allowed_app_roles.
So a model granted purely via the user's AppRole (empty allowed_app_roles)
was listed by the picker but rejected on save with a 403 — and the runtime
resolver (membership-based) would actually have allowed it.

Validate the model with the same filter_accessible_models predicate the
catalog uses, so 'if the palette offers it, the write accepts it' holds by
construction. Adds a regression test for the empty-allowed_app_roles grant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@philmerrell philmerrell merged commit 5857457 into develop Jul 8, 2026
4 checks passed
@philmerrell philmerrell deleted the claude/agent-designer-phase-4-ui-666b5e branch July 8, 2026 05:43
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