Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: coder/coder
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: coder/coder
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: callum/rbac-fastpath-additional-cases
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 2 contributors

Commits on Dec 16, 2025

  1. perf(agentapi): skip GetWorkspaceAgentByID when RBAC object is cached

    Optimize BatchUpdateMetadata to avoid an unnecessary database call by
    skipping the GetWorkspaceAgentByID query when the workspace RBAC object
    is already cached in context.
    
    Previously, even with the RBAC fast path working, we would:
    1. Inject workspace RBAC object into context
    2. Call AgentFn() which calls GetWorkspaceAgentByID (1 DB call for auth)
    3. Call UpdateWorkspaceAgentMetadata (uses RBAC from context)
    
    Now with the optimization:
    1. Inject workspace RBAC object into context
    2. Skip AgentFn() and use the already-known agent ID directly
    3. Call UpdateWorkspaceAgentMetadata (uses RBAC from context)
    
    This eliminates one GetWorkspaceAgentByID call per metadata update.
    The AgentFn() call was only needed for authorization, but since we
    already have the RBAC object in context and we know the agent ID from
    a.opts.AgentID, we can skip the database fetch entirely.
    
    The slow path (when RBAC object is not cached) still calls AgentFn()
    to fetch the agent and perform authorization the traditional way.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    Callum Styan and claude committed Dec 16, 2025
    Configuration menu
    Copy the full SHA
    3a09e36 View commit details
    Browse the repository at this point in the history
Loading