feat: add public Agent Template library and onboarding intent - #2133
feat: add public Agent Template library and onboarding intent#2133yuezengwu wants to merge 7 commits into
Conversation
…AA on template surfaces
|
Thank you for your contribution. Before it can be accepted, you must be covered by the First Tree ICLA v1.0. Sign individually with the exact comment below. If you contribute for an organization, an authorized signatory can instead complete the First Tree CCLA v1.0 and send it to legal@first-tree.ai for verification. I have read the CLA Document and I hereby sign the CLA kiven-fte seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
baixiaohang
left a comment
There was a problem hiding this comment.
Recommendation: request changes
- Rationale: Two asynchronous state races can either discard an explicit Template adoption or let a stale
/meresponse overwrite the current session.
Risk level: B-low
- Path baseline: includes
packages/server/**, but the touched service isoauth-bootstraprather than a B-high core service. - Semantic lift: the Web auth/data layer and cross-Team selection logic independently lift the Web portion to B-low; no A/B-high path is touched.
PR summary
- Author / repo: yuezengwu / agent-team-foundation/first-tree
- Problem: Let anonymous visitors discover official Agent Templates, preserve a chosen Template through sign-in, and create a Template-backed Agent in an explicitly confirmed Team or through that Team's onboarding flow.
- Approach: Adds public Library/detail routes, a strict canonical OAuth intent, authoritative Team confirmation, per-Team onboarding handoff, Template preselection in both creation surfaces, safe analytics, and AA foreground tokens.
- Impacted modules:
packages/shared, Server OAuth bootstrap, Web auth/Team selection, public Template pages, onboarding, New Agent creation, workspace chat routing, and design tokens.
Review findings
❌ 1. An explicit “Use this template” intent can silently become a plain Agent while its Template lookup is still pending. NewAgentDialog enables submit without waiting for templateCatalogLoaded, and StepCreateAgent enables create while intentSlug exists but intentTemplate has not resolved. In either surface, a slow/hung request lets the user submit templateIds: []; onboarding then clears the handoff after creation, so the requested responsibility is permanently lost without the user removing it or seeing an unavailable state. Keep creation disabled (with a loading state) while an explicit intent is unresolved, and permit plain creation only after a definitive unavailable/failure result or an explicit Remove. [R4 / packages/web/src/components/new-agent-dialog.tsx:741, packages/web/src/pages/onboarding/steps/step-create-agent.tsx:123]
❌ 2. Successful /me responses are not guarded against a logout or identity change that occurs while the request is in flight. selectOrganization records sessionMarker, but checks it only in the rejection path; a request started as user A can still return successfully after logout or after user B adopts tokens, and loadMe will repopulate user, memberships, confirmedOrgIdRef, the persisted selection, and the API org target from A. The new 401 test cannot cover this because it exercises only rejection. Capture the session/generation at request start and discard a successful response when it no longer matches before applying any state. [R4 / packages/web/src/auth/auth-context.tsx:293]
✅ The strict shared intent parser, public-safe Template DTO boundary, exact-Team membership check, and no-auto-retry ChatById guard are otherwise aligned with the documented cross-surface constraints.
Action taken
- Submitted request changes.
|
Superseded by the CLA-valid replacement PR: #2134 The repaired source from this PR was transferred onto current The replacement includes both requested review fixes (fail-closed unresolved Template intent and stale successful |
Summary
/templatesLibrary and/templates/:slugdetail routes over the existing public-safe catalog projection, including active, retired/replacement, empty, missing, loading, and recoverable error states./templates/:slug?use=1through GitHub/Google login, while rejecting extra, duplicate, encoded, absolute, hash, backslash, trailing-separator, and trailing-slash variants./mesnapshot confirms the exact membership; transport failure rolls back to the last confirmed Team, final 401/logout cannot resurrect old org state, and persistent ChatById failures do not create automatic retry loops.Boundaries
/?c=draft&with=<uuid>; a real first work loop remains a separate post-merge staging pilot.Validation
pnpm check— passed with 16 baseline warnings and no errors.pnpm typecheck— forced no-cache, 11/11 tasks.pnpm test— forced single-fork full monorepo run, 12/12 tasks; 912 files passed / 1 skipped, 10,105 tests passed / 4 skipped.8270c4ac47bb63aee5592853feb3aa979dfb3d07using an isolated production Server/Web/PostgreSQL/browser cell.Independent QA exercised anonymous discovery and leakage checks, strict login intent, exact-Team selection, deterministic
/meabort/retry and final-401 logout, ChatById retry bounds, per-org onboarding handoff, real Template and zero-Template Agent POSTs with API/DB readback, stale/failure recovery, and WCAG 2 AA across the new public controls. Brand CTA contrast measured 8.25:1 normal/focus and 5.58:1 hover.Change Surface
apps/clipublic CLI or help outputNotes