Skip to content

feat(shared-crew): guests get the owner's in-crew abilities and see attachment previews - #29609

Closed
bolichen97 wants to merge 1 commit into
mainfrom
feat/shared-crew-guest-parity
Closed

bolichen97 wants to merge 1 commit into
mainfrom
feat/shared-crew-guest-parity

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A Shared Crew guest can do everything the owner can inside the Crew, and the pictures a guest or a teammate attaches show up for them.

A guest is refused on ordinary crew work (mates, the agent picker, slot creation, approvals, artifacts, skills) because those routes check for the host owner. An attached image shows "Image failed to load" for a guest because the chip fetches the owner-only GET /api/file-raw.

Why it matters

Shared Crew exists so several people work in one Crew. A guest who cannot start a chat with a mate, approve a tool call or see an attachment is a spectator.

Not a goal

  • Changing who may invite, revoke or reach the Crew, or any network, config, credential or gateway-process setting.
  • Reading arbitrary host files for a guest.
  • Chat UI polish and the People and invite page.

What changed (motivation → approach → change)

Guests get the owner's abilities inside the Crew by default. What manages the share or the host's ceiling stays the owner's, as one pinned list, and a guest only ever sees a picture the Crew itself produced.

Piece What it does
Who counts as the owner is_owner_dashboard_request (dashboard/handlers/source_providers.py) is true for a guest's own session on any route outside the list. The strict is_host_owner_dashboard_request guards every credential-backed, disclosure and remote-crew site (handlers_instances*.py, handlers_cloud.py, remote_chat_guard.py, remote_dispatch_*), the apps proxy (apps/routes_proxy.py) and turn provenance (chat_send.py, chat_regenerate.py, chat_rewind.py, prompt_queue.py, responsive_chat.py), so a guest's turn is never owner-sent.
The owner-only list shared_crew/guest_scope.py: share and network, config.json and security policy, credentials and channels, gateway process and host-run code (including /api/app-tools and saving a workflow's definition from a run), host filesystem, billing and publish, and the installation-wide writes guests only read. The route checkpoint (slot_ownership.py) refuses a listed write, a write naming a host path (HOST_PATH_FIELDS), and guest text naming a local image outside the attachment stores; a guest path whose raw form carries an encoded separator (%2F, %5C) is owner-only, because the router matches the encoded path.
Pictures GET /api/file-raw (file_api/editor.py) serves a guest only a regular file directly in the upload directory or a session's .attachments store, opened once with no follow. chat_attachments.py names a copy <sha16>_<name> only when its bytes were read through a descriptor pinned to a file directly in the upload directory, or the gateway downloaded them (read_with_origin); any other copy keeps <sha16>-<name> and stays the owner's, so a host picture an assistant reply names is never a guest's. Image artifacts carry the same answer as crew_origin (image_artifacts.py, artifact_store/model.py, artifact_store/records.py, artifacts.py, artifacts_writes.py), and GET /api/artifacts/{slug}/asset 404s a guest for any other image. The guest prompt builder reads images the same way (acp/prompt_blocks.py, guest_prompt_origin.py).
Approvals and runs A guest approves or rejects each tool call but cannot turn on trust, trust-reads, YOLO, a task run's auto-approve, approval_mode=auto or an auto spawn (slot_approval.py, messaging_api/spawn.py, taskrunner.py), and cannot start or save a workflow. A plan a guest's request built carries Project.guest_origin (src/kiro_crew/task_models.py, persisted by src/kiro_crew/taskrunner_parts/run_registry.py), so every run of it (src/kiro_crew/taskrunner.py, src/kiro_crew/taskrunner_parts/run_lifecycle.py) and its to-chat turn read images as the guest's, whoever starts them.
Schedules A guest cannot edit, run, open in chat, delete, re-enable or acknowledge (an acknowledged item reaches every later run's prompt) an auto-approved, script or command schedule; each refusal is judged again on the record the store reloads under its lock, and a guest's run or open-in-chat uses a detached copy of the job it was judged on, so an owner switching the job to auto mid-request wins (src/kiro_crew/cron.py, cron_service/service/job_writes.py, cron_service/service/run_registry.py, cron_jobs.py, cron_runs.py, cron_shared.py, cron_board.py). A scheduled run never inherits a guest's prompt mark (cron_service/service/run_execution.py). A guest's schedule is stamped and paused on revoke, including one a request in flight at the revoke creates (routes_invites.py, routes_ssm.py), and its Slack result goes to the owner (gateway_runtime/cron_delivery.py, gateway_runtime/cron_failure.py).
WebSockets and logs Only the host owner joins the owner socket set (ws.py, websocket_hub.py, ws_event_scope.py); crew frames (ws_side_frames.py, card_lifecycle.py, chat_pins.py) reach owner and guest sockets. The gateway log stream is the host owner's on both paths, the subscribe_logs frame and GET /api/logs (updates_streams.py), and a guest's session export never carries the owner-only layer (session_export.py).
Dashboard GET /api/auth/me reports is_guest (api/client/sharedCrew.ts, hooks/sharedCrew/). Once the server says the tab is a guest's, its rail hides Apps, Customize, Webhooks, Settings and the terminal (shell/nav/, App.tsx, lib/ownerOnly.ts); a pending or failed identity read never hides the owner's entries, an owner-only page or 403 shows one "Owner only" state (OwnerOnlyGate.tsx, OwnerOnlyState.tsx, ErrorBoundary.tsx, i18n/locales/en.manual.json and the other locales), and the Schedule board locks an owner-only job's Run, Delete, checkbox, row menu and detail dialog (SchedulePage.tsx, CronRowActions.tsx, JobCreator.tsx, types/index.jobs.ts).

Judgement calls: the terminal, MCP config, hooks, installed apps, /api/browser, monitors and autonudge, starting or saving a workflow, the host file routes, memory administration and DELETE /api/sessions stay owner-only, because they run code or reach the host outside an agent's approvals. Agent specs, skills (installing and approving one included), steering, prompts, semantic memory, preferences, lessons and mate rules are open, matching "no limits inside the crew". The tradeoff: what a guest writes there reaches the owner's later sessions, auto-approved schedules included, and stays after a revoke, so revoking a guest does not undo it. The routes opened to guests are enumerated in test/data/shared_crew_guest_open_routes.txt; the owner-only list is documented in docs/system-specs/modules/shared-crew.md ("Guest scope"), with history.md and artifacts.md describing the two copy names and crew_origin.

What a guest cannot see: a picture the agent wrote (scratch, project folders, browser and computer-use screenshots) and every copy made before this change carry the - name, so a guest gets no preview of them and nothing leaks. Owner-only reads other than the log stream stay with their own handlers, as on main. A schedule the agent creates with cron_add at a guest's request carries no stamp, so a revoke does not pause it.

Backwards compatibility

Breaking: for a Shared Crew guest only, the writes main left open that act with the owner's credentials or reach the host or the installation now answer 403 owner_only (measured by driving every listed write through main's middleware as a guest; the full set is in shared-crew.md, "Central refusal"): channel messaging, uploads, pins and reactions, linking a session to Slack, deploys, session-storage cleanup, the native file picker and screenshot, the ffmpeg download, update arm/cancel and log level, the voice, STT, notification-channel and project settings, theme pack installs, the usage refresh, the mobile sign-in link, the portability preview and installed apps' own routes; theme create, edit and delete stay open, as on main; a guest is no longer served the gateway log stream, a session picture copied from anywhere but the upload directory, or an image artifact whose bytes did not come from it (main served every image artifact to a guest). The owner is unchanged. Writer sweep on origin/main @ 15e5c91: their dashboard callers are below; an app, cron, subagent, CLI or MCP call carries an app or internal claim, is not a guest session, and is not judged (test_everyone_who_is_not_a_guest_reaches_the_handler).

Reader: website/src/pages/chat/useChatPageResourcesController.tsx:takeScreenshot -- crew page -- a guest's Screenshot click shows the existing "Screenshot failed" notice with the refusal; test_publishing_installs_native_pickers_and_billing_are_closed_to_a_guest
Reader: website/src/api/client/files.ts:pickFiles -- crew page -- no UI caller; the composer's browser upload POST /api/upload/file stays open; test_the_composer_upload_stays_open_to_a_guest
Reader: website/src/components/LinkedSurfacesSection.tsx:connectSlack -- crew page -- a guest's Slack link is refused 403 owner_only; test_a_guest_reads_and_does_not_write_installation_wide_settings
Reader: website/src/pages/useChatPageSlotSwitches.ts:api.slackLink -- crew page -- the auto-link is best-effort and leaves the session unlinked on a refusal; test_a_guest_reads_and_does_not_write_installation_wide_settings
Reader: src/kiro_crew/shared_crew/guest_scope.py:attachment_read -- crew page -- a host-origin or pre-change - copy is refused to a guest and still read by the owner; test_shared_crew_guest_copied_images.py
Reader: src/kiro_crew/dashboard/handlers/artifacts_parts/library_reads.py:api_artifact_asset -- crew page -- a guest gets 404 for an image artifact without crew_origin (a mate's scratch screenshot included), the owner 200; test_shared_crew_guest_copied_images.py
Reader: website/src/hooks/websocket/connection.ts:subscribeLogs -- crew page -- the owner's Logs page still gets the replay and the live tail; a guest's socket gets neither; test_a_guest_socket_is_refused_the_gateway_log_stream
Reader: src/kiro_crew/dashboard/handlers/updates_streams.py:api_logs -- crew page -- no in-tree caller; the owner still streams it, a guest gets 403; test_a_guest_is_refused_the_gateway_log_stream_over_http
Reader: website/src/pages/settings/TailscaleInvites.tsx:RevokeControl -- crew page -- a revoke answered 503 schedules_not_paused (the share is already withdrawn) refreshes the invite and People lists and raises RevokeUnpausedNotice above the People list (PeoplePanel.tsx), which says to pause the schedules left on, links the Schedule page and stays until dismissed; TailscaleInvites.test.tsx 'raises the schedules-left-on notice above the list'
Reader: website/src/components/notifications/NotificationFeed.tsx:muteChannel -- crew page -- a guest is not asked to keep or mute a channel (the owner's installation-wide setting): the note shows with no prompt; NotificationFeed.phase3.test.tsx 'asks a Shared Crew guest nothing'
Reader: website/src/components/KiroAccountModal.tsx:refreshButton -- crew page -- a guest gets no Refresh (it asks with the owner's account); KiroAccountModal.test.tsx 'offers a Shared Crew guest no Refresh'
Reader: website/src/pages/settings/DisplayPanel.tsx:installTheme -- crew page -- with VoicePanel, SttSettings, NotificationsPanel, MobileLoginCard, AboutPanelUpdateFlow and SessionStorageScreen, reached only under Settings, which shows a guest Owner only (OwnerOnlyGate.test.tsx); the owner is unchanged
Reader: website/src/pages/LogsPage.tsx:logLevel -- crew page -- the Logs page's stream is refused to a guest as well (test_a_guest_is_refused_the_gateway_log_stream_over_http); the owner is unchanged
Reader: website/src/App.tsx:cancelUpdate -- crew page -- a guest's cancel is refused 403 owner_only; arming and applying an update were already the owner's

Tests

  • test_shared_crew_guest_parity.py pins the owner-only list, checks each entry still names a registered route, compares the live dashboard's guest-open routes with test/data/shared_crew_guest_open_routes.txt, and drives the predicate and the shared owner gate as a guest: schedules (create and revoke), skill trust, deploy and publish, the gateway log stream on both paths, and the attachment read's link, hard-link and UNC cases. test_shared_crew_guest_unattended.py covers every verb on an unattended schedule (including the owner switching it to auto mid-request), the late write after a revoke, task runs naming a spec file or workspace, task-plan rewrites, and encoded-separator paths.
  • test_shared_crew_guest_copied_images.py: an assistant row naming a host image, persisted through both transcript writers (with a variant and a second flush as a fixed point), is rewritten to <sha16>-<name> and refused to a guest while the owner reads it; an upload gets _ and the guest reads it, a scratch image gets -; a link inside or onto the upload directory gives the owner a - copy; origin survives a copy between sessions; a guest's text or schedule prompt naming a - copy is refused 403; image artifacts follow crew_origin, legacy records read as false. With the copier and reader changes reverted, both writer cases fail.
  • test_shared_crew_guest_host_paths.py walks every guest-open write handler for path-like fields; test_shared_crew_guest_prompt_images.py covers the guest prompt image reader.
  • Website: SchedulePage.guestOwnerOnly.test.tsx (row and detail-dialog locks including Resume, the owner case), OwnerOnlyGate.test.tsx, appRail.guest.test.tsx (a pending or failed identity read shows the owner's entries), CronRowActions.guest.test.tsx (Move to folder disabled on desktop and touch), JobCreator.test.tsx.
  • Determinism: the new Python module ran 31/31 four times (-n 4 twice, -n0, and -n0 in reversed order); the schedule vitest file ran three times with --sequence.shuffle, and its dialog test fails with the fix reverted.

Manual verification

Rendered the real Schedule page inside the real OwnerOnlyGate with a stubbed guest identity (GET /api/auth/me answering is_guest: true, every /api/** call stubbed at the network layer): the locked board, row menu and detail dialog, and the identity-error notice, in both themes. Not exercised against a live tailnet guest.

Screenshots / video

Two surfaces change. For the owner, a revoke that withdrew a share but could not pause every schedule of that person now says so above the People list, after the person's row is gone, until dismissed:

revoke-unpaused-notice-dark

revoke-unpaused-notice-light

The rest is for a Shared Crew guest. A first note from a new app channel: the owner is asked to keep or mute it; a guest, who cannot change that setting, sees the note with no prompt.

owner-notification-prompt-dark

guest-notification-feed-dark

guest-notification-feed-light

The Kiro Account panel: the owner has Refresh; a guest, whose refresh would ask with the owner's account, has none.

owner-kiro-account-dark

guest-kiro-account-dark

guest-kiro-account-light

The "Owner only" state on /settings, with no Customize or Settings in the rail:

owner-only-light

owner-only-dark

The owner's Schedule board names the guest who created a job, never the guest: stamp:

schedule-creator-light

schedule-creator-dark

A guest's board: the auto-approved and script jobs show "Owner only" with Run, Delete and the checkbox disabled; the attended job is untouched.

guest-schedule-board-light

guest-schedule-board-dark

A locked job's row menu: Run Now, Pause, View last result, Run at exact time and Move to folder are all disabled (a guest who paused it could not resume it).

guest-schedule-row-menu-light

guest-schedule-row-menu-dark

A locked job's detail dialog: an "Owner only" line, every field read-only and faded, and Pause, Run Now, Delete and Save disabled.

guest-schedule-detail-light

guest-schedule-detail-dark

The same job paused: Resume is disabled too.

guest-schedule-detail-paused-light

guest-schedule-detail-paused-dark

When GET /api/auth/me fails, the page says so in words with a Try again, and the board falls back to the owner's view (the server still refuses an owner-only action):

guest-schedule-identity-error-light

guest-schedule-identity-error-dark

Related Issues

Closes #29547

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 4, 2026 12:43
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

No blockers: every changed guest surface appears in a screenshot, and the blind reader read the owner-only page, the row locks and the access-check notice correctly.

Notes

  • sharedCrew.invite_err_schedules_not_paused: the blind reader asked who "their" is, because the person's row is already gone by the time the notice shows (shot-01). Put the revoked person's name in the notice: "Access for {{name}} is removed, but some of their schedules are still on…"
  • Locked row menu (CronRowActions): the reader couldn't tell why "View last result" is greyed out (shot-15). Viewing a result reads as harmless, so either leave it enabled or show the "Owner only" reason on that row itself, not only as a hover title.
  • "Owner only" is used in three places: the whole-page lock, the row tag and the dialog line. In the dialog (shots 17–18), "Owner only — you can view this" would tell a guest they can still look at the job.

[UX-REVIEWED] 6d45dfe

Description read

[DESCRIPTION-READ] 37bd55d20597537057804ad9ff40a2e469ad7c1c68e43eeb4ad184bb5b1670d1

That sha256 names everything this verdict read: the PR description, plus the 25 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 Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🔴 BLOCK

Premise-level review of 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 — 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 does not.

First-Principles-Verdict: BLOCK

The diff adds a fixed owner-only list that returns 403 to guests on writes that work for them on main, with no people_policy.json in place. The only accepted record on guest rights says that with no file, everyone keeps today's rights.

Notes

  • Item 8 — oversized: re-judging schedule refusals under the store lock, detached job copies, and the revoke-in-flight fence. The Goal is "can do everything the owner can"; this machinery guards a race between the owner and a guest. Subtraction: defer the TOCTOU re-judging (CronPendingMismatch path, pause_job_after_revoke) to a follow-up and keep only the up-front guest_unattended_refusal.

What this change ships

Inventory (10 items) — 7 justified

Intent: let a Shared Crew guest work fully inside the Crew and see attached pictures. Framed as an ADDITION.

  1. Guests are admitted to mates, the agent picker, slot creation, approvals, artifacts and skills — justified
  2. Guests now get 403 owner_only on channel messaging, uploads, deploys, voice/STT/theme/update writes and other writes that work on main — unjustified: no recorded decision
  3. A shared-crew.md sentence that recorded "no permission scoping" is rewritten to allow an owner-only list — undeclared
  4. Guests see image previews from the upload directory and _ copies — justified
  5. Copies get two names (_ vs -), and image artifacts carry a persisted crew_origin flag — justified
  6. Guests cannot turn on trust, YOLO, auto-approve or auto schedules — justified
  7. Schedules a guest created pause when that guest is revoked — justified
  8. Schedule refusals are judged again under the store lock — oversized
  9. Guests lose the gateway log stream and owner-socket frames — justified
  10. The guest rail hides Apps, Customize, Webhooks, Settings and the terminal, and owner-only pages show an "Owner only" state — justified

Blockers

product-shape change without accepted RFC: guests lose capabilities with no people_policy.json (item 2, plus item 3)
Trigger: the description says "Breaking: for a Shared Crew guest only, the writes main left open … now answer 403 owner_only". The diff also rewrites the pin "No permission scoping in this release: every collaborator a Crew admits has the same rights" to "No permission scoping in this release beyond the owner-only list". The base RFC rfc-per-person-execution.md (accepted) says: "With no file, every admitted person keeps the rights Shared Crew gives them today". Decision record 2026-11-01-shared-crews-give-each-person-one-role.md says the same. The description mentions neither.
Outcome: every existing guest loses working capabilities. That reverses a recorded maintainer decision, and nobody recorded a decision to reverse it.
Clears when: one of these is recorded. Option one: an RFC or superseding decision for a no-file owner-only guest list is merged non-draft on the base, then the author pushes or rebases. Option two: a maintainer posts /ai-review override first-principles 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 product-shape: <decision>. Option three: item 2's new refusals are removed.

[FIRST-PRINCIPLES-REVIEWED] 6d45dfe

Description read

[DESCRIPTION-READ] cf597e8e8f2fb0f28ec35e641ed61ff603e4696e4018fdbb4575f70ce324af66

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 Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. Guest-open routes are a pinned list (shared_crew_guest_open_routes.txt), so every new route needs an explicit owner-only or guest-open decision. The backwards-compatibility section is past the truncation cut, so the take-away check cannot be judged from the description.

Notes

  • The description accepts that guests can write agent specs, skills (including approving one), steering and mate rules, and that "what a guest writes there reaches the owner's later sessions, auto-approved schedules included, and stays after a revoke". That lets a guest get past the auto-approve refusals this PR adds, by going through the owner's standing grants. A follow-up should stamp those writes with the guest's origin, the way Project.guest_origin and crew_origin already do, rather than leave the gap open.
  • This one PR changes the owner predicate, image provenance, cron, the taskrunner, WebSockets and the dashboard. Splitting the predicate inversion plus its pinned list from the image-provenance work (crew_origin and the _/- copy names) would make each easier to revert on its own.

[DESIGN-REVIEWED] 6d45dfe

Description read

[DESCRIPTION-READ] 343e0d2f6e71397e32fc26d75ba762acce936e383798cbede025ed5df5e044bb

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.

@bolichen97
bolichen97 force-pushed the feat/shared-crew-guest-parity branch from 3fe0b89 to 6934374 Compare November 4, 2026 12:46
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6d45dfe

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6d45dfe

Verdict parsed from the review's SHA-scoped output markers for commit 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6d45dfe4fc69fc76b8929c2c76e8e2390f34db96 false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 force-pushed the feat/shared-crew-guest-parity branch from 6934374 to 723c6e0 Compare November 4, 2026 13:08
@bolichen97
bolichen97 enabled auto-merge (squash) November 4, 2026 13:13
@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 Nov 4, 2026
@bolichen97
bolichen97 force-pushed the feat/shared-crew-guest-parity branch from 723c6e0 to c458ad5 Compare November 4, 2026 22:42
@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 Nov 4, 2026
bolichen97 added a commit that referenced this pull request Nov 4, 2026
…abilities (#29609)

Both pull requests are open and not yet merged, and CI runs only for pull
requests into main, so this commit carries them unchanged as the base of the
SSM transport. Merge #29592 and #29609 first; a rebase then drops this commit.
@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 Nov 4, 2026
@bolichen97
bolichen97 force-pushed the feat/shared-crew-guest-parity branch from c458ad5 to 28e6ec0 Compare November 4, 2026 23:26
@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 Nov 4, 2026
@bolichen97
bolichen97 force-pushed the feat/shared-crew-guest-parity branch 3 times, most recently from 25859f9 to a329dc3 Compare November 5, 2026 00:43
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 5, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both items, and the log-stream note, are answered on 2964669:

  1. Guest writes main left open, not all named. This happens in several places, so I measured the whole set instead of patching the four you named. I drove every write that is owner-only at this head through main's real middleware chain as a Tailscale Serve guest, with the forwarding headers a real guest carries, and as the owner. 73 routes reach main's handler for a guest. Each one acts with the owner's credentials or reaches the host or the installation:

    • channel messages, uploads, pins and reactions sent with a channel token, and Slack linking
    • deploys
    • session-storage cleanup
    • the native file picker and screenshot
    • the ffmpeg download
    • update arm/cancel and log level
    • the voice, STT, notification-channel and project settings
    • theme pack installs
    • the usage refresh
    • the mobile sign-in link
    • the portability preview
    • installed apps' own routes

    They stay closed. The PR now says so in three places:

    • the module docstring;
    • shared-crew.md "Central refusal", which lists the routes;
    • the body's Breaking: line, with Reader: lines for each dashboard caller.

    Two callers sit on pages a guest reaches, and neither is offered to a guest now:

    • The notification prompt shows Keep without Mute (NotificationFeed.phase3.test.tsx).
    • The Kiro Account modal has no Refresh (KiroAccountModal.test.tsx).

    Every other caller sits under Settings (Owner only for a guest) or is an app, CLI or MCP call that is not a guest session. Theme create, edit and delete stay open, as on main.

  2. The revoke notice's hand-off decision: fixed in 8b0889a. It now carries the People panel's No hand-off reason.

Optional:

  • Log stream: it is now refused to a Shared Crew guest only (is_guest_session), on both GET /api/logs and the socket's subscribe_logs. Other dashboard users, such as a Slack link, read it as on main. Both tests gained a slack-link case, and those cases fail under the old predicate.
  • I have not renamed the billing test or changed the queue-drain test yet. The billing reads (GET /api/usage/series) are refused centrally by the follow-up that closes guest reads of owner-only routes, so the name will hold once that lands.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • A guest's withheld image loses its "[image not attached: …]" note span=23a67bcd5658

fixed in c49c015: attachment_read gains a head mode, which returns a store file's first bytes through the same pinned, no-follow read. When the guest arm does not attach a picture, the builder reads that head (guest_source(raw, SNIFF_BYTES, head=True)). If it is a whole raster sniff window, the turn gets the owner's note: IMAGE_SIZE_NOTE when the file is over the cap, and IMAGE_UNSUPPORTED_NOTE for an agent that takes no pictures.
A path outside the stores is still never looked at and gets no note. Tests: test_a_guest_store_picture_left_out_of_the_prompt_says_why (both notes, each failing without the fix) and test_a_guest_prompt_naming_a_host_picture_gets_no_note.
Class swept: every branch in the image loop that writes a note. The prompt-limit and duplicate branches run after the guest's read, so they were already reached. The size and unsupported branches were the two the guest arm skipped.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update. The item from my last review is fixed on this head, but the review found two bugs at the guest schedule acknowledge route and two failing frontend tests.

Earlier items:

  • Revoke answers 503 after the share is gone, and the page says "Try again": fixed. RevokeControl now treats schedules_not_paused as an outcome. It refetches the invite and People lists and shows RevokeUnpausedNotice above the lists, and a test in TailscaleInvites.test.tsx covers it.
  1. A guest's schedule acknowledgement can hide a host image in a dict key or a deep list (shared_crew/guest_scope.py:754).

    • Trigger: A guest sends POST /api/crons/{id}/ack on an attended job with {"summary":[{"/project/private.png":null}]}, or with the path nested 17 lists deep. This PR opens the route to guests for the first time.
    • Outcome: _strings_in walks only dict values and stops without an error at depth 16, so it collects no text and the checkpoint lets the write through. _ack_job_locked stores the list, slack/gateway_runtime/cron_turn.py:738 renders it as - {a} into the run prompt, and run_execution.py binds guest_prompt_origin to False. The owner's reader then attaches the host image to the model, and the guest can see the run's result.
    • Smallest fix: For a guest, accept only a string summary at the ack sink. Also make _strings_in collect dict keys and refuse a body that goes past the depth cap instead of skipping it. Add two tests (key position, 17-deep list) that expect 403 owner_only and fail when the fix is reverted.
  2. The store's summary[:500] cut can create an image path the checkpoint never saw (cron_service/service/job_writes.py:609).

    • Trigger: A guest acknowledges an attended job with a plain string: 479 padding characters, a space, then /project/private.png.txt, so .png ends at character 500.
    • Outcome: The checkpoint judges the full string, finds no image path in any reader view, and lets it through. The store keeps summary[:500], which ends in /project/private.png, and the next run reads that host image as in item 1. Requiring a string summary (item 1) does not close this.
    • Smallest fix: For a guest, at the ack sink, judge the value the prompt will actually read: run _local_image_outside_stores on "- " + summary[:500] off the event loop, and answer 403 owner_only when it names an image outside the stores. Add a truncation test.
  3. Frontend Tests (1) and (3) fail on this PR's new sharedCrew.identity_check_failed strings (website/src/i18n/locales/fr.json:23388, website/src/i18n/locales/hi.json:22852).

    • Trigger: Every CI run on this head. The [changed-values] cases in frStyle.test.ts and hiStyle.test.ts check values this PR adds.
    • Outcome: The fr value has a plain space before : where U+202F is required. The hi value uses the formal आप/आपकी where the catalog requires the तुम register. Both tests go red, and Frontend Coverage Merge follows.
    • Smallest fix: Use U+202F before the colon in fr ("accès : "). Rewrite the hi value in the तुम register (for example "तुम्हारी पहुंच ... जिनका तुम उपयोग नहीं कर सकते").

The Backend Tests (3.12, 3) and Coverage Gate reds come from a skill file this PR does not touch, and they are not yours. A rebase after main fixes that file clears them.

Optional:

  • Most of the schedule ring-fence (revoke pause, race re-checks, ack handling) exists only because guests can now write schedules. If guest schedule writes stayed owner-only in this PR and moved to their own PR, items 1 and 2 would go away with them.
  • /channels is reachable by a guest, but /api/channels is now owner-only, so a send or create on ChannelPage.tsx (lines 955 and 1106) fails with no Owner only state. Add /channels to OWNER_ONLY_PATHS or a Reader: line for it.
  • The store-side unattended re-check is tested only for approval_mode="auto". Parametrizing the two store tests over the script and command variants would pin the other branches.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Container acknowledgements bypass the guest image restriction span=41c61dec681b
    resolution: narrowed -- the one reader that stringifies or truncates guest input (a cron ack's summary, read into every later run's prompt by acked_items) now takes from a guest only a plain string the store keeps whole; the body scan was not widened

fixed in ebb68c6: api_cron_ack refuses a guest's summary with 400 invalid_summary unless it is a str of at most ACK_SUMMARY_MAX_CHARS. That constant is shared with the store's slice in job_writes.py, so the item a later run reads is exactly the string the write checkpoint judged.
This closes both branches the finding names, a list or object summary (keys, depth) and str() of a list. It also closes one it does not name: a 501-character summary whose [:500] cut turns ... /srv/private.pngx into a path the checkpoint never saw.
The dashboard's only caller (CronAckBar) sends a string of at most 200 characters, so guests see no change. Owner and app acks still accept a list, as before.
Test: test_a_guest_ack_summary_is_a_string_the_store_keeps_whole drives the real route as a guest with list → 400, object → 400, 501 chars → 400 and the truncation probe → 400, each with nothing stored, and a plain string → 200. Specs: learn-cron-dashboard.md (ack summary) and shared-crew.md (the ack row).
The retrospective (pr_findings --rounds exit 30, SEAM REPEAT on this span) also checked the other paths. No reader turns an object key or deeper nesting into prompt text, so _strings_in keeps its value-only, 16-level walk, and its docstring now says why. The queued, steered and live prompts are fenced at the reader by the guest mark.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles ebb68c6 product-shape: Maintainer decision. With no people_policy.json a Shared Crew guest gets the owner's in-Crew abilities, but writes that act with the owner's credentials or reach the host or installation (channel tokens, deploys, session storage, update, settings, installed apps) stay owner-only. This is the guest scope in shared-crew.md; roles stay as decided 2026-11-01.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: product-shape is not a release class. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Thanks for the update. All three items from my last review are fixed on this head, and the review found no code bug that blocks.

Earlier items:

  • Guest ack summary in a dict key or a deep list: fixed. api_cron_ack (dashboard/handlers/cron_runs.py:290) now takes from a guest only a plain string of at most ACK_SUMMARY_MAX_CHARS, and a parametrized route test covers list, object and over-long values.
  • The store's summary[:500] cut creating an unseen image path: fixed. The store slices with the same constant (cron_service/service/job_writes.py:615), so a guest's summary is stored whole, and the truncation probe is refused with 400.
  • fr and hi identity_check_failed strings: fixed. fr uses U+202F before the colon, and hi uses the तुम register.

PR Readiness is still red on this head. The First Principles lane says that with no people_policy.json, guests lose writes they have on main, and that this contradicts the 2026-11-01 roles decision. Your override comment was posted after that lane ran, so it takes effect only when the lane runs again. If the take-away is intended, a superseding entry under docs/decisions/ records it; otherwise moving the new owner-only take-aways to a follow-up clears the lane. The next review approves once readiness is green on the head.

Optional:

  • Security tradeoff to settle before merge: widening is_owner_dashboard_request (dashboard/handlers/source_providers.py:929) opens steering, skills (including install and pending approve), prompts, semantic memory, preferences, lessons and mate rules to a guest. Main refuses all of these. Their text reaches the owner's later sessions, auto-approved schedules included, and it stays after a revoke. That is the same reach this PR uses to refuse a guest's ack on an unattended job. Either add these writes to OWNER_ONLY_WRITE_PATTERNS, or record the tradeoff in the guest scope section of shared-crew.md. The docstring in prompts_caller_gates.py:48 also still says only the owner may change skills.
  • The WebSocket owner-set fence in dashboard/ws.py:774 is pinned only by source-text checks. If host_owner_request is rebound to owner_request, a guest socket joins the owner set and the new guest test modules still pass. A behavioural check in the existing real api_ws guest test (owner=False for a guest, no browser snapshot frame) would pin it.
  • The UX lane could not evaluate two guest views: the first-notification prompt without Mute (NotificationFeed.tsx:534) and the Kiro account modal without Refresh (KiroAccountModal.tsx:525). Light and dark screenshots of both would close that gap. For a guest, the prompt still asks "Keep receiving these?" but offers only Keep.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Thanks for the review. On the optional items:

  • In-Crew writes and revoke: recorded as the tradeoff in the description's judgement calls. Agent specs, skills (including installing and approving one), steering, prompts, semantic memory, preferences, lessons and mate rules stay open to a guest, matching "no limits inside the crew". What a guest writes there reaches the owner's later sessions, auto-approved schedules included, and stays after a revoke. The same sentence goes into shared-crew.md ("Guest scope") in the follow-up that closes guest reads of owner-only routes, which edits that section anyway, so this head isn't re-run for a doc line. The stale prompts_caller_gates.py docstring goes in the same follow-up.
  • The WebSocket owner-set fence pinned only by source text: noted. A behavioural check in the real api_ws guest test (a guest socket registers with owner=False) goes in that follow-up too.
  • The First Principles override: the lane is re-running after it.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 36b4029 product-shape: Maintainer decision. With no people_policy.json a Shared Crew guest gets the owner's in-Crew abilities, but writes that act with the owner's credentials or reach the host or installation (channel tokens, deploys, session storage, update, settings, installed apps) stay owner-only. This is the guest scope in shared-crew.md; roles stay as decided 2026-11-01.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: product-shape is not a release class. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles b1cd501 product-shape: Maintainer decision. With no people_policy.json a Shared Crew guest gets the owner's in-Crew abilities, but writes that act with the owner's credentials or reach the host or installation (channel tokens, deploys, session storage, update, settings, installed apps) stay owner-only. This is the guest scope in shared-crew.md; roles stay as decided 2026-11-01.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Task-plan rendering bypasses the guest image restriction span=41c61dec681b
    resolution: approach changed -- fenced at the reader by provenance, as the finding suggests; the body scan is not widened again

fixed in b1cd501: a task plan built by a guest's request now carries Project.guest_origin. It is read once, when the Project is made, from the turn's guest mark, and persisted with the run (run_registry). Every run of such a plan binds guest_prompt_origin.binding(run.guest_origin), whoever starts it and including after a reload: Execute and Retry (taskrunner.py), the start path (run_lifecycle.py), and the chat turn either to-chat branch opens (_plan_chat_task). The plan's text, stringified (original_input) or cut ([:200], [:2000], [:3000]), therefore reaches the image reader only through the attachment stores, so neither an object key nor a .pngx cut can name a host image.
Tests in test_taskrunner_guest_origin.py: the mark is taken at construction, it survives a restart, an owner-started run of a guest plan reads as the guest's (fails without the binding), and to-chat binds it. Spec: taskrunner.md ("Who wrote a plan") and shared-crew.md.
Cron runs need no mark. They read a job's message and acknowledged items whole, without stringifying or cutting them (cron_turn.py), and a guest's acknowledgement is a whole string (round 8).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: product-shape is not a release class. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

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

Thanks for the guest_origin mark: Execute, Retry, start, restart and to-chat now refuse guest text, and GPT passes. One reader is still unmarked, and we reproduced it on this head:

  • GET plan-context (src/kiro_crew/dashboard/handlers/taskrunner.py:901-911) returns the plan text without checking guest_origin.
  • The plan "Chat" button (website/src/pages/ProjectsPage.tsx:757-762) then auto-sends that text as an owner turn, with no prompt.
  • Dict keys still pass the guest write check (src/kiro_crew/shared_crew/guest_scope.py:756-772). So a host image path hidden in a key reaches that owner turn, and ACP reads it as an image.
  • docs/system-specs/modules/shared-crew.md:1599 says guest text cannot point at host images, which is not true yet.

Either fix works: (a) carry guest_origin through plan-context too, or (b) make _strings_in scan string dict keys and correct its docstring. (b) also closes other str(body.get(...)) readers, such as the knowledge agent-document route. Please add a route-level test either way. This crosses the guest/owner boundary, so it needs a fix rather than an override.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 82aee95 product-shape: Maintainer decision. With no people_policy.json a Shared Crew guest gets the owner's in-Crew abilities, but writes that act with the owner's credentials or reach the host or installation (channel tokens, deploys, session storage, update, settings, installed apps) stay owner-only. This is the guest scope in shared-crew.md; roles stay as decided 2026-11-01.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: product-shape is not a release class. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

@bolichen97

bolichen97 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author
  • A guest can freeze the event loop with one large write span=e5da2f483028

fixed in 82aee95: the guest-write text check now runs in a worker thread, never on the event loop (_values_name_outside_image runs under asyncio.to_thread). The JSON and form values are collected on the loop, and the whole walk, normalization and path scan happen in the thread.
Two bounds keep one request's cost small. First, a linear, C-speed prefilter (_may_name_an_image) skips any string that cannot spell an image suffix or ![ in any reader view; it uses the same folds, so it is never narrower than the views. Second, a write carrying more than _IMAGE_SCAN_BUDGET_CHARS (256 KiB) of text that can is refused rather than scanned. Measured at the scan's worst case, that budget is about three seconds of a worker.
Tests:

  • test_a_guest_body_is_judged_off_the_event_loop: the scan runs off the main thread.
  • The over-budget refusal.
  • A 400 KB " / / /" body with no suffix is admitted without a scan.
  • The prefilter keeps zero-width, fullwidth-dot, upper-case and ![ spellings.
    Spec: shared-crew.md.

@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 327bba3 product-shape: Maintainer decision. With no people_policy.json a Shared Crew guest gets the owner's in-Crew abilities, but writes that act with the owner's credentials or reach the host or installation (channel tokens, deploys, session storage, update, settings, installed apps) stay owner-only. This is the guest scope in shared-crew.md; roles stay as decided 2026-11-01.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

AI-review override not recorded: product-shape is not a release class. Use /ai-review override <fable|gpt|design|ux|first-principles|scope|all> <current-sha> <class>[ #N]: <reason, 20 to 500 characters>, where <class> is one of false-positive, not-applicable, pre-existing, evidence-supplied, infra-failure, reissue, deferred, owner-decision. What each class needs: docs/ci/ci-and-reviews.md#risk-release-records.

…ttachment previews

A Shared Crew guest was refused on ordinary crew work (mates, the agent
picker, slot creation, approvals, artifacts, skills) because those routes
checked for the host owner, and an attached picture failed to load for a
guest because the chip fetched the owner-only /api/file-raw.

Guests now pass the owner gate on every route outside one pinned
owner-only list in shared_crew/guest_scope.py: the share and network,
config.json and security policy, credentials and channels, the gateway
process and host-run code, the host filesystem, billing and publishing.
Credential-backed, disclosure and remote-crew sites ask the strict
is_host_owner_dashboard_request. A central checkpoint refuses a guest
write to a listed route, a guest write naming a host path, and guest
text naming a local image outside the attachment stores.

A guest reads a picture only when the Crew produced it: a session copy
or an image artifact is marked Crew-origin when its bytes were read
through a descriptor pinned inside the scratch tree or the upload
directory, and a host picture an assistant reply names stays the
owner's. Unattended approval, schedules a guest creates, revoke, the
owner and collaborator socket sets and the dashboard's guest view
(Owner-only state, locked schedule controls) follow the same split.
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • The first-notification prompt asks a yes/no question but a guest only gets "Keep" span=a657c4fdb931

fixed in 6d45dfe: a Shared Crew guest is not asked at all, because keeping or muting a channel is the host owner's installation-wide setting. The guest's feed shows the note with no prompt (NotificationFeed.tsx, promptTsSet is empty for a guest). NotificationFeed.phase3.test.tsx 'asks a Shared Crew guest nothing' checks there is no prompt, no Keep and no Mute.
The evidence gaps are closed with new screenshots in the description:

  • the owner's prompt beside the guest's prompt-free feed (dark and light);
  • the owner's Kiro Account panel with Refresh beside the guest's without it (dark and light).

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Guests reach the owner's remote-dispatch work items and UI-prefs backup span=fed63f7f7e32

fixed in 6d45dfe. The owner-only list now names /api/ui-prefs (the owner's prefs backup, which names host paths), /api/chat/headroom and /api/chat/slots/{slot}/work-item on every method. A guest's POST /api/chat/slots that carries a work_item is refused in work_item_for_create, because the create route stays open. Main refused all four to a guest, so nothing is taken away from main. The browser's prefs sync already treats a refusal as non-owner, so it stays quiet.
Tests:

  • test_the_owner_s_dashboard_prefs_and_remote_dispatch_are_closed_to_a_guest
  • test_a_guest_slot_create_cannot_bind_a_hub_work_item
  • the open-route allow list drops the four routes.
    The other require_owner_dashboard_request callers on guest-open routes are the in-Crew surfaces the PR opens on purpose: mates, the agent picker, slot creation, approvals, artifacts and skills. Remote-crew and credential sites already use is_host_owner_dashboard_request.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Closing by owner decision.

The current trust model for a shared Crew is that every admitted person has the same rights as the owner. That is recorded in docs/decisions/2026-11-01-shared-crews-give-each-person-one-role.md: with no people_policy.json, everyone admitted keeps equal rights. This PR narrows what guests can do while roles are off, so it contradicts that decision, which is also why the First Principles lane blocked it.

Per-person limits belong to the roles work: they apply only once the operator turns roles on. The branch is kept, so parts of this change can be reused there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared Crew: guests get the owner's in-crew abilities; attachment preview works for guests

4 participants