Skip to content

Bug: project agent skill picker stays stale after changing the project audience #3767

Closed

Description

@yannickmonney

Changing a project's Audience does not invalidate its already-loaded agent capability catalog. Newly available team skills remain absent when reopening New agent → Skills in the same session. Suggested severity: P2.

Reproduce locally

  1. Create a team-visible synthetic skill and an initially organization-wide project. Open the project's Agents tab, then New agent → Skills to warm its capability catalog. The team-only skill is correctly absent. Cancel without creating an agent.
  2. Open General, select that team in Audience and confirm the narrowing change.
  3. Return to Agents → New agent → Skills.

Expected: the picker reflects capabilities available to the newly saved project audience.

Actual: the skill is still absent, although a native capabilities GET for the same project now returns it. The UI adapter made only its original catalog request. Delivering a project hint and a resync through the real backend-hint listener still does not invalidate/refetch this catalog.

Cause and controls

useProjectCapabilityCatalog in app/features/projects/hooks/queries.ts uses the separate key ['projects', 'capability-catalog', organizationId, projectId]. useActionQuery defaults it to staleTime: Infinity. The sharing mutation adapter invalidates backend project keys, and use-backend-hints.ts invalidates backend entity/org prefixes. Neither matches this separate capability key.

The native project read confirms the new team audience. The native capability read confirms the skill is available. Explicitly invalidating the exact capability key produces a second adapter request and immediately reveals the skill in the same menu. The proof only tests availability after this same-session audience change; it does not claim unauthorized access or exercise agent execution. Stream messages are deliberately delivered through a fixture transport, not a live browser SSE measurement.

Distinct from #3712: connector credential writes emit no hint and leave a five-minute list stale across clients; here a successful same-session project write and delivered project/resync hints miss an Infinity-fresh, separately keyed catalog. Distinct from #3598's stale-write precondition and historical #3087 config-tree deploy failure. Reuse the shared query-key/invalidation scheme and cover both audience writes and relevant catalog updates.

Local evidence and limits

Actual UI source 300bcf076ac9d629518c108c363130fcc733a6b9; local native backend 480ee6a3e6d33c3414a2c0f8a52fded1ddc4ca2d. All 18 implicated source files were compared with fetched main 1d3ebf52c8376e0fcabb6a09f96aae1e88e54a51: unchanged from the tested UI snapshot; backend files are also unchanged from the running backend snapshot.

Parent independently executed five actual-component/native HTTP observations and controls: 5 passed, exit 0. These tests assert existing defects as well as successful controls; they are not fixes. Native requests use a real local authenticated session, PostgreSQL and retained synthetic projects/team/skill. Router/session-presence and stream transport are fixture seams. The real components, query hooks, adapters, native routes and hint listener run. Ancillary model/secret reads are inert; no agent is created or run. No production testing, provider calls or browser-layout claim.

Evidence retained outside the clone: project-settings-next/parent.probe.test.tsx, parent.config.ts, parent-replay.log, parent-observations.jsonl, parent-latest-source-check.json. Run from the isolated project-settings-current-main/services/platform checkout with PROJECT_AUDIT_UI_SHA=300bcf076ac9d629518c108c363130fcc733a6b9 bun x --no-install vitest run --config /Users/yannick/.codex/notes/tale-1000-additional/project-settings-next/parent.config.ts.

Dedup: 1,070 all-state GitHub issue bodies/titles, existing 102-finding baseline, 37 additional reports and accepted repo debt. Only distinct causes count; positive controls are not additional findings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions