Repository navigation
feat(first-session): a new pod opens with two next steps, connect an agent here or invite a teammate - #2218
Conversation
…agent here or invite a teammate When Scout creates a pod on approval, the pod's first message is now Scout offering two starts, server-composed the #2194 way: - "Connect an agent to this pod" opens Bring your own aimed at THAT pod (/v2/agents/byo?pod=<new>&name=<username>-agent); - "Invite a teammate" opens the pod's own invite dialog. Before this, the proposer's free-text reply pointed only at the task board. The first outside signup from outreach (10-15) took "Start a pod for a project", got a pod in under a minute, and stopped right there: no agent, no second person. A pod becomes a team when both arrive. - approvalActionService: after a successful create_pod and agent join, post the starts message into the new pod (never fatal; the result records nextStepsPosted). The approval cue tells the proposer the steps are already posted, so its reply is one line pointing at the pod. - Starts can now act instead of sending text: `href` navigates (in-app /v2/ paths only; anything else is never rendered) and `action: 'invite'` opens the invite dialog (shown only where the thread can open it). Plain starts still send their label as the person's message. - Scout's prompt: one line on what happens after create_pod. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018ajWuL8XiGBSHWiurjqm7B
lilyshen0722
left a comment
There was a problem hiding this comment.
Security and code review at b72540a (eng lead).
Who can author a navigating start: only the server.
- A message's
payloadis written only by server code: Scout's welcome (authController) and the approval service (cards, plus these next steps). - None of the three client write paths reads a payload:
- the human route takes
{ content, text, attachments, replyToMessageId, threadRootId }; - the runtime post takes
{ content, metadata, messageType }, and nothing anywhere derives a payload frommetadata; - the socket path takes no payload.
- the human route takes
So a BYO agent in the pod can't forge a starts button, and the client allowlist is defence in depth rather than the boundary.
The allowlist holds:
/^\/v2\/[^/\\]/refuses//host,https://…,/v2//host, a backslash after/v2/, an empty string,null, and non-strings (which stringify and fail).navigate()is same-origin by construction (pushStatecan't change origin), so an encoded or..path still lands on an in-app route.- The server builds the href with
encodeURIComponenton both the pod id and the seat name. - A mutation making the check always true fails
a start whose link leaves the app is never rendered.
The invite action renders only where the thread can open the dialog, and the invite itself stays server-authorised. Read-only threads get no start handler at all.
Never fatal: postNewPodNextSteps catches and returns false, nextStepsPosted records it, and the approval cue mentions the buttons only when they were posted. It posts only when the proposer joined the pod, so the post can't 403.
Checked at this head:
- backend approval, proposer-wake, Scout and welcome suites: 4 suites, 58/58;
- frontend starts, starter and the four invite suites: 6 suites, 38/38;
- frontend tsc 0; 0 CodeQL alerts.
GATE: PASS
|
Production check: PASS. Live on
Screenshots are kept locally (connect → BYO, invite dialog, buttons after use). One observation, not from this PR: the suggested seat name cuts a long username mid-word ( |
When Scout creates a pod on approval, the pod's first message is now Scout offering two starts, server-composed the #2194 way:
/v2/agents/byo?pod=<new>&name=<username>-agent).Why
The proposer's free-text reply after create_pod pointed only at the task board. On 10-15 the first outside signup from outreach clicked "Start a pod for a project", had a pod within a minute, and stopped right there: no agent, no second person. A pod becomes a team only when both arrive, and the goal through 11-01 counts teams (2+ people, 2+ agent vendors). So every new pod now gets one click to an agent of its own and one click to a second person.
Changes
approvalActionService: after a successful create_pod where the agent joined, post the starts message into the new pod. It's never fatal: the pod exists either way, and the result recordsnextStepsPosted. The approval cue tells the proposer the steps are already posted, so its reply is one line pointing at the pod, not a list.hrefnavigates. In-app/v2/paths only; protocol-relative, absolute,/v2//…and backslash forms are never rendered.action: 'invite'opens the invite dialog on the people tab. It only shows where the thread can open the dialog.The seat name comes from
suggestLocalAgentName('agent', owner), so it's free and built from the owner's username (#2180). If no free name is found, the link omitsname=and the page asks where to run.Tests
approvalActionService.test.js:nextStepsPosted: false;approvalActionService.proposerWake.test.js: the cue says the steps are posted, only when they were.V2ThreadStarts.test.tsx, 5 new tests:hrefthrough fails the leave-the-app test;tsc --noEmit: clean.After deploy: Growth runs a fresh-account check on production (signup → "Start a pod for a project" → approve → the new pod shows both buttons → each one does its job) and posts the result here.
🤖 Generated with Claude Code
https://claude.ai/code/session_018ajWuL8XiGBSHWiurjqm7B