Skip to content

feat(slack): one renderer for both ingress kinds, images flow both ways - #10369

Open
NicholasRBowers wants to merge 1 commit into
mainfrom
feat/slack-one-renderer-images
Open

NicholasRBowers wants to merge 1 commit into
mainfrom
feat/slack-one-renderer-images

Conversation

@NicholasRBowers

@NicholasRBowers NicholasRBowers commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A session linked to Slack is served by one Slack renderer from both ingress kinds, so a picture pasted in the dashboard reaches the thread and a picture posted in the thread renders in the dashboard.

A session linked to Slack has more than one Slack output path, and the dashboard-side one cannot carry a picture. A Slack-born turn is served by SlackRenderer (streaming, task cards, OPTIONS control, image uploads). A dashboard-born turn on the same linked session is served by a hand-rolled text-only subset inside the dashboard turn loop: it posts a 💬 echo, opens a stream for tool cards, and posts the reply text at the end. A picture pasted into the dashboard therefore reaches the thread as a filesystem path. An agent-drawn chart does the same. The link-time history backfill is a third text-only writer with the same gap.

Inbound has the mirror image of the problem. A picture posted in the Slack thread is downloaded to a temp file, the bare temp path is appended to the prompt, and the file is deleted when the turn ends. The dashboard transcript then shows a dead path where the picture was.

Why it matters

The session address model (docs/request-for-change/rfc-session-address-model.md, §5.3 and §5.4) says the dashboard is the permanent host, a channel is an attachment, and ingress selects the delivery surface while the delivery surface selects the capability set. The conclusion this change draws from that is one output path per surface: whichever side a turn arrived from, a reply bound for the Slack thread is shaped by the one Slack renderer. The duplicate Slack path is exactly where a "Slack-born" and a "dashboard-born" session are still two different kinds of session on the output side. Pictures are how people report UI bugs. Today a picture renders only on the surface it was sent from, in both directions.

Not a goal

Backwards compatibility

Reader: slack/transport_dispatch.py:dispatch -- chat -- a Slack-born turn still drives the same SlackRenderer and calls authorize_upload_root(cwd), release_held_word() and close() unchanged; the cwd root keeps its rule and only gains an identity fixed at approval (test_slack_renderer.py, test_turn_ceiling.py, test_close_guard_parity.py).
Reader: dashboard/chat_slack.py:drain_slack_backfill -- chat -- link-time history rows go through SlackRenderer.post_history_row instead of hand-formatted posts, same icons and limit (test_slack_one_renderer.py::TestPostHistoryRow).
Reader: slack/events.py:_route_message -- chat -- process_slack_files now returns IngestResult; temp paths are still unlinked on every discard path and promoted paths are excluded from them (test_slack_events_coverage.py, test_slack_files.py).
Reader: messaging/outbound_files.py:extract_local_refs -- chat -- the sibling renderers (discord, telegram, teams, webex, whatsapp) still pass a bare str root; it is approved on the spot, so their behaviour is unchanged (test_discord_outbound_files.py, test_teams_files.py, test_telegram_parity.py, test_webex_renderer.py, test_whatsapp_files.py).
Reader: dashboard/chat_runner.py:_run_chat -- chat -- gains the keyword-only _ingress (default dashboard); every existing caller is valid, and the hand-rolled Slack mirror it replaces had no reader outside the runner (test_chat_runner_composition_contract.py).
Breaking: slack/events.py:_route_message -- chat -- a picture posted in a Slack-native thread that is not temporary/incognito (durable flag or same-message ! token) now persists in <data_home>/uploads/ instead of being a temp file deleted at turn end -- a retention change, accepted: the dashboard already persists pasted pictures this way, and cleanup/retention for both is tracked in #10871.
Breaking: dashboard/chat_runner.py:_run_chat -- chat -- a dashboard-born turn on a linked session now reaches the thread in the Slack-born shape -- streamed text segments, the OPTIONS control on the timing footer, the thread status plus a lazily opened stream instead of a Thinking… placeholder -- a visible change, intended (see Three visible differences below).

What changed (motivation → approach → change)

One SlackRenderer serves a linked session from both ingress kinds, and pictures travel both ways between the dashboard transcript and the Slack thread.

Piece Where What it does
One renderer for dashboard-born turns dashboard/slack_mirror.open_slack_mirror, chat_runner._run_chat builds SlackRenderer and calls on_turn_start / on_text_chunk / on_thinking / on_tool_call / on_done at the event sites; the hand-rolled Slack calls are gone
Stream redaction StreamRedactor(redact_via_context) (_mirred, and _mirthinkred for the reasoning feed) the rolling-buffer contract a Slack-born turn already has, redacted through the platform-context shim the replaced reply leg used (render_for_slack's default), so a companion's extra credential patterns still apply on a composed host; the withheld tails flush before each tool card, before the seal, before the first answer text (the renderer posts the reasoning then), and at teardown. The renderer adds a DISPLAY-form holdback on every throttled flush (_split_trailing_display_run): a key the model splits with markup -- [AKIA](url) ending one chunk, the rest opening the next -- renders whole on Slack while the raw scan sees ) end the run, so the raw tail whose rendering is a credential-class run is held with the trailing word until the join is scanned as Slack shows it; image references are left to the ref hold
Task-card redaction SlackRenderer.on_tool_call via redact_for_target, then TOOL_CARD_LIMIT title and purpose are scanned in full, in the form Slack displays, so AKIA**IOSF**ODNN7EXAMPLE is caught before the emphasis is stripped, and only the redacted text is cut to 75 characters, so a cut can never expose a secret's prefix; one method covers the dashboard mirror and the native dispatch path, and the mirror hands the fields over untouched
Renderer construction decider=None, reactions_enabled=False, user_id=state.owner_id, uploads_allowed=not slot.is_restricted the dashboard owns approval (the prompt is posted once through post_linked_approval); a chat.startStream with no recipient would demote to chat.update
Teardown SlackRenderer.close() appends the text the stream still holds, completes the open card, stops the stream or seals / deletes the _Thinking…_ placeholder, clears the thread status, on every exit path; close(publish=False) does the closing without the publishing, for a turn the audience fence withholds
Audience fence _mirror_publishes() in chat_runner, cross_surface_withheld a turn a peer session steered, whose containment moved since, publishes nothing to the linked thread -- checked at every mirror leg (text, thinking, card, flush, seal) because the renderer streams live, and at teardown; the user's own echo is unaffected
Outbound pictures messaging/outbound_files.extract_local_refs (roots), outbound_files.ApprovedRoot / approve_root, SlackRenderer.authorize_upload_root(cwd) and its awaited twin authorize_upload_root_off_loop (the two production callers approve in a worker thread, since the approval resolves the cwd and pins uploads/) the session cwd and the dashboard uploads directory are the roots; a reference must sit under one and the descriptor-pinned read is bound to that root by the identity the root had when the turn approved it (within_root_is_canonical, never re-resolved at read time, so uploads/ swapped for a link after approval cannot move the boundary); the uploads root's refusal of a link at its name and its identity come from ONE pinned open (platform_compat.pin_directory + pinned_fs.fd_real_path), so there is no screen-then-resolve window, and an uploads/ that does not exist yet authorizes nothing until it does; denylist, symlink refusal, raster sniff, budgets and the restricted ceiling are unchanged
Echo and backfill echo_user_message, post_history_row, messaging/display_safety.mirror_echo_text, chat_slack.drain_slack_backfill the 💬 echo and the 🧑/🤖 rows go through render_for_slack, extraction first, redaction before the length cut
Inbound pictures messaging/attachments.ingest_attachments(persist_images=True), kiro_crew/uploads.create_upload_file, pinned_fs.create_and_open_dir_pinned a validated image is promoted into uploads/ with the dashboard's naming (<uuid hex>_<name>, sniffed extension, O_EXCL, 0o600), all-or-nothing, created relative to a pinned directory descriptor with O_NOFOLLOW where the platform can (POSIX), and on Windows written under a platform_compat.pin_directory handle held from before the open until after the last byte, so the directory cannot be swapped mid-write and a junction at uploads/ is refused at the pin
Row spelling uploads.markdown_image_dest ↔ outbound_files._finish_destination, test/fixtures/markdown_image_dest.json mirror of the composer's mdImageDest / mdImageDestToPath (website/src/utils/fileTokens.ts): forward slashes for a Windows path, a <…> wrap with % as %25 for a space or %; only the wrapped form is decoded, a bare photo%20copy.png keeps its name. Both producers and both inverses are pinned to ONE shared table, walked by the backend test and by website/src/test/fileTokens.test.ts, so an escaping change on either side fails that side's suite; the wrap now closes at the last > on the Python side too, so a < or > in a file name round-trips like it does in the composer
Slack opt-in slack/files.process_slack_files(persist_images=) (required, no default), slack/events._inbound_images_persist, _strip_leading_mention a message bound for a linked dashboard slot always promotes; a Slack-native turn keeps the temp file when the conversation is temporary/incognito or the message carries !incognito/!temporary -- read under the key the turn runs under, so a single-session DM (slack.dm_single_session, flat key slack:<channel>) honours an !incognito typed in an earlier message; the gate reads mention-stripped text so <@bot> !yolo is the bang command it is
Ingress tag _run_chat(_ingress=), slack/handler.maybe_route_linked_thread, chat_utils._dequeue_next_message, slot_queue_repository.queue_edit_by_id a Slack-routed turn is tagged slack and never echoed back with its files; a queue merge stops at an ingress change so a batch is one kind; an edit of a queued entry drops the tag with the other provenance flags, since the replacement words were typed in the dashboard and the thread has not seen them
Shared accessor kiro_crew/uploads.py, used by dashboard/handlers/files.py, messaging/attachments.py, slack/renderer.py one resolution of the uploads directory; the handler's _UPLOAD_DIR test override still wins first
Posture inventory security_posture.py the Slack history-row entry names SlackRenderer.post_history_row as the render path
flowchart LR
  subgraph Before
    D1[dashboard turn]:::ctx --> H1[hand-rolled Slack calls in chat_runner]:::removed --> T1[Slack thread]:::ctx
    S1[Slack turn]:::ctx --> R1[SlackRenderer]:::ctx --> T1
  end
  subgraph After
    D2[dashboard turn]:::ctx --> R2[SlackRenderer]:::changed --> T2[Slack thread]:::ctx
    S2[Slack turn]:::ctx --> R2
    U2[uploads/ dir]:::added --> R2
  end
  classDef added fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:2px
  classDef changed fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:2px
  classDef removed fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-dasharray:4 3
  classDef ctx fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E
  linkStyle 0,1 stroke:#DC2626,stroke-dasharray:4 3
  linkStyle 4,5,7 stroke:#16A34A,stroke-width:2px
