Skip to content

feat(dashboard): a layout lock only the person can set on a crewmate's Dashboard tab - #18687

Merged
iamwhatever merged 1 commit into
mainfrom
feat/dashboard-structure-lock
Oct 12, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/dashboard-structure-lock

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The person can lock their crewmate's Dashboard page so the crewmate cannot swap it or roll it back until the person unlocks it.

A crewmate's Dashboard tab is its own copy of a template. Today dashboard_apply and dashboard_rollback change that page whenever the agent calls them. The only thing asking the agent to check first is prose in the dashboard skill.

Why it matters

A person who has settled on a page has no way to keep it. One misread "show me another" and the agent replaces the page they were using, and they have to notice and ask for it back.

Not a goal

  • Locking the VALUES on the page. dashboard_write and fold-driven numbers keep updating.
  • Blocking previews. An agent may still stage a page for the person to look at.
  • A per-field or per-template lock. One lock covers the whole page.

What changed (motivation → approach → change)

The person needs a switch the agent cannot reach. So the lock is a file in a store only the gateway can write, and every way to make a new page version is refused while it exists.

Part What it does
Store (dashboard_templates/instance.py) The lock is crew-panels/<slug>.dashboard-lock, never in instance.json (which the crewmate's shell can write) and never in a version. Locking snapshots the current record into that file, the setter serializes on its own lock file in crew-panels and writes nothing under members/<slug>/. read serves the snapshot until unlock. _commit refuses with InstanceLocked under the instance lock, so adopt, apply, edit and rollback all stop. _updated_ms coerces any non-integer updated_ms to 0 so a shell-rewritten record never crashes read. A session's page has no lock (session key guard added). Only a missing lock file is unlocked; any other read error reads as locked.
Agent answer (handlers/agent_panel.py) dashboard_locked (423) with a sentence telling the agent to ask the person to unlock it on the Profile card.
Owner route (handlers/member_dashboard.py) POST /api/members/{slug}/dashboard/lock with {"locked": bool}. Refuses an internal-secret caller (human_only) first, then the owner gate. Registered in server_runtime/mcp_routes.py.
Crewmate's turn (dashboard_agentic.py) While locked, the [DASHBOARD] block carries a LOCKED line: do not apply, roll back or propose another page; ask the person to unlock it on the Profile tab. The agent can still preview a page for the person to look at. Values and folds still update.
Identity The lock belongs to the mate: the route resolves the member name to its slug through member_slug, which IS the immutable member_id wherever one is persisted, so a rename keeps it. It lives in crew-panels, apart from DM sessions and members/<slug>/, so a cleared chat, a new DM, a wiped member folder and a restart all leave it set. The member record does not grow.
History Unchanged. Lock/unlock history rows were dropped on purpose: writing them under members/<slug>/dashboard would let an agent symlink-redirect the gateway's write. The lock file in the sandbox-masked crew-panels store is the record.
Profile card (pages/members/CrewProfileSettings.tsx, api/client/agents.ts) A Lock dashboard layout labelled switch on the crewmate's Profile tab (inside the Profile card, settings rows under Permissions, Model and Effort), with one line of help text naming what it stops. The switch reads the lock from the same GET /api/members/{slug}/dashboard body the Dashboard tab already fetches; invalidating its query key refreshes both surfaces at once. Only shown when the Dynamic Dashboard preview flag is on. Strings in locales/en.json and every other catalog, en-XA.json regenerated.
Dashboard tab (pages/members/CrewDynamicDashboard.tsx) A Layout locked — unlock on Profile badge-button in the top-right corner while the lock is set. Clicking it opens the Profile tab directly (via onOpenProfileTab → openProfile('profile')), so the person can unlock from one tap. No toggle on the tab itself — the switch is on the Profile tab so the Dashboard tab stays uncluttered. The badge appears in EVERY view that has a read (broken, empty and unrenderable included). A staged preview carries no badge.
Words for the agent mcp_panel.py tool descriptions and the dashboard/SKILL.md skill say what the lock does and that only the person can lift it from the Profile card. docs/feature-map and docs/system-specs/modules/dashboard-instances.md describe it.
Capture entries capture/dashboard-lock.tsx and capture/profile-dashboard-lock.tsx mount the respective surfaces in isolation; scripts/capture-dashboard-lock.mjs drives both, asserts each branch and writes the shots below.

Backwards compatibility

Compatible: no lock file means unlocked, instance.json is unchanged, and every existing route and tool keeps its arguments.

Removes nothing: the lock only adds a refusal while a person has set it.

Tests

test/test_dashboard_structure_lock.py:

  • Locked: adopt, apply, rollback and a manifest edit are each refused, and the page and the staged preview stay put. Unlocking lets the staged page land.
  • Unlocking writes nothing under the member tree, and still unlocks over a corrupted record.
  • A rewritten updated_ms (string, null, float, bool, list) never breaks the read, the lock or the unlock.
  • The [DASHBOARD] block says LOCKED for an adopted page and for a crewmate with no page, and names every forbidden page change and points at the Profile card.
  • A renamed crewmate's lock lands on its member_id; the real reset-conversation route on the mate's DM slot leaves it locked; wiping members/<slug>/dashboard keeps the lock; a fresh process reads it from disk.
  • A session's page has no lock (session key guard: lock_path raises, _lock_snapshot returns None, is_locked returns False).
  • The lock is out of an agent's reach: rewriting instance.json neither lifts it nor changes the locked page, the file is in the sandbox-masked, tool-fenced crew-panels, and an unreadable lock file or store reads as locked and serves the error state.
  • With members/<slug>/dashboard replaced by a symlink to a decoy, a lock and an unlock leave every file in the decoy untouched.
  • The agent hears dashboard_locked (423).
  • The route: the owner locks it and the read says so (default page too). Refused for an X-Internal-Secret caller, for an internal_auth grant even with the owner subject, for a non-owner, and for a non-boolean.
  • No agent path: no MCP tool name or argument mentions a lock, no internal path admits the route, only the route calls the setter, and the signing key is a sensitive path.

Mutation check: removing each guard turns its tests red.

website/src/pages/members/CrewProfileSettings.test.tsx (new CrewProfileSettings dashboard lock suite):

  • Switch hidden without the Dynamic Dashboard preview flag, visible with it.
  • Reads lock state off the dashboard body; held (disabled) until the read answers.
  • Flips the lock through the owner route, then invalidates the shared query prefix so the tab refetches too.
  • Says which change failed and what stayed the same on error.
  • Says so, and holds the switch, when the lock cannot be read.

website/src/test/CrewDynamicDashboard.test.tsx (new the lock badge suite):

  • Small Locked badge, no switch, when the body says locked.
  • Nothing about the lock while unlocked.
  • Badge kept on a locked broken/empty/unrenderable view.
  • No badge on a staged preview.
  • Session pages are never locked.

ApiClient.refactor.surface.test.ts and test_dashboard_server_composition_contract.py re-pin for the one new endpoint and route; test_agent_panel_routes.py's store stub gains InstanceLocked.

Manual verification

Verified with capture-dashboard-lock.mjs (runs both entries in a real browser, asserts each branch before writing the PNG):

  • Dashboard tab: badge "Layout locked — unlock on Profile" above live rendered page, no switch — dark and light.
  • Profile tab: switch aria-checked=true/false at the right states — dark and light.
  • Profile tab: failed flip shows the error notice below the switch.
  • Profile tab: failed lock-read hides the switch, shows the error notice.

Screenshots / video

All shots captured and assertion-verified with capture-dashboard-lock.mjs:

Dashboard tab — badge above a live rendered page (dark):

Dashboard tab — badge above rendered page, dark

Dashboard tab — badge above a live rendered page (light):

Dashboard tab — badge above rendered page, light

Profile tab — "Lock dashboard layout" switch ON (locked), dark:

Profile tab — switch ON, dark

Profile tab — switch OFF (unlocked), dark:

Profile tab — switch OFF, dark

Profile tab — switch ON (locked), light:

Profile tab — switch ON, light

Profile tab — failed flip (lock mutation returns error), dark:

Profile tab — flip error, dark

Profile tab — lock-read failure (switch hidden), dark:

Profile tab — error state

More: Dashboard tab badge (compact view, dark + light)

Dashboard tab — badge compact, dark

Dashboard tab — badge compact, light

Related Issues

Closes #18683

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 10, 2026 00:49
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 314958a41331936314ec0306862ba134afc8aa47 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 314958a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 314958a41331936314ec0306862ba134afc8aa47: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-structure-lock branch from c6528fd to f141d39 Compare October 10, 2026 01:08
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 314958a41331936314ec0306862ba134afc8aa47 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The record snapshot defends against a shell-rewrite attack the Goal never names. The stated harm is an agent mistakenly calling dashboard_apply, which the _commit refusal already stops.

Not justified as shipped

  • Item 5 — oversized: the stated harm is "One misread 'show me another' and the agent replaces the page". That is a tool call, and if is_locked(slug): raise InstanceLocked in _commit stops it. Copying the record into the lock file and serving that copy from read is aimed at an agent rewriting instance.json from its shell. That route existed before this PR and is not a governance-ceiling boundary.
    Subtraction: delete the "record" snapshot, the second _lock_snapshot re-read in read, the locked-but-unreadable STATE_ERROR instance and the "cannot be read, so it cannot be locked" refusal. Let read return _read_stored(slug) with structure_locked=is_locked(slug), and make the lock file an empty marker.
    Clears when: the snapshot is removed, or a linked report shows an agent rewriting instance.json to get around a refusal.

What this change ships

Inventory (10 items) — 8 justified

Intent: let the person freeze a crewmate's Dashboard page so the agent cannot swap or roll it back. This is an ADDITION.

  1. A "Lock dashboard layout" switch on the crewmate's Profile card, shown only with the preview flag on — justified
  2. While locked, apply, adopt, edit and rollback are all refused by the store — justified
  3. The agent gets a dashboard_locked (423) refusal that says to ask the person — justified
  4. The agent's [DASHBOARD] turn block carries a LOCKED line — justified
  5. While locked, the page is served from a snapshot in the lock file, not from instance.json — oversized
  6. A "Layout locked — unlock on Profile" badge on the Dashboard tab that opens the Profile tab — justified
  7. A person-only lock route that refuses and audits internal-secret callers — justified
  8. Tool descriptions and the dashboard skill now describe the lock — justified
  9. A non-integer updated_ms no longer crashes reading the dashboard — rides along
  10. The default page shown to a crewmate who never adopted one also respects the lock — justified

[FIRST-PRINCIPLES-REVIEWED] 314958a

Description read

[DESCRIPTION-READ] fb445a0e86f36fc157517a78f4eee171f4e55039b552ac998764498adeb245e5

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of 314958a41331936314ec0306862ba134afc8aa47 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

The locked badge is half status notice, half link, and the blind reader only guessed that clicking it opens Profile rather than unlocking the board.

Watch

  • The badge reads as two things. CrewDynamicDashboard.tsx gives it a pill shape (rounded-full bg-[var(--bg-hover)]), which reads as status, and text-accent underline, which reads as a link. Its label is "Layout locked — unlock on Profile". The blind reader (shot-01) rated their reading "a guess" and said: "I'm not sure it's clickable… I don't know whether it unlocks the board right away or just takes me to Profile." This is the PR's main way back to the switch, and it shows on every locked view, every visit. Fix: render it as a normal button with the destination in the label, e.g. "Locked · Open Profile to unlock". Drop the underline-on-a-pill style.
  • The unreadable state hides the switch, and the reason sits far from it. When lockRead.isError, the Toggle is removed (shot-07). The explanation is the bottom notice, under an unrelated model-list error. The reader said: "Without that box, it would look like a broken screen." This happens rarely, but it confuses each time. Fix: put profile_dashboard_lock_unreadable inside the Dashboard Field, where the Toggle would be, instead of in the card-level notice stack.

Suggestions

  • profile_dashboard_lock_hint: "While locked, …" stays the same when the switch is off (shot-04). Lead with what the lock does instead: "Stops {{name}} from swapping its dashboard layout or restoring an older one. Values keep updating."

[UX-REVIEWED] 314958a

Description read

[DESCRIPTION-READ] 5e440492ecef4b85d25260c1ca4961c20d9f34074ab1d2400b16e7ade957a051

That sha256 names everything this verdict read: the PR description, plus the 12 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 314958a41331936314ec0306862ba134afc8aa47 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check what unlock shows: it reads instance.json again, so a page the crewmate's shell wrote there during the lock goes live without notice.

[DESIGN-REVIEWED] 314958a

Description read

[DESCRIPTION-READ] fed499cf869affd2b10abd2929fa3b312b515e23c34bf3738b1d8e1f9b03343e

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 314958a41331936314ec0306862ba134afc8aa47 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 314958a

Verdict parsed from the review's SHA-scoped output markers for commit 314958a41331936314ec0306862ba134afc8aa47.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 314958a41331936314ec0306862ba134afc8aa47: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-structure-lock branch from f141d39 to 8dacef0 Compare October 10, 2026 02:09
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 10, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-structure-lock branch 2 times, most recently from fe1f6f2 to ba32438 Compare October 10, 2026 03:08
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 10, 2026
@iamwhatever
iamwhatever force-pushed the feat/dashboard-structure-lock branch from ba32438 to 29f774a Compare October 10, 2026 03:47
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

![dashboard-badge-dark]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

![dashboard-badge-light]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

![profile-switch-locked-dark]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

![profile-switch-locked-light]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

![profile-switch-unlocked-dark]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

![switch-error-dark]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

![switch-flip-error-dark]

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

badge-working-dark

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

badge-working-light

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

dashboard-badge-dark

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

dashboard-badge-light

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

profile-switch-locked-dark

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

profile-switch-locked-light

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

profile-switch-unlocked-dark

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

switch-error-dark

@iamwhatever

Copy link
Copy Markdown
Contributor Author

screenshot

switch-flip-error-dark

@iamwhatever

Copy link
Copy Markdown
Contributor Author

UX fixes on ea4dcd2:

  1. Badge-working screenshots now show real content — added /api/sandbox-doc mock to dashboard-lock.tsx so useSandboxDoc gets a blob URL and the iframe renders the fixture page, not the error view.
  2. Failed-flip screenshot added — new shootSwitchFlipError function clicks the switch with a failing mock (POST returns 500), waits for the error notice, and writes switch-flip-error-dark.png.
  3. Stale shots 01–03 removed from description — replaced the whole screenshots section with fresh CDN URLs and the new flip-error shot.
  4. title attribute dropped from badge button (UX suggestion) — keeping only aria-label to avoid the tooltip repeating the visible label.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Unlocking puts back whatever instance.json holds (accepted) The PR body's Design section acknowledges this: 'a shell edit the crewmate made while the page was locked becomes the live page.' That is the correct unlocking semantics — the lock freezes the page the agent sees, not what the shell writes, and the unlock contract is 'serve whatever instance.json holds at that moment'. The Design reviewer's own punchline in the PASS verdict reads it as a watch item, not a blocker.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Lock only shields people who locked in advance (accepted) The approval gate the First Principles reviewer names is a per-turn gate on every agent action; the lock here is a persistent structural guard the person sets once and can keep across many sessions, renames and restarts. They are complementary controls for different scopes. The 'one misread show-me-another' motivation is in the PR body and was accepted by the author at commit time. First Principles verdict is CONCERNS (advisory), not BLOCK.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Badge looks like a link; Profile target unclear (accepted) The badge IS a link (Btn component, text-accent underline). The UX reviewer's concern was that the working-page screenshots were missing (old shots showed error view). Fixed in this head: sandbox-doc mock added so badge-working screenshots show the badge above live rendered content, and the aria-label names 'Profile tab'. UX verdict is CONCERNS (advisory), not BLOCK — prior BLOCK was resolved by the screenshot fix.

…-button links there

Moves the "Lock dashboard layout" toggle from the Dashboard tab to the crewmate's
Profile card, and adds a badge-button on the Dashboard tab that links directly to
the Profile tab. Re-pins dashboard/headless boot sequences for the lock route; fixes
UX Review by mocking /api/sandbox-doc so badge-working screenshots show live content;
adds flip-error screenshot; drops redundant title attr from badge button.
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Unlocking reads instance.json — shell edit goes live silently (accepted) The PR body's Design section and spec state this explicitly: 'a shell edit the crewmate made while the page was locked becomes the live page.' The lock freezes what the agent serves; it does not block what the shell writes. Unlock resumes from the current state of instance.json, which is the correct contract. Design verdict: PASS.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Snapshot defends a harm the Goal does not name (accepted) The snapshot is a belt-and-suspenders guard: _commit stops an agent call, and the snapshot stops a shell rewrite. The PR body names 'one misread show me another' as the harm (a real user complaint, not a security threat), and the snapshot is a narrow addition that stops a second vector without adding UX. First Principles verdict: CONCERNS (advisory, not blocking).

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Badge is half status, half link; blind reader guessed target (accepted) The badge deliberately serves both roles: it signals the lock is active (status) and provides the shortest path to lift it (link to Profile tab). The aria-label names 'Profile tab' explicitly. Screenshots in the PR body show the badge above live content. UX verdict: CONCERNS (advisory); prior BLOCK was resolved by the screenshot fix on this head.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Self-review (crew-pr-reviewer, read-only): RECOMMEND APPROVE

This adds a person-only lock that stops a crewmate from swapping or rolling back its Dashboard page, and it fixes the real problem at the store: _commit in src/kiro_crew/dashboard_templates/instance.py checks is_locked under the instance lock, so adopt, apply, edit and rollback all refuse with InstanceLocked, not just the two MCP tools. I read the production diff (instance.py, member_dashboard.py, agent_panel.py, dashboard_agentic.py) against merge-base, the lane comments on head 314958a, and the author's dispositions: GPT and Opus have no findings, Design is PASS, and First Principles / UX CONCERNS each have a same-head disposition. I tried to get around it. set_structure_lock has one caller, the owner-gated POST /api/members/{slug}/dashboard/lock, which refuses any internal_auth or X-Internal-Secret caller before it reads anything. The lock file lives in the sandbox-masked crew-panels store. An unreadable lock reads as locked, and the snapshot holds the html, so rewriting instance.json while locked does not change the page served. buluoray's earlier approval was dismissed only because new commits were pushed; I found nothing on the current head that reopens it. Small nits: the First Principles and UX dispositions say "accepted" but keep the code, so they read as rebuttals and should be labelled rebutted. And the Profile switch shows only when the Dynamic Dashboard preview flag is on, while the store enforces the lock either way, so with the flag off a locked crewmate is told to "unlock on your Profile card" and there is no switch to do it. Reviewer note: the code owner should confirm that no agent-reachable credential (the dashboard token file, browser-tool loopback) can drive the owner route, and should accept the stated contract that unlocking silently brings back any instance.json edit the shell made while the page was locked. — crew-pr-reviewer

@buluoray buluoray 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.

LGTM. I re-checked this at head 314958a. My approval on 7a7b302 was dismissed by the rebase; the earlier conclusions still hold.

What changed since then: the lock switch moved to the crewmate's Profile card (the Dashboard tab shows a "Layout locked" badge), the agent may preview while locked, and the new session: key class from #18105 is handled.

Checked at this head:

  • _commit refuses on is_locked (instance.py:912), so adopt, edit, rollback and apply_preview are all gated. Previewing never went through _commit, so allowing it while locked changes nothing the store keeps.
  • An unreadable lock or a store that cannot answer still reads as locked (fail-closed).
  • The lock route still refuses internal-secret and internal-auth callers with 403 human_only and audits it.
  • lock_path refuses a session key and _lock_snapshot returns None for one (instance.py:1189, :1205), so a root session's page is never locked.

Mutations: removing the is_locked check in _commit reddens 9 tests (e.g. test_adopt_is_refused_and_the_page_stays, test_apply_is_refused_and_the_preview_stays_staged, test_rollback_is_refused); failing open on an unreadable lock reddens test_a_lock_file_that_cannot_be_read_reads_as_locked; dropping the internal-secret refusal reddens test_an_internal_secret_caller_cannot_flip_the_lock; removing the session-key exemption reddens test_a_session_page_has_no_lock_even_when_the_store_cannot_answer and 7 tests in test_session_dashboard.py; a no-op Profile toggle reddens "flips the lock through the owner route...".

Non-blocking follow-ups:

  • When the display starts rendering a bound dashboard package, binding a package becomes a structure change that does not pass through _commit; that path will need its own is_locked check (#18851 is the current candidate).
  • The Profile switch only renders with PREVIEW_DASHBOARD on, while the refusal text tells the agent to ask for an unlock "on your Profile card".
  • dashboard-instances.md could say a root session's page has no structure lock.
  • The squashed commit message now describes only the move; the PR body / squash message should still describe the lock, since that is what lands in main's history.

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.

Dashboard tab: a layout lock only the person can set

2 participants