Python
Add worker session navigation back to its lead
Rohit C Prasadb7ef51c36001
diff --git a/surfaces/gui/e2e/team-view.spec.ts b/surfaces/gui/e2e/team-view.spec.tsindex 44399ac4..1adfead1 100644--- a/surfaces/gui/e2e/team-view.spec.ts+++ b/surfaces/gui/e2e/team-view.spec.ts@@ -1,5 +1,17 @@import { expect, test } from "@playwright/test";+test("a directly opened worker retains a route back to its lead after reload", async ({ page }) => {+ await page.goto("/?scenario=team-view-5#/s/scn-team-view-5-sam");+ await expect(page.getByTestId("session-title")).toHaveText("sam");+ await expect(page.getByRole("button", { name: "Back to lead" })).toBeVisible();+ await page.reload();+ await expect(page.getByRole("button", { name: "Back to lead" })).toBeVisible();+ await page.getByRole("button", { name: "Back to lead" }).click();+ await expect(page.getByTestId("session-title")).toHaveText("Refund rounding · Acme");+ await expect(page).toHaveURL(/#\/s\/scn-team-view-5$/);+ await expect(page.getByTestId("back-to-lead")).toHaveCount(0);+});+test("team icon, task chip, worker message and all three tabs work together", async ({page,}) => {diff --git a/surfaces/gui/e2e/team.spec.ts b/surfaces/gui/e2e/team.spec.tsindex 6a3c44d5..b4f61994 100644--- a/surfaces/gui/e2e/team.spec.ts+++ b/surfaces/gui/e2e/team.spec.ts@@ -208,6 +208,9 @@ test("approval creates the team; members live in the drawer, RECENT keeps one enawait panel.getByTestId("team-row-nia").click();await expect(page.getByTestId("rail-toggle-progress")).toBeVisible();await expect(page.getByTestId("rail-toggle-team")).toHaveCount(0);+ await page.getByRole("button", { name: "Back to lead" }).click();+ await expect(page.getByTestId("session-title")).toHaveText("Build the statements page");+ await expect(page.getByTestId("back-to-lead")).toHaveCount(0);});// Token counting (connectors-across-machines §5): the lead's Team panel rolls the treediff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsxindex c38cc83a..24498601 100644--- a/surfaces/gui/src/App.tsx+++ b/surfaces/gui/src/App.tsx@@ -1233,6 +1233,12 @@ export function App() {// Seventeenth pass: the drawer's Team panel — this session's staff (workers whose// lead is the current session). The sidebar shows ONE entry per team; members live here.const curSession = sessions.find((s) => s.session_id === sessionId);+ // Follow the stored team relationship, not browser history: a worker may+ // have been opened directly, from the Inbox, or after a reload.+ const workerLeadId = curSession?.team?.role === "worker"+ ? curSession.team.lead_session+ : undefined;+ const workerLead = sessions.find((s) => s.session_id === workerLeadId);const teamMembers = sessions.filter((s) => s.team?.role === "worker" && s.team.lead_session === sessionId,);@@ -2046,6 +2052,21 @@ export function App() {</button></div>)}+ {workerLeadId && workerLeadId !== sessionId && (+ <button+ className="text-meta text-muted hover:text-ink shrink-0 px-2 py-1 disabled:opacity-50"+ data-testid="back-to-lead"+ onPointerDown={(e) => e.stopPropagation()}+ disabled={!workerLead}+ title={workerLead ? t("teamview.back_to_lead") : t("teamview.lead_unavailable")}+ aria-label={t("teamview.back_to_lead")}+ onClick={() => {+ if (workerLead) void selectSession(workerLead.session_id, workerLead.workspace, workerLead.agent);+ }}+ >+ ← {t("teamview.lead")}+ </button>+ )}{/* §32: no session-settings row up here anymore — the §23 rest/hover/click glancemachinery retired with the drawer. "What can this touch" lives permanently onthe rail's Access section header; the panel toggle is the one entry. */}diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.jsonindex b6436e96..48554f0b 100644--- a/surfaces/gui/src/locales/en.json+++ b/surfaces/gui/src/locales/en.json@@ -2364,6 +2364,8 @@"action_error": "The action could not be completed. Your work has not been confirmed.","send_error": "The message was not accepted.","message_worker": "Message {{worker}}…",+ "back_to_lead": "Back to lead",+ "lead_unavailable": "The lead session is not available in this session list.","linked_tasks": "Assigned tasks ({{count}})","related_conversations": "Related worker conversations","send": "Send",diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.jsonindex 2a2ce131..e98337f4 100644--- a/surfaces/gui/src/locales/zh.json+++ b/surfaces/gui/src/locales/zh.json@@ -2324,6 +2324,8 @@"action_error": "操作未能完成,尚未确认你的更改。","send_error": "消息未被接受。","message_worker": "向 {{worker}} 发送消息…",+ "back_to_lead": "返回负责人",+ "lead_unavailable": "此会话列表中没有可用的负责人会话。","linked_tasks": "已分配的任务({{count}})","related_conversations": "相关协作者会话","send": "发送",