Loading

🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged

Both ingress kinds now reach the thread through the one renderer, and the dashboard's uploads directory is a root it may read pictures from.

A linked session had two Slack output paths. A Slack-born turn went through SlackRenderer. A dashboard-born turn went through hand-rolled calls in chat_runner that could not carry a picture and posted only the text after the last tool. A picture pasted in the dashboard never reached the thread. A picture sent from Slack landed in a temp file the turn's cleanup deleted, so the transcript showed a dead path where the picture was.

The session address model (§5.3/§5.4) says the attachment decides where a reply is reachable and the ingress decides how it is shaped. So there is one renderer per surface, driven from both ingress kinds, and the dashboard's uploads directory is admitted as a second approved root: the file the transcript row names is the file Slack uploads.

The dashboard turn loop builds the renderer and drives it from the event sites the hand-rolled calls occupied. Text and tool-card fields are redacted for the form Slack will display before they leave. Outbound, a picture in the reply or the echo is extracted under one of the two roots and read through a descriptor pinned to that root, so a link planted in one tree that resolves into the other is refused. Inbound, a Slack picture bound for a linked slot is promoted into uploads/ through a pinned, no-follow, all-or-nothing write, and its transcript row is spelled the way the composer spells one, with the outbound extractor as the exact inverse, so the picture renders in the dashboard and travels back to Slack even from a data home whose path holds a space or a %. A message that arrived from Slack carries an ingress tag, so it is never echoed back into the thread it came from.

Three visible differences for a dashboard-born turn, all of them the Slack-born shape: every text segment streams into the thread, the OPTIONS control rides the turn's timing footer with its ts recorded for expiry, and the in-flight indicator is the thread status plus a lazily opened stream rather than a Thinking… placeholder message.

Scope, stated plainly. The legacy slack/handler.py handle_message path and the slack.messaging.use_transport flag are a separate migration and are not touched. Non-Slack channels (_deliver_cross_surface_reply, the Discord/Telegram/Teams legs) stay text-only. The dashboard is not itself a Renderer and there is no fan-out renderer; that is the RFC's Phase 3 surface model. Retention of a promoted image follows whatever the uploads directory already does; this adds no policy.

Tests

test/test_slack_one_renderer.py (new, 100 tests):

  • Multi-root extraction: a file under the uploads root is extracted, one under the cwd root is extracted, a file INSIDE an approved root that the denylist flags is refused by the denylist leg (the check is stubbed and its consult asserted, HOME untouched), a file outside both roots is refused, a symlink into the uploads root is refused, a linked directory cannot launder one root through another, a single string root still works, an empty root list refuses everything, a root replaced with a link AFTER approval cannot redefine the tree (and the contrast: a root approved after the swap does resolve to the swapped target, which is why the renderer approves at authorization), approve_root refuses what is not a tree and can refuse a link at the name.
  • Approval stays off the loop: the awaited twin runs _approved_roots in a worker thread with the same result, and both production callers (slack_mirror, slack/transport_dispatch) await it (source-pinned).
  • _approved_roots: the uploads dir rides beside a valid cwd with both identities fixed at approval; an invalid cwd authorizes nothing; a link at uploads/, or an uploads/ that does not exist yet, authorizes only the cwd.
  • create_upload_file is all-or-nothing: a short write is completed, a failed write leaves no partial file, a zero-progress write fails closed.
  • A dashboard turn under the steer audience fence publishes nothing to the linked thread (no stream opened, no text, no card, no footer) while its echo and status handling are unchanged; close(publish=False) stops an open stream without completing the card or flushing held text, and leaves a fallback placeholder exactly as shown.
  • A secret straddling the task card's 75-character cut is fully masked in the Slack card on the dashboard mirror leg, the mirror and native paths render an over-length credential-bearing title identically, and the mirror leg hands on_tool_call the raw fields (no slice, no scrub of its own).
  • create_upload_file on the Windows branch pins the directory across the write: the pin is taken before the by-name open and released after the last byte, a pin refusal (junction at uploads/) creates no file, and a failed write still releases the pin.
  • create_upload_file never follows a planted link: a symlinked uploads/ is refused with nothing written where it points, a missing directory is created and written through its pinned parent, a failed write unlinks through the descriptor, and without descriptor support a reparse point at uploads/ is still refused while a real directory works.
  • markdown_image_dest and the outbound scanner walk test/fixtures/markdown_image_dest.json (11 path ↔ destination ↔ decoded rows plus the legacy bare case): the producer spells each path as the table says and the scanner reads each destination back, //host/share staying a remote reference; the same table is walked by website/src/test/fileTokens.test.ts for mdImageDest / mdImageDestToPath, so the two grammars cannot drift silently. The inbound row uses the rule, and the ACP encoder's Windows grammar still finds the path inside the wrap.
  • The outbound extractor is the inverse (test_outbound_files.py): the producer's wrapped %25 form resolves to the real file in a kc%home data home, a bare photo%20copy.png stays verbatim, and a malformed %zz sequence inside the wrap is taken as written.
  • Queue merges never mix ingress kinds: Slack-routed and dashboard-typed entries drain as separate batches.
  • echo_user_message: shape, full-text redaction before the 500-char cut, a pasted picture is uploaded after the echo, extraction precedes the length cut, no roots means no bytes ship, a Slack refusal never raises.
  • post_history_row: role icons, a row's picture uploads after the text, credentials redacted, a failed post reports False.
  • Teardown and approval guard: close() appends the throttle buffer -- with the word a throttled flush held back in front of it, as a final flush -- and the withheld reference tail before stopping the stream, still closes the surface when that append fails, seals a no-stream placeholder with the text shown so far and deletes one that showed nothing, finishes an unfinished turn's surface, and touches nothing after on_done; no decider means no approval card.
  • A dashboard-ingress turn on a linked session, driven through the real _run_chat: echo, thread status, start_stream with the owner as recipient, task cards opened and completed, every text segment streamed, OPTIONS control recorded with a ts, status cleared; a credential split across two chunks never reaches the stream, a key split by link markup across two throttled flushes never renders whole (mirror leg and renderer-level, plus the boundary helper's own cases: emphasis, Slack link grammar, bounds, an image reference left whole), and a companion-only credential (known only to the context redactor) split across chunks is masked on the reply stream and in the posted reasoning; a synthetic turn is not echoed but still answered; a slash turn reaches Slack not at all; a Slack-born message is not echoed back and its picture is not re-uploaded; a dashboard-pasted picture travels with the echo; an agent-drawn chart travels with the reply; thinking follows slack.show_thinking; a paused mirror silences everything; a crash mid-tool still completes the card and stops the stream; the approval prompt is posted once through post_linked_approval and the renderer posts no card of its own; a markdown-split key in a tool title or purpose never reaches the card from the dashboard mirror or from the native dispatch path, and safe titles keep their 75-character bound.
  • Link containment runs on every platform: the leaf-symlink test carries the privilege probe (requires_symlinks); the linked-ancestor, swapped-root and linked-uploads/ tests build their links with make_dir_link (a junction on Windows) and never skip.
  • Source pins: the hand-rolled Slack calls are gone from chat_runner; the backfill no longer formats rows by hand.
  • Inbound: the image is promoted into uploads with the dashboard's naming and 0o600, the suffix follows the sniffed type, the row carries the markdown form, the prompt encoder finds the path inside the markdown, an opaque file keeps the temp behaviour, images stay temp without the flag, process_slack_files opts in.
  • Backfill: a history row with a picture seeds the picture.

Updated: test_queue_edit.py (an edited Slack-ingress entry loses the tag; an untagged one is unaffected), test_source_corpus.py (the blocking-on-loop corpus ceiling moves 907→909 for the two new async-bearing modules, uploads.py and dashboard/slack_mirror.py, the same way #16224 moved it for chat_turn/), test_chat_runner_composition_contract.py (the runner no longer binds PostedOptions; _run_chat gains _ingress), website/src/test/fileTokens.test.ts (walks the shared destination table), test_slack_events_coverage.py (a promoted image is a markdown row that survives the turn while an opaque temp file is still cleaned; a message bound for a linked slot always promotes, restricted or not, while a Slack-native thread with the durable flag or the same-message token keeps its images temporary, a single-session DM reads its flag under the flat slack:<channel> key the turn runs under (and the per-thread key alone would miss it), a bang command on a linked thread takes the native rule, a mentioned bang command is classified on the mention-stripped text the router reads, and the predicate fails closed; patched process_slack_files stubs return IngestResult), test_slack_files.py (flattened-view shim over IngestResult), test_dashboard_chat.py (the recovery-reply test reads every reply sink the renderer may use), test_slack_options_lifecycle.py (owner-resolution pin re-anchored on on_done), test_handler_link_intercept.py, test_slack_handler_coverage.py, test_slack_handler_more_coverage.py, test_conn_recovery.py (the ingress / _ingress keyword).

Gates run locally on this head (rebased onto main at f16fa23ec): the changed and adjacent backend test files by path with -n0 (test_slack_one_renderer.py, test_outbound_files.py, test_dashboard_chat.py, test_chat_runner_composition_contract.py, test_chat_runner_coverage.py, test_cross_surface_mirror.py, test_slack_events_coverage.py, test_slack_files.py, test_slack_handler*.py, test_slack_renderer.py, test_slack_options_lifecycle.py, test_session_control.py, test_messaging_attachments.py, test_markdown_link_parentheses.py, the sibling transports' outbound-file tests: 30 files, 5,176 passed, 0 failed on the tree rebased onto ecb30c2ad; after the final rebase onto f16fa23ec, whose seven new commits touch chat_runner.py and state.py among this PR's files, the nine files covering the renderer, the extractor and the dashboard turn loop were re-run, 1,940 passed); CI's isort --check-only, flake8 and mypy src/kiro_crew/ (2,081 files, clean); the baselined black gate; the comment-history, changelog, feature-map, brand, harness-parity, focus-cue, memory-store-seam, sync-io, agent-sdk-boundary, subprocess-encoding, loop-bound-locks, builtin-skill-scope, testpaths-coverage, cwd-relative-reads, decisions-history and docs-lint guards; website eslint on the changed test, typecheck, and vitest run src/test/fileTokens.test.ts (122 passed). Mutation checks: re-resolving the root at read time reddens the swapped-root test, and dropping the denylist consult reddens the denylist test.

Manual verification

The screenshot below was produced end to end from the inbound path: ingest_attachments(persist_images=True) was run against an isolated gateway home (its own KIROCREW_HOME) with a fake downloader supplying a real PNG, which landed at <home>/uploads/<uuid>_Screenshot_2026-09-12_at_09.38.44.png with 0o600; append_attachment_context produced the row …\n![image](<that path>); the row was imported into that gateway through POST /api/chat/slots/import. The dashboard frame renders that exact row with that file's real bytes. Slack itself cannot be screenshotted from this environment; the renderer tests above are the evidence for the Slack side, and I can attach a live Slack capture on review if asked.

Screenshots / video

Dashboard transcript rendering the Slack-origin image (dark):

Dashboard transcript: a user row from the Slack thread renders the posted picture inline, followed by the agent's reply

Light theme

Dashboard transcript, light theme, same row

The frame was captured with the repo's transcript capture shell (website/capture/chatpage-scroll-shell.html, the real ChatPage over a mocked API, the same harness the repo's other transcript screenshots use), with /api/file-raw serving the promoted file's bytes; the capture asserts the <img> decoded and that no raw ![image]( markdown is visible before it writes the frame. The isolated gateway itself was booted for the seed step, but a browser session against it could not be minted from this environment (kirocrew pod up cannot reach the systemd user bus here), so the render goes through the capture shell rather than that gateway's own port. There is no Slack screenshot: see Manual verification.

Related Issues

no linked issue: requested directly as a one-PR change against the merged session-address-model RFC (#4294).

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|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 (docs/system-specs/modules/slack-gateway.md: image flow, temp lifecycle, linked-thread sync, SlackRenderer roots)
  • No secrets, credentials, or internal references in the diff

@NicholasRBowers
NicholasRBowers requested review from a team and CrysisDeu September 12, 2026 12:36
@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

Intent: A session with a Slack attachment is served by ONE Slack renderer whichever surface a turn arrived from (RFC session-address-model §5.3/§5.4), and pictures flow both ways between the dashboard transcript and the linked thread: outbound through the renderer with the uploads directory as an approved root, inbound by promoting a Slack picture into that directory so the dashboard renders it after the turn.
Not a goal: Migrating the legacy slack/handler.py handle_message path or the slack.messaging.use_transport flag; giving non-Slack channels image delivery; making the dashboard a Renderer or adding a fan-out renderer (the RFC Phase 3 surface model); any retention policy for the uploads directory.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 12, 2026
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

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

Design-Verdict: CONCERNS

Slack pictures now persist in one flat uploads/ folder, and every Slack-linked session may upload from it. That carries one person's private image into another person's thread.

Watch

  • The "one principal" framing doesn't hold for Slack. The spec accepts the residual like this: "Within one data_home (one principal), uploads/ is one flat directory approved as an outbound root for every Slack-linked session." But a single gateway is reached by several people through Slack allow-lists. The chain:

    • Cause: _inbound_images_persist moves a picture person A posts in a DM out of the temp file that was deleted at turn end. It now lands in <data_home>/uploads/.
    • Mechanism: authorize_upload_root(cwd) now approves uploads/ alongside the cwd for every Slack-linked session. The uuid filename protects nothing, because the agent can list uploads/.
    • Consequence: in a channel shared with person B, an injected or simply mistaken ![x](/…/uploads/<uuid>_a.png) uploads A's picture into B's thread. Before this change, nothing of A's survived the turn for that to happen.

    Deferring this to Persist inbound images for the non-Slack channels; namespace the uploads directory per session #10871 item 2 means the PR ships the leak first and fixes it later. The cause is the boundary between the Slack people the allow-lists admit, so it is not speculative.

    Clears when: before merge, the outbound uploads root is limited to files this session promoted or pasted (for example, a per-session subdirectory or a set of paths recorded on the session), with a test where session B is refused session A's promoted image. Or a maintainer explicitly accepts the cross-human exposure in docs/decisions/.

Suggestions

  • Outbound upload from uploads/ is what carries pictures from the dashboard into the thread, and it is what opens the leak above. Inbound promotion and the renderer merge are separate pieces. Splitting outbound upload into its own commit would let reviewers judge it, and revert it, on its own.

[DESIGN-REVIEWED] 77e3529

Description read

[DESCRIPTION-READ] 25f843a6ee080e50b6ed83930ef1cf8da6a4a035d01ae16fe5e98dc29c1effd3

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 Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 77e35295412eda14473b941e99bb50f0692f6f32 — 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

Pictures in unlinked Slack threads now stay forever; the description says "the directory's own retention applies", but uploads/ has no retention.

Not justified as shipped

  • Item 5 — inherited: the defence is "the dashboard already persists pasted pictures this way". That is symmetry. A grep for retention/prune/sweep/cleanup on uploads under src/ finds no sweep for <data_home>/uploads/, so nothing ever deletes these files. Unlike the linked-slot case, no turn consumes a temp path after cleanup here.
    Subtraction: limit persist_images=True in _inbound_images_persist to the linked is not None branch. Native threads keep temp files until Persist inbound images for the non-Slack channels; namespace the uploads directory per session #10871 lands.
    Clears when: the native-thread branch is removed, or a retention mechanism for uploads/ exists on base.
  • Item 6 — undeclared: the Backwards compatibility section says Slack-born turns call "close() unchanged". But close() now flushes buffered text, completes cards, stops the stream and clears the thread status on every exit path.
  • Item 7 — undeclared: _approved_roots adds uploads/ as an upload root for Slack-born dispatch turns too. The description says only "the cwd root keeps its rule".

What this change ships

Inventory (10 items) — 7 justified

Intent: one Slack output path per linked session, so pictures travel between the dashboard and Slack in both directions. ADDITION, plus a removed duplicate.

  1. A dashboard-born turn reaches the thread in the streamed SlackRenderer shape, with OPTIONS on the timing footer — justified
  2. Pictures pasted in the dashboard, and charts the agent draws, upload to the linked thread — justified
  3. The link-time history backfill uploads row images — justified
  4. A picture posted in a linked thread shows in the dashboard transcript — justified
  5. Pictures in native Slack threads now persist in uploads/ with no cleanup — inherited
  6. A Slack-born turn's teardown now finishes its cards, stream and status on cancel — undeclared
  7. A Slack-born turn may upload files from uploads/ — undeclared
  8. Streamed text holds back a key split by markup until it is whole — justified
  9. Task-card titles are redacted before the 75-character cut — justified
  10. Queued Slack-routed and dashboard-typed messages no longer merge into one batch — justified

[FIRST-PRINCIPLES-REVIEWED] 77e3529

Description read

[DESCRIPTION-READ] 4b0660fc60d4f004a65f5faf12cac4d8a4877b0734329a620942ed3bbaedf396

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 Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 77e35295412eda14473b941e99bb50f0692f6f32 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 77e3529

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 77e35295412eda14473b941e99bb50f0692f6f32: <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 Sep 12, 2026
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 77e35295412eda14473b941e99bb50f0692f6f32 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 77e3529

Verdict parsed from the review's SHA-scoped output markers for commit 77e35295412eda14473b941e99bb50f0692f6f32.

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

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 12, 2026
@NicholasRBowers
NicholasRBowers force-pushed the feat/slack-one-renderer-images branch from e1f2dc2 to 1421de3 Compare September 14, 2026 21:15
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Sep 14, 2026
@NicholasRBowers
NicholasRBowers force-pushed the feat/slack-one-renderer-images branch from 1421de3 to 9b72459 Compare September 14, 2026 21:21
@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: create_upload_file writes all-or-nothing (short-write loop; partial destination unlinked on any failure)

  • Short writes persist corrupted images — fixed in 9b72459, span=f949bcd25db2

kiro_crew.uploads.create_upload_file now loops os.write over a memoryview until every byte is on disk, treats a zero-progress write as ENOSPC, and unlinks the partial destination on ANY exception before it propagates — so the promotion in messaging/attachments._promote_image can only delete its temp source after a complete copy exists.
Pinned by TestCreateUploadFileIsAllOrNothing (a short write is completed; a failed write leaves no partial file; a zero-progress write fails closed). This ruling covers every write-to-uploads path that goes through create_upload_file.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: a queue merge run stops at an ingress change, so a batch is one ingress kind

  • Mixed Slack/dashboard queue batches echo Slack text back — fixed in 9b72459, span=8023cfe9506b

chat_utils._dequeue_next_message no longer merges across an ingress boundary: a merge run stops when an entry's _ingress differs from the run's first entry, exactly as it already stops at a system injection or an attachment-bearing entry. Every batch is therefore one ingress kind, and the drain's all(... == SLACK_NAMESPACE) is exact rather than conservative — a batch of Slack-routed messages is never echoed into the thread it came from, and a batch of dashboard-typed ones always is.
Pinned by TestQueueMergeNeverMixesIngress. This ruling covers any finding that a merged batch could carry two ingress kinds.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Global upload root bypasses session privacy — rebutted (not a defect), span=e117f002a19e

upload_dir() is data_home()/uploads — one operator's own data home (or one pod's). Nothing in it belongs to another user, so no upload can cross a privacy boundary between people; the residual is one operator's own conversations, which the same operator already exposes to the same Slack channels through the cwd root (every file under the project directory) and through file_send. The uploads directory is admitted as a root DELIBERATELY: it is the directory the dashboard composer writes a pasted picture into and the transcript row points at, and the maintainer's specification for this change names it as the second approved root — without it a picture pasted in the dashboard can never reach the linked thread, which is the defect this PR exists to fix (see the PR intent comment).
The gates that make the root safe are unchanged and the finding does not dispute them: a reference must sit lexically under the root and the descriptor-pinned read is bound to that same root (outbound_files._inspect / hooks.safe_read_file_bytes_nolink); leaf symlinks, the denylist, raster sniffing and the byte and count budgets all apply; a temporary or incognito session has uploads_allowed=False and ships no bytes at all; a stored name carries a 128-bit uuid prefix, so "another session names its path" needs that path. The Opus lane examined the same root and recorded no finding; the workflow's own adjudicator FLAGGED this item rather than upholding it, for these same reasons.
Session-scoped upload subdirectories are a real design option (the Design lane's Suggestion) but a different change: the dashboard's storage layout and every transcript row that already pins a flat uploads/<file> path would move with it. That is deferred, not omitted. Findings that a shared owner-level root is itself the defect are covered by this ruling.

Maintainer: if this ruling should stand, the one-line exit the lane accepts is /ai-review override gpt 9b7245995a4f9d84360fd9465b95d08e07cb0549: the uploads dir is the operator's own per-data-home store, deliberately admitted as the second upload root so dashboard-pasted pictures reach the linked thread; per-session scoping is a separate storage-layout change. (replace the SHA with the current head if it moves).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • The uploads directory becomes a cross-conversation egress root — rebutted (by design), span=d5117bf58ae9

The pool is one operator's own data home (data_home()/uploads); it never crosses users, and the same operator's cwd root already exposes every project file to the same channels. It is admitted deliberately: it is where the dashboard composer writes a pasted picture and where the transcript row points, and the maintainer's specification names it as the second approved root — the picture cannot reach the linked thread any other way. Every read gate (lexical root match, descriptor pinned to that root, leaf-symlink refusal, denylist, raster sniff, budgets) applies; a restricted session ships no bytes. Same ruling as the GPT record for span=e117f002a19e.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • The owning spec now misdescribes the architecture — fixed in 9b72459, span=f079c05eb902

docs/system-specs/modules/slack-gateway.md is updated in this PR: the Linked Thread Sync section names maybe_route_linked_thread and the ingress tag for the Slack→dashboard leg and describes the dashboard→Slack leg as the one SlackRenderer built by open_slack_mirror and driven from _run_chat (with echo_user_message / post_history_row and the single pause gate); the Images section describes the promotion into the uploads directory, the ![image](…) row, the privacy gate that keeps a restricted thread's image temporary, and the temp lifecycle now scoped to opaque files and non-promoted images (persisted_paths excluded from temp_paths); the SlackRenderer bullet names both ingress kinds and the two upload roots.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

Agreed as the right direction, and a separate change: the dashboard composer writes the same flat uploads/<uuid>_<name> layout (dashboard/handlers/files.py) and every existing transcript row pins a flat path, so a namespace needs a read-side fallback or a migration across both writers, not a one-line change in this PR's promotion path alone. Tracked in #10871 (label deferred-finding, assignee, Due: 2026-10-15).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Item 10 — zero consumers: is_upload_path — fixed in 9b72459, span=e8915366781a

is_upload_path is deleted from src/kiro_crew/uploads.py; the module now exports only the accessor, the naming rule and the all-or-nothing writer, each of which has a non-test caller (dashboard/handlers/files.py, messaging/attachments.py, slack/renderer.py).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Delete is_upload_path — 0 consumers repo-wide — fixed in 9b72459, span=d7cf88f00b20

Deleted, as the Subtraction asks; it comes back with its first caller if one appears. Same change as the Not-justified item for span=e8915366781a.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

ingest_attachments(persist_images=...) is the shared seam and Slack is the only channel that opts in here, by the PR's stated scope: this change collapses the Slack output paths onto one renderer, and image delivery for the other channels is the RFC session-address-model Phase 3 surface work. Each channel's opt-in is a one-argument change behind the same privacy gate Slack uses and is tracked in #10871 (label deferred-finding, assignee, Due: 2026-10-15), which is the "deferral accepted as recorded" clearing condition the lane named.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Replace the inline f"{uuid.uuid4().hex}_{safe_name}" in files.py with _uploads.new_upload_path — fixed in 9b72459, span=76987ca8600d

The composer's destination is now upload_dir / _uploads.new_upload_path(fname).name: one naming rule (uuid prefix + safe_upload_name) for a composer upload and a channel-promoted image. Only the NAME is taken from the shared helper; the directory stays the handler's own accessor so its _UPLOAD_DIR test override keeps working (see the record for span=edc0fb318ee9).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Drop the handler's own _UPLOAD_DIR override in favour of the one in uploads.py — rebutted (disproportional), span=edc0fb318ee9

Keeping dashboard/handlers/files._UPLOAD_DIR working is an explicit requirement of this change (the maintainer's specification: "keep the _UPLOAD_DIR test override working"), and test/test_lazy_data_home_paths.py pins that accessor by name as a live-home-following factory. The handler's accessor already delegates to kiro_crew.uploads.upload_dir() when its own override is unset, so in production there is exactly one resolution path; the second knob exists only for the handler's own tests, which pin it directly. Removing it means rewriting those tests for no production change, which is outside this PR's purpose.

@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 Sep 15, 2026
@NicholasRBowers

NicholasRBowers commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Slack thread output not shown (span=ea8530a2fc3e) -- accepted-and-deferred: a live Slack capture on review if a maintainer asks; the Slack side is evidenced by recorded calls, not a screenshot.

No Slack workspace is reachable from the environment that produced the screenshots (stated under Manual verification), so the Slack-side evidence is the recording client in test/test_slack_one_renderer.py: for a dashboard-ingress turn driven through the real _run_chat, the tests assert the exact sequence of Slack calls -- the 💬 _…_ echo, set_thread_status, start_stream with the owner as recipient, append_task open/complete per tool, one append_stream per text segment, the OPTIONS footer with its recorded ts, upload_file for a pasted and an agent-drawn picture, status cleared (TestDashboardIngressDrivesTheRenderer, 100 tests in the file, 0 skipped on this host). The two screenshots show the only surface a browser can render here: the dashboard transcript with the Slack-origin picture decoded.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Slack pictures look like the user's own (span=d732cc3417ce) -- rebutted: they are the user's own.

A linked session is one person's session reached from two surfaces (RFC session-address-model §5.3: the dashboard is the permanent host, the channel an attachment). maybe_route_linked_thread denies every Slack message whose user_id fails is_allowed_user before it can reach the slot, so a row in a linked transcript was written by this gateway's own principal whichever surface they typed on. The TEXT of a Slack-born message already renders as a plain user bubble with no provenance mark; a picture following its text into the same bubble is the consistent rendering, and marking pictures alone as "from Slack" would say the opposite of what the text beside them says. A channel-origin badge for transcript rows is a transcript feature for text and pictures alike, outside this PR (which adds no transcript UI), and the row already carries the _ingress tag such a badge would read.

@NicholasRBowers

NicholasRBowers commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Drive status (edited in place; head 77e3529541)

  • Rebased onto main f16fa23ec (1,879 commits of drift, 8 conflicted files, all union resolutions). One commit, operator as author. MERGEABLE, auto-merge armed (squash).
  • Round on 72c26d327d found: Opus BLOCK (single-session DM !incognito not honoured by the image gate), PR Hygiene (no **Goal:** / ## Not a goal), Linux/Windows/macOS shards red on test_link_screen_hold_pin (my approve_root screened a name then resolved it) and test_source_corpus (two new async modules passed the 907 ceiling). All fixed in 30e6441cb5: the gate reads the privacy flag under the key the turn runs under (flat_dm_session_key); the uploads root's link refusal and identity come from one pinned open (pin_directory + fd_real_path); ceiling 907→909 the way refactor(dashboard): compose the chat turn runtime from chat_turn owners #16224 moved it; body carries the Goal line and Not a goal. Also folded in the deferred deletion of the dead persist_images default.
  • GPT's three blocking findings on 36f8f838 are fixed (root identity fixed at approval; denylist leg exercised with HOME untouched; planted-link test never skips). Design CONCERNS answered with one shared table (test/fixtures/markdown_image_dest.json) walked by both languages.
  • macOS (2) also failed test_hooks_coverage::test_an_admitted_hardlink_is_never_truncated -- hooks.py and that test are untouched by this PR and it passes on Linux; watching whether it recurs on this head before treating it as upstream.
  • On 30e6441cb5: Design PASS; Opus no blocking findings (its one advisory, an edited queued entry keeping its Slack ingress tag, was a real defect and is fixed in 14db01f9dc); UX CONCERNS; First Principles BLOCK on the Slack-native picture retention default.
  • On 14db01f9dc: Opus no findings. GPT 6.1 BLOCK, one finding, real: upload-root approval did filesystem work on the loop (my ApprovedRoot change) -- fixed in b75c70253e (approval awaited in a worker thread from both callers; tests pin it). Design CONCERNS (shared flat uploads/ root, the residual the author accepted in the spec, deferred to Persist inbound images for the non-Slack channels; namespace the uploads directory per session #10871 item 2; dispositioned). First Principles CONCERNS: items 1 and 5 dispositioned; item 4, the retention default, is the question the maintainer ruled on at 0591889e (span 05731bfce749), held for the author's decision -- nothing pushed on it. UX BLOCK ("cannot evaluate"): wants Slack-thread screenshots no environment this drive runs in can take -- (1) a dashboard-born turn's uploaded picture in the thread, (2) a finished dashboard-born turn with its OPTIONS footer plus one of the in-progress thread status, (3) a freshly linked thread's 🧑/🤖 backfill rows; those need the author's Slack, and the lane re-runs only on a push or a maintainer /ai-review override ux.
  • On b75c70253e: GPT 6.1 no blocking findings. Opus BLOCK, one finding, real: the streamed dashboard-born reply lost the platform-context redactor the replaced leg had -- fixed in 3069303a1f (StreamRedactor(redact_via_context) on the reply stream and a rolling one on the reasoning feed; two tests pin it). Design CONCERNS dispositioned. UX BLOCK and First Principles BLOCK are the author's items (unchanged).
  • On 3069303a1f: Opus, First Principles and Security Scope passed. GPT 6.1 BLOCK, one finding, real: a key split with link markup across two throttled appends renders whole on Slack while each append scans clean -- fixed in 77e3529541 with a display-form holdback at the renderer's flush (both ingress kinds; three tests pin it).
  • 77e3529541 (current head) carries main's new Issue Gate lane (ci: require every PR to reference a triaged issue #16241): every PR must declare a triaged issue (Closes #N / Part of #N on its own line, the issue carrying auto-fixable / needs-investigation / needs-human) or the maintainer's issue-gate: waived label. This PR declares none ("requested directly as a one-PR change") and Persist inbound images for the non-Slack channels; namespace the uploads directory per session #10871 has no verdict label -- an author decision, not made here. UX BLOCK (three Slack-thread screenshots) is likewise the author's.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: _inbound_images_persist derives the privacy key the way the turn does (flat_dm_session_key under _dm_single_session_enabled), from the channel the call site now passes

  • in a single-session DM marked !incognito, Slack images are still saved permanently to uploads/ (src/kiro_crew/slack/events.py:2272, span=99f18e4c27ba) -- fixed in 30e6441.

Holds: handle_message_transport records the mode under the flat key slack:<D-channel> while the gate read canonical_key(msg_ts), which is never flagged there, so a second message's picture was promoted from a conversation that persists nothing. The gate now takes channel and thread_ts from _route_message and, when _dm_single_session_enabled holds, reads the flag under canonical_key(flat_dm_session_key(...)) -- the same derivation the turn, !stop and message-deleted use, so the call sites cannot disagree. A group channel never collapses, feature-off keeps the per-thread key, and the linked-slot rule above it is unchanged.
Pinned: test_a_single_session_dm_reads_its_flag_under_the_flat_key (test_slack_events_coverage.py) -- flagged flat DM at root and in a thread refuses, a group channel and feature-off keep the per-thread answer, and the bare call without the channel shows why the call site must pass it; fails with the derivation removed.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: outbound_files.ApprovedRoot / approve_root: a root's identity is fixed when the turn approves it, and the descriptor read verifies against that identity with within_root_is_canonical

  • A replaced upload root exposes files outside approved trees (src/kiro_crew/messaging/outbound_files.py:570, span=bb007ff9b73e) -- fixed in 30e6441.

Holds: _matching_root admitted the name lexically and safe_read_file_bytes_nolink then realpath'd the root at read time, so uploads/ swapped for a link between approval and read redefined the tree and every raster under the target passed containment. The roots are now ApprovedRoot(spelled, canonical) built once by approve_root at authorize_upload_root time; the read passes canonical with within_root_is_canonical=True, the repo's existing contract for an admitted root (handlers/_shared.py, folder_steering.py), so nothing resolves the root again. For the uploads root the refusal of a link at its name and its identity come from ONE pinned open (platform_compat.pin_directory + pinned_fs.fd_real_path), the shape test_link_screen_hold_pin.py requires; a bare str root from the sibling transports is approved on the spot, so their behaviour is unchanged.
Pinned: test_a_root_replaced_after_approval_cannot_redefine_the_tree (reddens with the read re-resolving the root), its contrast test_a_root_approved_after_the_swap_resolves_to_the_swapped_target, test_approve_root_can_refuse_a_link_at_the_name, and TestApprovedRoots (a link at or a missing uploads/ authorizes only the cwd).

@NicholasRBowers

NicholasRBowers commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: the denylist leg is exercised under an approved root with the consult asserted, HOME untouched

  • The test moves a HOME-derived security anchor (test/test_slack_one_renderer.py:205, span=0a937971062d) -- fixed in 30e6441.

Holds: with HOME moved and the candidate outside both roots, containment refused first and the denylist leg was never the gate under test, so it could regress green. HOME is no longer touched: test_a_sensitive_path_is_refused_under_any_root puts the candidate INSIDE an approved root, so containment admits it and only the denylist can refuse; is_sensitive_path is stubbed to flag that one path, and the test asserts it was consulted with exactly that path and that the rejection carries the denylist detail (reading this location is blocked). Deleting the consult reddens it.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Item 10 — one consumer, generalized: process_slack_files(..., persist_images: bool = True) (span=a6044497ec09) -- fixed in 30e6441.

The default is deleted; persist_images is keyword-only and required, and the one caller (slack/events.py) passes the per-message decision. The two tests that called it without the argument now pass it explicitly.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: the planted-uploads/ test builds its link with the shared make_dir_link helper

  • A new skip weakens the symlink security ratchet (test/test_slack_one_renderer.py:330, span=0a937971062d) -- fixed in 30e6441.

Holds: a raw pytest.skip("no symlinks on this platform") let the planted-root assertion go unexercised wherever a symlink needs a privilege. The skip is gone: test_a_symlinked_uploads_directory_is_refused builds its link with make_dir_link (a junction on Windows, a symlink elsewhere), the same helper the linked-ancestor test already used, so the refusal runs on every platform; the leaf-symlink test keeps the repo's requires_symlinks capability probe, which is the sanctioned form.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Only one direction is evidenced (span=efb15892a93a) -- accepted-and-deferred: a live Slack capture on review when a maintainer asks; the dashboard→Slack half is evidenced by recorded calls.

No Slack workspace is reachable from the environment that produces the screenshots (stated under Manual verification), so the thread side is evidenced by the recording client in test/test_slack_one_renderer.py::TestDashboardIngressDrivesTheRenderer: for a dashboard-ingress turn driven through the real _run_chat, the tests assert the exact Slack call sequence -- the 💬 _…_ echo, set_thread_status, start_stream with the owner as recipient, append_task open/complete per tool, one append_stream per text segment, the OPTIONS footer with its recorded ts, upload_file for a pasted and for an agent-drawn picture, status cleared. The two screenshots show the only surface a browser renders here. The dashboard→Slack reply shape itself is the one a Slack-born turn has had since the renderer existed; what is new for a dashboard-born turn is that it now gets that shape too.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 3 — product shape, no recorded decision (span=2fd5c208d5b4) -- rebutted: the decision is recorded on this PR, by the maintainer, and the description now names it as a take-away rather than hiding it.

The recorded decision: the maintainer's disposition at head 0591889e (span 05731bfce749, target=first-principles) -- "the extension is the maintainer's brief, and the base-failing case exists… promotion is decided by the destination slot's link state, not message content… a native thread linked later (link-time backfill) renders its history in the dashboard, and a picture left in turn-temp is gone by then". The intent comment's Not-a-goal line records the matching boundary: "any retention policy for the uploads directory". The "retention change, accepted" wording this item quotes is the Breaking: line the Backwards-compatibility section exists to carry: it names the take-away a reader outside the patch feels, which is what the description template asks for. The retention itself is the one uploads/ already applies to every dashboard-pasted picture; this PR adds no policy to it (cleanup for both is #10871 item 3).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 4 — inherited: the RFC citation in dashboard/slack_mirror.py (span=042a579d57ff) -- accepted-and-deferred to the next push this PR requires (a docstring edit; never a push of its own).

Measured: delivering a dashboard-born turn into the linked thread is not something this PR introduces. The base already does it with hand-rolled calls in chat_runner.py (the 💬 echo and start_stream at the "Bidirectional sync" site, present since the repo's first commit 849a03fff); this PR deletes that second implementation and drives the existing SlackRenderer from the same event sites, which is what fixes the picture defect on that leg. So the reshape does rest on the picture defect and on removing a duplicate output path, and the citation in the module docstring is naming the direction the maintainer's intent comment names, not an authorization the RFC is asked to carry. The lane's subtraction -- drop the citation and state the defect -- is a docstring change with no behaviour, and it rides the next push rather than restarting every lane for a comment.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • product-shape change without accepted RFC: Slack image retention default (span=d2ccfc47e8ac) -- rebutted; this lane clears a BLOCK only by RFC or maintainer override, so this record is the written adjudication for that ruling, not a claim to have cleared it.

What ships: a picture posted in a Slack thread whose conversation is not temporary/incognito lands in <data_home>/uploads/ -- the directory every dashboard-pasted picture already lands in, under the retention it already has -- instead of a turn-temp file. The lane's own inventory on the previous head counted this item justified (verdict CONCERNS at 72c26d327d; the related "oversized" item was ruled on by the maintainer at 0591889e, span 05731bfce749: the extension is the brief, and the base-failing case -- a native thread linked later whose history backfills a dead temp path -- exists and is pinned by test_inbound_pictures_persist_for_a_linked_slot). The private cases are refused by the gate this head fixed: the durable flag and the same-message token, now read under the key the turn runs under (a single-session DM included). rfc-session-address-model.md is cited for the one-renderer direction, not for retention; no RFC on the base covers image retention because the PR adds no retention policy -- it reuses the uploads directory's. The clearing paths the lane names are a maintainer's: an override recording this adjudication, or an RFC covering inbound-image retention merged first. Narrowing promotion to linked slots only would reverse the maintainer's recorded ruling and is not a change this drive makes on its own.

@NicholasRBowers

NicholasRBowers commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: queue_edit_by_id drops _ingress with the other provenance flags

  • queue_edit_by_id keeps the _ingress="slack" tag after a dashboard edit (src/kiro_crew/dashboard/slot_queue_repository.py:746, span=86016db37552) -- fixed in 14db01f.

Holds: the tag survived an edit, so the drain still derived Slack ingress and _run_chat skipped echo_user_message; the thread read an answer to words it never saw. The edit now pops _ingress beside the two directive flags it already resets -- the replacement was typed in the dashboard, so that is its ingress -- and _dequeue_next_message already keeps an untagged entry out of a Slack-tagged batch, so the edited text drains echoed.
Pinned: test_edit_by_id_drops_the_slack_ingress_tag (test_queue_edit.py).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 4 — inherited: the RFC citation in dashboard/slack_mirror.py (span=042a579d57ff) -- fixed in 14db01f.

The lane's subtraction, applied at every site the PR added rather than the one named: the module docstring of dashboard/slack_mirror.py, the SlackRenderer class docstring and authorize_upload_root docstring in slack/renderer.py, and the mirror-site comment in dashboard/chat_runner.py now rest the reshape on what it fixes -- the second, text-only output path through which a pasted picture reached the thread as a filesystem path -- and cite no RFC. Comment-only; no behaviour changed. It rode this push, which the Opus finding above required.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

The exposure is as described and bounded as described: within one data_home (one principal) uploads/ is one flat directory, so a linked session may reference a picture another session of the same principal pasted or promoted, including one pasted in a restricted session, and ship it as a raster to a thread is_allowed_user gates to that principal's own identities. The maintainer accepted that residual in the spec this PR ships (slack-gateway.md, Linked Thread Sync: "uploads/ is one flat directory approved as an outbound root for every Slack-linked session, so a picture promoted by one linked session is referenceable by another linked session of the same principal; per-session namespacing is tracked in issue #10871 (item 2)") -- the explicit acceptance in the PR this item names as one of its two clears. The admission is unchanged from the head the lane passed as CONCERNS before; this push only fixed the identity of the root (ApprovedRoot) and the link refusal at its name.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

A per-session allow-set (the turn's persisted_paths plus the session's own pasted paths) is one shape for the namespacing #10871 item 2 tracks, and it would indeed retire the refuse_link / identity pinning on uploads/. It is a design choice over the maintainer's chosen directory root, not a defect in it, and the issue is where that choice is being made (label deferred-finding, assignee NicholasRBowers, due 2026-10-15).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 1 — inherited: the one-renderer shape rests on a partial RFC (span=1b77b7e9339d) -- rebutted on the measured basis the lane asks for; the citation is gone from every PR-added docstring and comment, and the shape rests on the defect.

Measured: the base already delivers a dashboard-born turn into the linked thread -- the hand-rolled 💬 echo, start_stream and tool-card calls at chat_runner.py's "Bidirectional sync" site have been there since the repo's first commit (849a03fff). What this PR changes about that leg is the implementation: the second, text-only path is deleted and the existing SlackRenderer is driven from the same event sites, which is what lets a pasted picture reach the thread as a picture instead of a filesystem path. No RFC is asked to authorize the mirror, because the mirror is not new; the RFC paragraph in the frozen ## Why it matters is the author's statement of direction and stays as the author wrote it. The three visible differences for a dashboard-born turn (streamed segments, the OPTIONS footer, thread status instead of a placeholder) are the shape every Slack-born turn already has, named as a take-away in ## Backwards compatibility.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Item 5 — rides along: dashboard reasoning posts to the linked thread as 💭 (span=027bd7c1ed7c) -- rebutted: no new default; the thread keeps the one setting it already has.

slack.show_thinking is the existing per-channel setting that decides whether a Slack thread shows reasoning, default True for Slack and False for Telegram and Discord (config/section_builders.py), and the Slack-born path already reads it (slack/events.py passes KiroCrewConfig.load().slack.show_thinking). open_slack_mirror reads the same key, so a linked thread shows or hides reasoning by one setting whichever surface the turn arrived from; deleting the on_thinking call would make the same thread show reasoning for a Slack-typed question and hide it for a dashboard-typed one. Pinned: test_thinking_follows_slack_show_thinking (test_slack_one_renderer.py), both values.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • A message posted from Slack looks like one the user typed in the dashboard (span=835729d66ada) -- rebutted as before; the lane itself files it as follow-up work.

A linked session is one person's session reached from two surfaces: maybe_route_linked_thread denies any Slack message whose user_id fails is_allowed_user before it reaches the slot, so a user row in a linked transcript was written by this gateway's own principal on either surface. The TEXT of a Slack-born message already renders as a plain user bubble with no provenance mark; the picture following its text into the same bubble is the consistent rendering. A channel-origin badge for transcript rows is a transcript feature for text and pictures alike, listed under ## Not a goal, and the _ingress tag such a badge would read is what this PR adds.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: SlackRenderer.authorize_upload_root_off_loop runs _approved_roots in a worker thread; both production callers await it

  • Upload-root approval performs blocking filesystem work on the gateway loop (src/kiro_crew/slack/renderer.py:993, span=e117f002a19e) -- fixed in b75c702.

Holds: approve_root resolves the cwd and pins the uploads directory, and both ran on the loop from open_slack_mirror and handle_message_transport; a stalled mount under either would hold every session's turn. The approval now runs through asyncio.to_thread -- the shape the renderer's other filesystem touch already takes (extract_local_refs_off_loop) -- and only the result is assigned on the loop. The synchronous authorize_upload_root stays for callers already off the loop and for tests; the Slack dispatcher and the dashboard mirror await the twin, which is source-pinned so neither can drift back.
Pinned: test_the_off_loop_twin_approves_in_a_worker_thread (fails with the twin assigning synchronously) and test_both_production_callers_await_the_off_loop_twin (test_slack_one_renderer.py).

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

Measured: is_sensitive_path(<data_home>/uploads/<uuid>_x.png) is False and nothing else fences the directory, so an agent's own file tools already read every file in uploads/ on this host before this PR -- the boundary this root widens is the outbound SEND of such a file into a Slack thread, not the read. That send is bounded as the item says: within one data_home (one principal), to a thread is_allowed_user gates to that principal's identities, rasters only, under the per-message budgets, and nothing from an uploads_allowed=False (restricted) session ships at all. The maintainer accepted exactly this residual in the spec this PR ships (slack-gateway.md, Linked Thread Sync: one flat uploads/ approved as an outbound root for every Slack-linked session, a picture promoted by one session referenceable by another of the same principal, per-session namespacing tracked in #10871 item 2 -- label deferred-finding, assignee NicholasRBowers, due 2026-10-15). A per-session allow-set is the design that issue decides; this PR's root admission is unchanged since the head the lane passed as CONCERNS at 72c26d327d.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: no

  • Inbound picture with no source marker (span=f32c497f3eca) -- rebutted as on the two previous heads; the lane itself files it as follow-up work.

A linked session is one person's session reached from two surfaces: maybe_route_linked_thread denies any Slack message whose user_id fails is_allowed_user before it reaches the slot, so a user row in a linked transcript was written by this gateway's own principal on either surface. The TEXT of a Slack-born message already renders as a plain user bubble with no provenance mark; a picture following its text into the same bubble is the consistent rendering, and marking pictures alone would say the opposite of what the text beside them says. A channel-origin badge for transcript rows is a transcript feature for text and pictures alike, listed under ## Not a goal; the _ingress tag such a badge would read is what this PR adds.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: _mirred = StreamRedactor(redact_via_context), and a rolling _mirthinkred = StreamRedactor(redact_via_context) on the reasoning feed, flushed at every mirror boundary

  • a dashboard-born reply now reaches a linked Slack thread without the platform-context credential redactor it used to go through (src/kiro_crew/dashboard/chat_runner.py:7833, span=6dd7854a8bdf) -- fixed in 3069303.

Holds: the replaced reply leg posted through render_for_slack, whose default redactor is redact_via_context; the streamed leg built StreamRedactor() with the bare security.redact, and the renderer's seal (_redact_all) is the baseline too, so on a composed host a companion-only credential in a dashboard-born reply reached the thread unmasked. Both mirror redactors now take redact_via_context, and the reasoning gets its own rolling redactor rather than a per-chunk call: the renderer accumulates reasoning and redacts the whole with its baseline floor at post time, so the context layer must go in on the way in, and per chunk would miss a credential split across two thinking chunks. The reasoning tail flushes before the first answer text (when the renderer posts it) and with the text tail at every other boundary.
Pinned: test_a_companion_only_credential_is_redacted_on_the_reply_stream (reddens with the bare StreamRedactor()) and test_a_companion_only_credential_is_redacted_in_the_posted_reasoning (reddens with the raw event.text feed), test_slack_one_renderer.py.

@NicholasRBowers

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: SlackRenderer._split_trailing_display_run -- a display-form holdback on every throttled flush, folded into _word_hold

  • Markup-separated credentials escape the append-only mirror (src/kiro_crew/dashboard/chat_runner.py:10895, span=db37e66c9e96) -- fixed in 77e3529.

Holds, and not only on the mirror leg: the raw rolling redactor holds a trailing run of credential-class CHARACTERS, so [AKIA](https://…/a-long-path) is released whole when ) ends the run, the next chunk opens with the rest of the key, each append's display-form scan sees a fragment, and Slack renders the two appends as one key. The Slack-born path streams through the same renderer with the same shape, so the fix lives at the renderer's flush, where the form Slack displays is known: before the word holdback, the shortest raw suffix whose canonicalize_display form is a non-empty credential-class run (bounded at 256 display / 1024 raw characters, skipped when the run carries no markup) is held and prepended to the next flush, so the joined run is scanned as Slack shows it by _display_safe before anything is appended; the final flush, release_held_word and close() carry it like the word hold. An image reference is never cut (_withhold_refs owns it whole to the seal).
Pinned: test_a_key_split_by_a_link_never_renders_whole_in_the_stream (renderer, throttled flush between chunks) and test_a_key_split_by_link_markup_never_renders_whole_on_the_mirror_leg (through _run_chat) -- both redden with the holdback removed -- plus test_the_boundary_helper_holds_the_markup_tail (link, emphasis, Slack link grammar, both bounds, image reference left whole), test_slack_one_renderer.py. The existing test_the_append_only_stream_never_shows_the_path (test_slack_backports.py) pins the image-reference seam.

Copy link
Copy Markdown
Contributor

PR triage: rebase needed, and merge order needs agreeing with #15273 and #16851

I checked head 77e35295 against origin/main 6a31a63e. The rebase on 2026-10-03 has gone stale. git merge-tree origin/main origin/pr/10369 now conflicts in 7 files: docs/system-specs/modules/slack-gateway.md, dashboard/chat_runner.py, dashboard/chat_slack.py, dashboard/chat_utils.py, dashboard/handlers/files.py, slack/handler.py and test/test_source_corpus.py. These are the main-side changes behind them:

Coordinate with open PR #15273 ("build image blocks only from a channel's attachment list"). The two PRs overlap in code and conflict in behavior:

  1. In this PR, an inbound Slack picture reaches the model only because acp/prompt_blocks.build_prompt_blocks regex-scans the prompt text for ![image](/abs/uploads/…). The slack-gateway.md diff says so: "_send_prompt() finds the path inside that markup". fix(acp): build image blocks only from a channel's attachment list #15273 deletes that scan, so only a structured PromptAttachment list produces image blocks. If both merge as written, a picture posted in a linked thread shows in the transcript but never reaches the model.
  2. Both change slack/files.process_slack_files in incompatible ways. This PR returns IngestResult; fix(acp): build image blocks only from a channel's attachment list #15273 returns a 3-tuple with prompt_attachments. They also edit the same _route_message call site.
  3. Both add a Python twin of the composer's mdImageDest named markdown_image_dest: this PR in kiro_crew/uploads.py, fix(acp): build image blocks only from a channel's attachment list #15273 in kiro_crew/prompt_attachments.py. Both also add test/fixtures/markdown_image_dest.json with different contents (an add/add conflict). One module should own that function and one fixture should be shared.

Also overlapping: #16851 (cron replies upload embedded images to Slack). It moves the renderer's extract/upload into slack/files.py helpers (extract_outbound_with_audit(within_root: str)). This PR widens within_root to UploadRoots / ApprovedRoot and adds authorize_upload_root_off_loop. The goals complement each other, but whichever lands second has to carry the multi-root signature through the new helpers.

Still open from earlier review comments: Design Review flagged that slack/renderer.py:_approved_roots makes the flat <data_home>/uploads/ an outbound root for every Slack session, which allows cross-person image egress. First Principles flagged that uploads/ has no retention for Slack-native pictures. Both are recorded as deferred to issue #10871, but the reviews say they should be resolved or explicitly accepted in docs/decisions/ before merge.

Recommendation: rebase onto current main, then agree a merge order with #15273, and port the inbound image to its structured-attachment path if #15273 lands first.

@NicholasRBowers

NicholasRBowers commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Nick's agent: Nick is no longer actively driving this PR, so it's open for anyone who wants to pick it up. Auto-merge is disarmed. Current state: head 77e352954 conflicts with main; @bolichen97's triage comment above lists the conflicting files and the merge-order overlap with #15273 and #16851. The two deferred items (per-session upload scoping, Slack-native picture retention) remain tracked in #10871.

This branch has not been deployed

No deployments
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 readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants