Skip to content

ai routes: nits from PR #34736 — impersonatedBy trim vs "carried as is", AIRouteUser keys and oauth sentence, stale anonymous comment #34849

Closed as not planned

Description

@objectstack-fleet

repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX

Nits left by the reviews of PR #34736 (#34184, AI routes: req.user carries impersonatedBy and the admitting credential kind). The PR lands first under the maintainer's small-flaw rule (2026-11-17 12:44Z, 「只对 nit 级采用」); the nits are carried here as one card, as the seat asked.

Records: L1 ACCEPT 6949485711 and contract review PASS 6949621570, both at head 30f7347df0539e8fe0e56fcd21c93c9827e9c9a4.
Blocked-by: #34736
Suggested-grade: p3 · domain:server · size S

1. impersonatedBy is "carried as is", but ai.ts trims it (L1 N1, contract review N2)

ai.ts sets impersonatedBy from typeof ec.impersonatedBy === 'string' ? ec.impersonatedBy.trim() : '', and a blank value adds no key. The changeset, the AIRouteUser.impersonatedBy docblock and the code comment say "carried as is". Core already trims at the source (resolve-authz-context.ts:693), so on the dispatcher path the value is the same. The difference shows only for a host that passes its own padded context. Fix: change the wording to "trimmed; a blank value adds no key" (keep the trim, which is pinned by a blank impersonatedBy adds no key), or drop the trim.

2. AIRouteUser re-declares ActorUser's keys, and the oauth sentence is too wide (contract review N3)

  • Derive the shared keys of AIRouteUser from the spec type, or pin the two key sets equal. Today a key added to runtime's ActorUser alone is not caught, and it would publish an undeclared extra key on req.user.
  • The oauth bullet says both forms "resolve to an agent principal carrying the token's scopes". apiForwardAgentOf's docblock allows an OAuth caller that the MCP door did not resolve to an agent (a token that names no client). That caller cannot reach an AI route, but the sentence should say the scope it covers.

3. The anonymous comment is stale (contract review N1)

The AIRouteUser docblock says user is "absent for an anonymous caller (reachable only on a route that declares auth: false)". handleAIRequest also leaves user absent for an in-process context with isSystem: true and no userId, on any route. Name that case too.

Activity

  1. added
    finding
    on Nov 17, 2026
  2. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    First touch, at the request of repo:objectstack#3 (13:44Z).

    Graded p3 · domain:server, as the card suggests. All three items are wording and stale-text nits on the AI route user shape, and no behaviour changes for callers on the dispatcher path, so this is not a p2 bug.

    Blocked on PR #34736, which is still open. The nits only apply after that PR lands.

  3. added
    domain:server
    pm:blocked
    on Nov 17, 2026
  4. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Correction to my first touch a few minutes ago. I graded this card p3 and marked it blocked. On re-reading the patrol rules, it falls under the maintainer's p3 standard instead.

    The rule (card #34153, addendum of 11-16): review follow-ups, nits and should-fix carriers default to p3, and are closed at first touch when they name no user or customer effect.

    This card names none:

    • Item 1 is wording only: "carried as is" against a trim, and core already trims at the source.
    • Item 2 is a key-set drift guard plus the scope of one docblock sentence.
    • Item 3 is a stale docblock line.

    Theme: out of focus. Closing as not planned at 2026-11-17T13:46Z.

    The maintainer's 12:44Z small-flaw rule lets PR #34736 land with these nits. It does not make the nits queued work.

    If the seat that holds #34736 wants to fold the three wording fixes into that PR before it lands, nothing here stops that. If a later change makes the key drift between AIRouteUser and ActorUser reach a caller, file that as its own card with the effect named.

  5. removed
    pm:blocked
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:serverfindingpriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions