Skip to content

feat(assistant): the assistant leads the first session (abilityai/trinity-enterprise#1355) - #4736

Merged
vybe merged 11 commits into
devfrom
feature/1355-first-session
Nov 23, 2026
Merged

vybe merged 11 commits into
devfrom
feature/1355-first-session

Conversation

@trinity-ability

@trinity-ability trinity-ability commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Plan: which repo carries which step (abilityai/trinity-enterprise#1355)

Step This repo (platform frontend) Enterprise module Assistant service
1. No setup dialog where the assistant leads dialog predicate + wiring /status says leads_setup —
2. Two-button opening → website → three agents → Build opening, buttons, hand-off stub, first_session context — script + guarded website reader
3. Connect Claude at first run, run once, open the result the shared credential field (#1358) for ANTHROPIC_API_KEY, result link, first result opens the key is checked after the save; connected agents counted ask_credential step, run-once script, failed-build step
4. Examples and settings prompts off the first screen dashboard filter, panel list/nudge held — —
5. Channel offer, then the plan (allowance already in the header) — script
6. Tour + once-per-thing explanations, stop/start — — script + per-person memory (tour offered once per person)

Companion PRs (same branch name feature/1355-first-session): #4736 (frontend), abilityai/trinity-enterprise#1360 (status + key check), abilityai/trinity-gateway#26 (script + website reader). There is no connect-claude card or change any more: Claude is connected through the shared masked credential field. Draft until reviewed; not to be merged by me. No closing keyword: the issue closes manually at release.

What changes here

  • firstRunSteps.js / FirstRunOverlay.vue: where the instance says the assistant leads the first session, the setup dialog does not open by itself (it can still be opened), and it waits until the assistant corner is decided. Other installs are unchanged.
  • utils/firstSession.js: the page's words for that session, its step names in one place (for journey events later; nothing is emitted), the hand-off stub for agents run elsewhere, and the CLAUDE_SIGN_IN seam (null today).
  • Assistant panel: opens by itself with one question and two buttons; a typed answer works the same; turns carry first_session: true until the first result is seen. Claude is connected through the shared credential field (docs(#945): correct actor-model postcard — result-reporting + taxonomy/citation accuracy #1358) for ANTHROPIC_API_KEY: the value is saved on this instance and never part of a message. The line the assistant gets back says only provided / not provided, plus "Anthropic did not accept it" when the instance's own check says so. A finished run carries "Open the result", and the first one opens by itself.
  • Dashboard: example agents are left out of the fleet (network store, before the owner filter) until the person has an agent of their own or asks to see them. The panel's getting-started list and stage nudge wait until the first session is over.
  • Enterprise pointer: 552bd6a → 4766764 (abilityai/trinity-enterprise#1360's head). That commit already contains 636c6d5, so this overlaps chore(enterprise): bump submodule pin to 636c6d5 — assistant credential routes (trinity-enterprise#1358) #4744 (552bd6a → 636c6d5) on the same gitlink line, as a superset. Whichever lands second takes 4766764.

The opening placeholder and the retry error

The validation noted that the !store.statusError guard was gone from the opening placeholder. The retry error renders only while there is no status (the branch beside the conversation), so the placeholder cannot pulse under it. Putting the old guard back would blank the panel when a settle re-read fails with the status already on screen. So this is pinned with a test instead of restoring the guard. A template comment says why.

Tests

  • firstRunSteps.spec.js (+4), firstRunOverlayAssistantLeads.mount.spec.js (4, mounted), assistantWidget.mount.spec.js (+12, including "a failed first read shows the retry error alone: no loading placeholder pulses under it"; it goes red when a loading skeleton renders under the error), firstSessionExamples.spec.js (5), dashboardHidesExamples.mount.spec.js.
  • The 6 touched specs plus the raw-color, loading-gate and source-text ratchets: 228 passed.

🤖 Generated with Claude Code

Trinity Agent (trinity) and others added 5 commits November 23, 2026 10:05
… session (abilityai/trinity-enterprise#1355)

When the instance's assistant status says it leads setup, the first-run
dialog does not open by itself; it is still available on request (Re-run
setup / ?onboarding=1). It also waits until the corner is decided, so it
never opens and then yields. Installs where the assistant does not lead
are unchanged.

Tests: predicate cases in firstRunSteps.spec.js; a mounted dialog in
firstRunOverlayAssistantLeads.mount.spec.js pins the store wiring
(reverting the ctx line turns 'does not open where the assistant leads' red).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… two answers (abilityai/trinity-enterprise#1355)

Where the assistant leads setup and the person has no agent of their own,
the panel opens by itself (any width, unless closed before) and asks one
question: 'I already run agents in Claude Code' / 'Start from scratch'.
Start from scratch, or any typed answer, goes to the assistant with the
question it answers. The other button is a hand-off stub said on the page
(its own work: abilityai/trinity-enterprise#1353); nothing is sent.

utils/firstSession.js holds the page's words for this session and the step
names, in one place, for journey events (abilityai/trinity-enterprise#1352).
Nothing new is emitted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion (abilityai/trinity-enterprise#1355)

Each turn of the assistant-led first session carries first_session: true in
its context, so the assistant follows its script for that session (website
link, three proposed agents, Build). Other sessions send nothing new.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ns by itself (abilityai/trinity-enterprise#1355)

- connect-claude card: a masked Anthropic API key field in the panel,
  checked and saved on this instance exactly as Settings does; the key is
  never part of a message, and the assistant hears only 'Done: Connect
  Claude.'. utils/firstSession.js::CLAUDE_SIGN_IN is the one seam where
  the one-button sign-in (abilityai/trinity-enterprise#1354) replaces the
  field.
- A run that ends well carries 'Open the result' (the execution page).
  Where the assistant leads setup, the first such result opens beside the
  panel by itself, once.
- The first-session context stays on until that first result is seen, so
  the assistant keeps its script through build, connect and run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… screen (abilityai/trinity-enterprise#1355)

Where the assistant leads the first session:
- the agents the install came with are filtered out of the dashboard
  fleet (network store, before the owner filter, so every pane and the
  graph agree) until the person has an agent of their own, or presses
  'Show the example agents Trinity came with';
- the panel's getting-started list and the stage nudge (connect a model in
  Settings) wait until the first session is over.
Installs where the assistant does not lead are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keeps both sides of the conflict:
- AssistantWidget startTalking(): #4735's openingDecided gate (agent list and
  example names read, status settled) now also gates the first-session
  OPENING, so the question is never decided on an early, incomplete status
  or an empty fleet that has not loaded yet.
- stores/assistant greet(): the first-session early return and #4735's
  dedupe of an opener already on screen.
- The panel spec: both describe blocks.

Validator notes on #4735 taken: the pending-opening placeholder no longer
hides on statusError, so a failed settle re-read keeps it instead of leaving
a blank conversation; and its bars use the pre-status skeleton's grays.

Tests (each shown red under the matching mutation, then restored):
- first-session question waits for the settled status (red with the old
  `!store.status` gate);
- waits for the agent list: a person with their own agent gets the hello
  (red with `prepared` dropped from openingDecided);
- a failed re-read keeps the placeholder (red with `&& !store.statusError`);
- dashboardHidesExamples.mount.spec.js: how the Dashboard decides which
  example agents to hide (system agent not counted as own, hand-off to the
  network store, show-on-request remembered, cleared on unmount).

Refs abilityai/trinity-enterprise#1355

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ses the shared credential field (abilityai/trinity-enterprise#1355)

Brings the branch up to dev (a604afd, the assistant's masked credential
field, abilityai/trinity-enterprise#1358) and resolves the panel onto it, so
the panel has one credential card:

- the first session's own connect-claude card is gone: assistantCards no
  longer accepts it, the widget's masked key input and the store's
  connectClaude (which tested and saved the key from the page) are removed.
  The assistant asks for ANTHROPIC_API_KEY with ask_credential and the shared
  field saves it on this instance.
- the shared field, for this instance's Claude credential only, shows where to
  get it (an API key at Anthropic) and, after the save, the agents it
  connected (the save's connected_agents) and the instance's own check of the
  saved key: working false is said on the card and appended to the
  "Provided:" line the assistant hears. The value is on neither.
- CLAUDE_SIGN_IN stays the one seam for the Claude step, reshaped for
  abilityai/trinity-enterprise#1354 as { name, label, href }: the field shows
  the sign-in link and the person pastes the code into the same field. Not
  built.
- enterprise gitlink -> 4766764 (the check after the save and the count).
- assistantCredentialField.mount.spec.js: its vue-router mock gains useRouter,
  which this branch's widget uses; no assertion changed.

Tests: assistantWidget.mount.spec.js first-run block rewritten (3): the
first-session path stores through POST /api/enterprise/assistant/credential
and never /api/settings/api-keys, a rejected key is said without the value,
a connect-claude card renders nothing. Assistant/first-session/credential/
ratchet specs 362 passed; enterprise assistant + credential 178 passed.
Mutation: dropping the rejection suffix in credentialLine turns 'a key
Anthropic rejects after the save...' red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trinity-ability

Copy link
Copy Markdown
Contributor Author

/validate-pr: APPROVE once Tier 1 and the lane-C runs are green (validator run XsCeM4B5n3JEwNbhNhJF_A, head 72e3e5d)

Lane C, because the PR moves the src/backend/enterprise pointer to ent#1360's head. Validated together with ent#1360 and gateway#26, in fresh worktrees.

  • Tests: the 6 touched specs + the raw-color, loading-gate and source-text ratchets: 227 passed. Every subject is mounted; no new source-text reads in the new tests. Mutations, each caught:
    • overlay assistantLeads set to false: red
    • network.js filter reverted: red
    • first_session context removed: red
    • first-result auto-open removed: red
  • Example agents: hiding them is display only. It is a filter in stores/network.js::ownerFilteredAgents, set by the Dashboard and cleared when it unmounts. No API call or access check changes, and /agents/:name stays reachable.
  • Tour links resolve: /agents/:name/executions/:executionId (router/index.js:142), and ?tab=tasks|schedules (AgentDetail.vue:570).
  • Journey Impact: script PASSED; none declared.
  • Warnings (do not block):
    • The !store.statusError guard was removed from the pending placeholder. When the first status read fails, the pulsing placeholder now shows under the retry error.
    • No closing keyword.
    • The PR description still describes the removed connect-claude card; left unedited, as asked.
  • CI at report time: every check still pending (queue). journey-smoke and frontend-e2e must pass on the PR before merge (lane C).

The gateway's read_website has a blocking finding (see Abilityai/trinity-gateway#26). This PR only sends first_session: true, so it is safe on its own. The path it opens is not, until the gateway is fixed.

…ne (abilityai/trinity-enterprise#1355)

Validation XsCeM4B5n3JEwNbhNhJF_A flagged the removed !store.statusError guard
on the opening placeholder. The retry error renders only while there is no
status, in the branch beside the conversation, so the placeholder cannot pulse
under it; putting the old guard back would blank the panel when a settle
re-read fails with the status on screen (the test added with it). Pinned with a
mount test instead: the first reads fail, the error shows, nothing aria-busy
beside it. Mutation: the loading skeleton rendered under the error turns it red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trinity-ability

Copy link
Copy Markdown
Contributor Author

/validate-pr re-validation: APPROVE once re-pinned and Tier 1 is green (validator run Zqjq3aKcBH1mjog-KtmXmA, head cd6c227)

Lane C (the enterprise pointer moves). I am not the fix run.

The placeholder guard: the fix run's claim holds, checked by probe. In AssistantWidget.vue the retry error (:253) is only inside v-if="!store.status", and the opening placeholder (:269) is only inside that branch's v-else. They cannot render together. Two mutations:

  • (a) Put the old && !store.statusError guard back. The existing test "a failed re-read while settling keeps the placeholder: never a blank conversation" goes red. So restoring the guard would have brought a blank panel back, and leaving it out is right.
  • (b) Render the error beside the conversation too. The new test stays green. It only covers the no-status branch, where the conversation is never rendered, so it does not pin the overlap. The structure is what prevents the overlap. Suggestion, not blocking: also assert it with status present and statusError set during a settle.

Specs: the 6 touched specs plus the raw-color, loading-gate and source-text ratchets, at cd6c227: 228 passed.

Merge order (the pointer)

CI: CodeQL (both), schema-parity, verify-non-root, gitleaks, frontend-build, journey-smoke, frontend-e2e, prod-image-smoke, journey-impact and the enterprise-less boot are all green. pytest (head, seed 12345) was still running at report time, and regression diff has not reported yet. Both must be green on the re-pinned commit. dev is green: dev-last-green.sh resolves, and no dev-ci red issue is open.

Still open from last time: no closing keyword (the issue closes manually at release), and the description still mentions the removed connect-claude card.

The gateway half is still REQUEST CHANGES (Abilityai/trinity-gateway#26, a pool-exhaustion residual on the website reader). It affects availability only, not the link-provenance fix. This PR only sends first_session: true.

Trinity Agent (trinity) and others added 3 commits November 23, 2026 15:46
…terprise pin 636c6d5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… enterprise#1360 squash-merged to main (abilityai/trinity-enterprise#1355)

The pointer is moved deliberately to exactly 26ccbb379929c978c74797803d3b852f9caff222,
the squash-merge of abilityai/trinity-enterprise#1360 on enterprise main (the
status saying when the assistant leads the first session). It replaces the
pre-merge branch commit 4766764 that this branch pinned before, and descends
from 636c6d5, the pin dev carries since #4744, so nothing on dev is dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n (abilityai/trinity-enterprise#1355)

The placeholder test covered only the no-status branch, where the conversation
is never rendered, so rendering the error beside the conversation too stayed
green (re-validation Zqjq3aKcBH1mjog-KtmXmA, mutation b). It now also mounts a
settle where the status is on screen and the re-read fails (statusError set),
and asserts the retry error never shows while the conversation input does.

Mutation: an InlineError on statusError inside the conversation branch makes
"a failed first read shows the retry error alone" go red
(expected [250, 250, 250, 500, 500, 1000, 2000] to deeply equal []).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trinity-ability
trinity-ability marked this pull request as ready for review November 23, 2026 20:47
@trinity-ability

Copy link
Copy Markdown
Contributor Author

Fix continuation after re-validation Zqjq3aKcBH1mjog-KtmXmA, head 3779abc8:

  • Merged origin/dev (171fbdc, which has chore(enterprise): bump submodule pin to 636c6d5 — assistant credential routes (trinity-enterprise#1358) #4744) by a merge commit, 7cc6e0f. It merged clean.
  • Moved src/backend/enterprise on purpose to exactly 26ccbb379929c978c74797803d3b852f9caff222, the squash of ent#1360, in commit db9416e. That commit is enterprise main's tip and a descendant of dev's pin 636c6d5.
  • Strengthened "a failed first read shows the retry error alone". It now also mounts a settle where the status is on screen and the re-read fails. Mutation (b), the error rendered beside the conversation, now goes red.
  • 9 specs (the 6 touched plus the raw-color, loading-gate and source-text ratchets): 228 passed.
  • Marked ready for review. Not merged.

@github-actions

Copy link
Copy Markdown

⚠️ Nightly unit-suite found regressions when this PR is merged into dev (1 of 3 seeds).

Regression details (head_sha: `d2ae30f6ab1add9a8468801a9b9bfdca72d08207`)

Seed 99999

Backend unit-suite regression diff

Per-XML totals

Side Path Total Pass Fail Error Skip
base junit-base-pr4736-99999.xml 43052 42946 4 0 102
head junit-head-pr4736-99999.xml 43052 42945 5 0 102

❌ New failures introduced by HEAD (1)

Tests failing under HEAD that did not fail under BASE in any seed:

  • [F] test_lilu257_opencode_runtime::test_images_are_attached_with_dash_f

Legend: [F] = assertion failure, [E] = collection or fixture error.
Identity = (classname, name, kind); union taken across all input XMLs.

Reproduce locally: git merge dev && ( cd tests && python -m pytest unit/ -m "not slow" -p randomly --randomly-seed=99999 )

@trinity-ability

Copy link
Copy Markdown
Contributor Author

Re-validation (third pass, fix commits only) — 3779abc85f — APPROVE (merge gate ⏳: regression diff has not run yet)

Validator exec VOeI8rFckdmTCD12DwXonw (not the fix run).

  • Enterprise pointer: src/backend/enterprise at head is exactly 26ccbb379929c978c74797803d3b852f9caff222. compare main...26ccbb3 on trinity-enterprise returns identical (ahead 0, behind 0), so the pointer is enterprise main's tip.
  • Merge of dev: compare dev...3779abc85 gives ahead 11, behind 0, so the head contains the current dev tip. 7cc6e0fba merges 171fbdc37 into cd6c227ae.
  • Strengthened placeholder test, with my own mutation: I inserted <InlineError v-if="store.statusError" … retryable /> into the conversation branch of AssistantWidget.vue, after the sendError line.
    • assistantWidget.mount.spec.js › … a failed first read shows the retry error alone goes red: expected [ 250, 250, 250, 500, 500, 1000, 2000 ] to deeply equal [].
    • Unmutated, it is green (1 passed). The tree was restored afterwards.
  • CI at 3779abc85:
    • Green: the four required contexts, pytest (head, seed 12345), cached dev baseline, the sys.modules lint, frontend-build, frontend-e2e, journey-smoke, journey-impact, prod-image-smoke, gitleaks, screenshot-guard, build-without-submodule, and the container-security checks.
    • pytest (base, inline fallback) has been in progress since 20:48Z, and regression diff has not been created yet. Tier 1 is not complete until it is green, so do not merge before then.
    • dev-ci on dev: success.

Verdict: APPROVE on content. Merge once regression diff is green.

@trinity-ability

Copy link
Copy Markdown
Contributor Author

Merge gate update: pytest (base, inline fallback) and regression diff are both green at 3779abc85. Every first-tier required check is now green, so the APPROVE above stands with nothing left pending.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after three independent validation passes (last: APPROVE at 3779abc) and green CI. Enterprise pointer is on enterprise main (26ccbb379).

@vybe
vybe merged commit c62030c into dev Nov 23, 2026
26 checks passed
@github-actions

Copy link
Copy Markdown

⚠️ Live-instance suite skipped — merge conflict against dev.

Resolve by merging dev locally and pushing the result; the next nightly re-tests.

vybe pushed a commit that referenced this pull request Nov 24, 2026
…token or an API key, tested before it is saved (Abilityai/trinity-enterprise#1354) (#4752)

* feat(assistant): connect Claude with a sign-in link and a pasted code, no terminal (Abilityai/trinity-enterprise#1354)

The instance runs the sign-in `claude setup-token` runs (PKCE, Claude
Code's public client id, the manual redirect, scope user:inference, a
one-year token) with the instance as the client, so a person with only a
browser can connect their Claude subscription:

* POST /api/subscriptions/claude-sign-in makes a fresh link for the caller;
  the PKCE verifier stays on the instance (Redis, bound to the caller,
  15 min, single use).
* POST /api/subscriptions/claude-sign-in/exchange takes the pasted
  `<code>#<state>`, spends the link, exchanges the code and registers the
  token as `primary` through POST /api/subscriptions' own handler, so
  encryption, the first-credential connect of waiting agents and the #2572
  sweep are unchanged. The token is never returned.
* Refusals are named and store nothing (code_incomplete, sign_in_expired,
  code_rejected, anthropic_unavailable, unexpected_answer,
  store_unavailable); a missing encryption key is refused before the code
  is spent. Person + admin only. No code, state or token in any log line.

The assistant's Claude card (the CLAUDE_SIGN_IN seam left by #4736) now
shows three steps with the instance's link, the API key as the
alternative in the same field, and a fresh link after a refused paste.
The instance's Claude card is held as CLAUDE_SUBSCRIPTION, which the
enterprise side routes by shape (sign-in code, sk-ant-oat01-, sk-ant-api).
The enterprise pin moves to that change (trinity-enterprise branch
feature/ent1354-claude-sign-in).

Tests: tests/unit/test_ent1354_claude_sign_in.py (21);
assistantClaudeSignIn.mount.spec.js (5, mounted through the real widget
and store). Mutations: dropping the per-person binding turns
test_another_persons_link_does_not_finish_for_you red; dropping the
pre-exchange encryption check turns
test_the_code_survives_a_missing_encryption_key red. Two existing
assertions updated for the new name (assistantCredentialField,
assistantWidget).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(assistant): the sign-in exchange is person-pinned, audited and answers inside the assistant's wait (Abilityai/trinity-enterprise#1354)

- Provider timeout 30 s -> 8 s: the code is spent when the exchange starts,
  and the assistant's loopback gives up at 30 s with "may or may not have
  been stored"; the provider now ends in a named refusal well before that.
- A successful exchange writes a credentials/subscription_signed_in audit
  row: subscription name and actor only, never the token or the code.
- A paste that is plainly an API key (sk-…, ant-api…) is answered
  api_key_not_code with the API-key format message, without spending the link.
- Tests: assert_person on both routes is pinned by principals that pass
  assert_admin (system scope, agent-vouched) — red with the check deleted;
  every refusal the exchange can give is checked for the paste; the timeout
  is pinned against the enterprise side's when it is mounted.
- Enterprise pointer -> 3adcdca (the #1376 branch head: token tested before
  it is saved).

Red before the fix: TestAnApiKeyInTheCodeField (x3), TestTheAuditRow, and
test_the_provider_timeout_is_well_under_the_assistants_wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(assistant): connect Claude by pasting a token made in a terminal; remove the instance sign-in (Abilityai/trinity-enterprise#1354)

Ruled 2026-11-24 after legal's read: "we will go with terminal key creation
and pasting into system." The instance no longer starts a sign-in with the
provider or exchanges a code. Removed, not flagged off:

- services/claude_sign_in_service.py (PKCE link, the per-person Redis-held
  verifier, the code exchange, the provider client id and endpoints)
- POST /api/subscriptions/claude-sign-in and .../claude-sign-in/exchange,
  their models (ClaudeSignInLink, ClaudeSignInExchange) and the
  subscription_signed_in audit row
- tests/unit/test_ent1354_claude_sign_in.py and its registry entry
- the store's claudeSignInLink and the card's link fetch
- the api-endpoints / feature-flow rows for the two routes

Kept: the card, now three short steps (open a terminal on your own
computer, run claude setup-token, paste the token it prints here) with an
Anthropic API key as the alternative in the same field. Routing by shape,
test-before-save, the plain refusals (a '#' paste is told a token is
expected) and the card's audit row live in the enterprise pin, bumped to
f88740b (Abilityai/trinity-enterprise#1376).

Tests: assistantClaudeToken.mount.spec.js (renamed from
assistantClaudeSignIn) + credential field + widget + ratchets, 163 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(enterprise): pin the Claude card's test-first API key (Abilityai/trinity-enterprise#1354)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(enterprise): re-pin to 7d2b825 — trinity-enterprise#1376 merged to main (Abilityai/trinity-enterprise#1354)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Trinity Agent (trinity) <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants