Skip to content

feat(slack): after a code channel's Stop, nothing it stopped starts until a person writes - #38882

Open
kyleseaman wants to merge 5 commits into
mainfrom
feat/code-channel-stop-hold
Open

kyleseaman wants to merge 5 commits into
mainfrom
feat/code-channel-stop-hold

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: after a Stop in a Slack code channel, nothing it stopped starts again on its own until a person writes.

Since the brake (#38243), Stop and !stop in a code channel stop the channel's session, every helper agent the code-channel store records for it, and their sub-agents. But nothing is held afterwards. A message queued for a stopped helper, its AutoNudge or patrol, a helper's report waking the channel's session, or a send from that session can start them again seconds after the person pressed Stop.

Why it matters

A brake that lets the work start again by itself is not a brake. The RFC amendment (#35935, docs/request-for-change/rfc-slack-code-channels.md §3 "Stop", "What happens next") records the rule: nothing starts again on its own until a person sends a message, a message to one helper agent releases only that one, who is a person is read from the gateway's own record, and restart resume does not resume a turn a Stop ended.

Not a goal

  • Undoing what an agent already wrote.
  • Changing who may press Stop.
  • Holding sessions the code-channel store does not record as the channel's helpers (a chat filed in the channel's folder, an adopted crew-log child): the brake already counts those as still running.
  • The RFC's "or the channel's session, working on a person's message, starts it again" (§3 "Stop", "What happens next"). A session_send carries no turn identity the gateway can prove, so that half needs its own design and comes in a later PR. Here a held helper is released only by a person's message to that helper (in its dashboard chat); the channel's session can start a new helper instead, and a helper born of a released session is not held.
  • New UI. The Slack reply says the work is held. A notice row in each held transcript is left out: appending it would load a lazy transcript window on the event loop during the Stop. It can come in a follow-up that loads the window off the loop first.

What changed (motivation → approach → change)

Goal → approach. An earlier version went red over six review rounds on one class: a hold decided before an await and acted on after it. So this version has exactly one decision, stop_hold.decide(slot, stamp), which is synchronous and reads only the slot. Every path asks it in the same synchronous span as the effect it guards, and the dispatch gate asks it last with no await between it and the stream. No write carries a captured value. The first review round of this version found the same class in where a person's stamp came from (read late, after the request's awaits), and a later one found that a handler's own entry is still late: middleware awaits before it. So the press is now read where the request ARRIVES at the process (the outermost middleware, the Socket Mode listener) and passed down unchanged. The second found it in the relay from the channel's session to its helpers, which is left out (see Not a goal).

What was built (src/kiro_crew/slack/code_channels/stop_hold.py, new):

  • The hold. slot._stop_held is persisted as the slot's own metadata-line field stop_held. The key is slot-owned: the full line writes it while held and omits it once released, and the empty-window merge writes true or false. slot._stop_hold_seq is the press that set it, from one process-wide counter, so no clock is compared anywhere.

  • The press. stop_helpers.stop_channel (feat(slack): a code channel's Stop also stops its helper agents #38243's Stop after routing._stop_bound's fence) calls stop_hold.press before its first await, right after feat(slack): a code channel's Stop also stops its helper agents #38243's read of whether the channel's session was running at the press; both stay in that first synchronous span (test_the_press_and_the_running_read_both_come_before_the_first_await). It holds the channel's session in memory, then reads its helpers from the store and holds them. The Stop writes the holds BEFORE the brake, so a crash during the brake keeps them. A session the Stop did not stop because it was compacting (the channel's own or a helper) has its hold undone. The reply ends "Nothing starts again until someone writes." only when the Stop still holds a session, by its live slot or by its key alone (a closed tab, a helper with no live slot).

    • A live helper with no rows yet (its birth record only) is written with a forced save, the one way an empty window's line is written. This is the forced-full-save census's 27th site (stop_hold.persist, pinned with expected_history_key); the bound in test_slot_sweep_invariant_gates.py goes from 26 to 27.
    • The channel's own session with no live slot at the press (its tab closed) is held when it registers, as a helper is. The press also writes the channel's fact, so a session that replaces the channel's (a new key) takes that press right after its binding is written, before any message reaches it.
    • A KAS /context, /code or /knowledge (they only send engine RPCs) runs as a task recorded for its slot; the press cancels it, so a Stop ends it at its next await. Only that cancel ends there (an outer cancel goes on, judged by its count growing during the wait). /clear and every other local command are never cancelled.
    • A helper with no live slot is held whenever its slot registers (SlotRegistry.put_slot). The press stays pending until a person releases that helper, so a reopen that is refused does not spend it. Reading the line back never lowers a press already applied.
    • A helper born of a held session is held at birth (session_create, read on the loop after the store records the worker).
  • A person's stamp, read on arrival. The stamp is <boot>:<press>: the last press when the request ARRIVED at the process. The press is read only at the arrival points in stop_hold.ENTRIES, before any await of ours, and the stamp is built once the gateway's own authorization admitted a human:

    • HTTP: stop_hold.stop_hold_arrival_middleware is first in both servers' middleware lists (before route latency). It writes the press into the request synchronously. Send, Continue, Regenerate, Edit & Resend and Rewind build their stamp from that value (stop_hold.http_stamp(request)) and never read the press themselves, so no middleware await (the slot-ownership transcript read among them) lets a later Stop in first. They stamp only a request token auth marked as a dashboard user (is_dashboard_user), never the loopback internal caller (internal_auth: an MCP tool, a script) nor an app token. A request that never passed the middleware carries none.
    • Slack arrives only over Socket Mode: the envelope's listener (events._on_event) reads the press before its first await; _route_message builds a message's stamp once its sender is admitted (a trusted bot gets none); code_channels.commands.handle_slash builds a command's after is_allowed_user. An action button (block_actions) carries none, so it never releases (fails closed).

    Everything below the entry takes the stamp as a parameter: routing.dispatch, deliver_directed, _route_to_slot, route_linked_thread and its reroutes, queue entries, the queue drain (the newest person's stamp among its entries; the drained transcript row does not carry it), and the /prompts get re-entry of _run_chat. A queue entry restored from history loses its stamp: a stamp is valid only in the live queue it was minted into. A stamp releases a hold no newer than its press. Peers (the channel's own session included), wakes, births and resume carry none.

  • Shared users. A shared user (slack.shared_access) never presses or lifts a hold: code channels stay the owner's, so their message, typed !stop, command, context-bar Stop or linked reply is refused or dropped before a person's stamp is minted or a press is made (test/test_slack_code_channel_stop_hold_shared.py).

  • A send to a held helper. It is queued and waits. send_to_target answers held: true, and the session_send tool says in one sentence that a Stop holds the session and it starts when a person messages it, so a conductor does not wait on it.

  • Where it is asked:

    • chat_send and enqueue_or_run_prompt queue a held send. chat_send asks again after its replay read, and refuses with 409 channel_stopped a send a Stop held during its turn admission, when nothing can be queued any more.
    • The queue drain holds a queue with no person's entry in it. A person's entry anywhere in the queue releases the hold, and the queue drains in order, so a held entry at the head never blocks it.
    • A person's Continue on a helper held by both Pause all and the Stop, its queue restored from disk, carries its arrival stamp onto the entry the paused-member drain sends, so it releases the Stop's hold too; an internal caller's Continue there answers 409 channel_stopped and the pause keeps its hand-back (it never answers ok with nothing run).
    • steer_into_running_turn refuses every steer into a held turn after its last await, so a person's steer takes the send's stamped queue path, which releases.
    • AutoNudge answers busy.
    • Restart resume refuses a held slot and offers no Resume button.
    • A local / command acts before the dispatch gate, so _turn_slash_gate asks first, before its first await. Held, the turn ends; a person's own command releases there. A local command that starts work asks again where it acts: /workflow hands WorkflowService.start_definition an admit predicate, asked synchronously at the run's commit point (start_background_run's admission check for a script, TaskRunner.execute_plan right before its task starts for a task plan; admit=None, every other caller, is as on main), and a harness-local command asks right before _answer_slash_for_harness.
    • _turn_dispatch_gates asks last for a model turn, after every other refusal and before mark_accepted. A held turn ends there as channel_stopped. A release is an in-memory flip whose save is started, not awaited. The transport asks once more under its write lock, right before the prompt is written (stop_hold.write_gate, through the existing prompt_gate seam, given to a client whose stream declares that keyword, as both real providers do), and earlier asks end a held turn before admission's first await, before the session claim, before the hook commands (and at each command's spawn) and before the first post (the third table below).
  • Line cap. chat_send.py stays at 1998 lines. routing.py gains 14 lines (1,935 on feat(slack): a code channel's Stop also stops its helper agents #38243 to 1,949): the stamp on InboundResult, its hand-on through dispatch, _route_to_slot and deliver_directed, and carry after a replacement's binding write. The press, the write before the brake, the compacting undo and the reply's closing sentence live in stop_helpers.stop_channel, beside feat(slack): a code channel's Stop also stops its helper agents #38243's Stop.

Docs: "What a Stop holds" in docs/system-specs/modules/slack-gateway.md (the restart facts included) and the Stop paragraph of src/kiro_crew/docs/slack-integration.md.

Every path that passes the hold, with its last await and where the hold is asked (the invariant: no await between the ask and what starts work):

Path Last await before work starts Where the hold is asked Test
Model turn (every _run_chat) _turn_dispatch_gates' own earlier awaits (the monitor authorize, the crew-pause owe) _turn_dispatch_gates, synchronous, before mark_accepted and the stream; then the transport's own awaits, asked again under the write lock (stop_hold.write_gate) test_the_gate_is_the_last_refusal_and_nothing_awaits_after_it, test_a_stop_in_the_transports_wait_writes_no_prompt
/workflow script run run_background → registry.register_async start_background_run's admission_closed() (with admit), then ensure_future test_a_workflow_started_across_a_stop_never_runs
/workflow task plan execute_plan's _bound_history_key execute_plan, right before create_task(_execute()) test_a_task_plan_held_at_its_commit_point_starts_nothing
Harness-local command (/clear, KAS verbs) _slash_command_backend asked before the command; a running KAS /context, /code or /knowledge (they only send engine RPCs, stop_hold.ENDABLE_LOCAL) is ended by the press at its next await; /clear and every other local command are never cancelled test_each_local_command_that_starts_work_asks_the_hold_where_it_acts, test_a_stop_ends_a_running_context_add_before_its_second_rpc, test_a_stop_never_cuts_a_clear_short_and_only_rpc_verbs_are_endable
/prompts get _expand_prompt_mention_off_loop the nested turn's own slash and dispatch gates (stamp passed) test_a_turns_nested_rerun_carries_its_stamp
Queue drain the parked-work probes holds_queue after them; the turn it starts meets the dispatch gate test_the_drain_holds_a_queue_with_no_persons_entry_wherever_the_stop_lands
Dashboard send turn admission 409 refusal after it; the dispatch gate test_a_persons_dashboard_send_decided_before_the_stop_never_releases
Continue, Regenerate, Edit & Resend, Rewind the middleware's and the handler's own awaits the queued entry's drain, or the dispatch gate (the stamp's press read on arrival) the four ..._decided_before_the_stop_never_releases tests
enqueue_or_run_prompt, peer delivery none (synchronous) the queue-or-run decision test_enqueue_or_run_queues_a_held_session, test_a_peers_send_to_a_held_helper_waits
Steer wait_for_clear after it, before the steer registers test_a_non_persons_steer_into_a_held_turn_goes_to_the_queue_path, test_a_persons_steer_into_a_held_turn_takes_the_stamped_queue_path
AutoNudge wake _dashboard_mode_admits after it, before the spawn test_an_autonudge_wake_is_busy_wherever_the_stop_lands_before_its_spawn
Restart resume _interrupted_turn _resume_slot after it; _recheck_for under the slot lock before the queue insert; the notice drops a held session after its last await before the post (no Resume button for it) test_restart_resume_refuses_a_held_slot, test_restart_resume_neither_resumes_nor_offers_a_held_slot, test_a_held_session_is_offered_no_resume_button
Channel session replaced (_bind_channel(replace=True)) the binding write record_binding, right after the write and before any routing: the channel's press holds the replacement test_a_stop_at_any_await_of_a_replace_bind_holds_the_replacement
session_create birth the worker record stop_hold.inherit on the loop after it; the first message meets enqueue_or_run_prompt test_a_helper_born_of_a_held_session_is_held
Context bar Create PR click (#22370's code_channel_action) run_command's gates, then route_linked_thread's awaited admit and its reads route_linked_thread's queue-or-run decision, with the person's stamp built in run_command after is_allowed_user from the press events._on_event read on the click's arrival (as a typed /create-pr); then the dispatch gate test_a_create_pr_click_carries_the_press_its_event_arrived_after
Context bar Stop click none: it records the hold session_events.handle_stopped → routing._stop_bound → stop_helpers.stop_channel → stop_hold.press before its first await, as the typed Stop and Slack's own Stop test_the_bars_stop_stops_the_channels_helper_agents_as_slacks_stop_does (the reply's hold sentence and the keys the press recorded, for the bar and Slack's Stop alike)
Canvas comment read-back (comments._deliver → route_gate._route_to_slot) the comment read and the route's admit route_linked_thread's queue-or-run decision with no stamp (a poll's read, not an arrival), so a held session queues the comment until a person writes test_new_comments_reach_the_session_attributed_and_framed (pins the empty stamp)
View tabs (views.write_view, make_room) none none needed: they write and remove the channel's tabs and start or queue no work none

Where the hold lives. Review rounds 4 to 7 found one defect four times (a replacement session's new key, a copy made around an await, a publication without put_slot, a same-boot reopen): the hold's truth lived on a slot OBJECT, and objects are replaced. So the truth is now the press recorded BY KEY (stop_hold._keys), for every session a press holds, live or absent; stop_hold.holds answers from that record (and the channel's fact, for a session replacing the channel's under a new key) and mirrors it onto whatever object carries the key. The slot's own fields are only a mirror, for its line and a restart. A stamp is judged against the key's press, so a stamp read before a Stop is refused on any object of that key. Nothing is copied from one object to another, so no hold moves:

Site What it does with the record Test
stop_hold.press writes the key of every session it holds, live or absent, and the channel's fact; stop_channel reads the binding again right before it test_the_press_holds_the_session_before_reading_its_helpers_in_memory_only
stop_hold.holds (every decision) reads the record; mirrors it onto the object and, once that object is the live registry entry and no longer under construction, schedules the save (persist, which also skips a slot under construction); until then the save is owed, and a registration never saves; the line itself writes the hold from the key's record, never from an object's mirror (stop_hold.held_flag, which every writer of the line goes through), so a direct publication no ask reached is still written held, and a retained old object saved by any writer after a person released its key (routing._persist_request, a turn-end save) writes the release test_a_pending_press_holds_a_slot_whatever_published_it (on_register a no-op), test_a_live_helper_held_then_reopened_keeps_its_press, test_a_stop_at_any_await_of_a_reserved_resume_holds_the_reopened_helper, test_a_close_rolled_back_after_a_stop_publishes_a_held_helper, test_a_stop_at_any_await_of_a_helpers_reopen_holds_it, test_a_hold_applied_on_first_ask_is_saved_only_for_the_live_entry, test_a_refused_reserved_resume_of_a_held_helper_stays_closed_after_a_restart, test_a_directly_published_held_slot_no_ask_reached_still_writes_its_hold
restore (stop_hold.restore) seeds a held line's key at press 0 for this boot, never lowering a recorded press test_restoring_the_line_keeps_a_press_already_applied_and_a_refused_reopen_spends_none
replace (stop_hold.carry), birth (stop_hold.inherit) write the new key from the channel's fact or the press the creator is held at (its record or fact), on the loop after the binding or worker record test_a_stop_at_any_await_of_a_replace_bind_holds_the_replacement, test_a_stop_at_any_await_of_a_helpers_birth_holds_the_newborn, test_the_floor_and_a_newborns_press_come_from_the_key_s_record
release (stop_hold.gate), undo (compacting) drop the key and its channel fact (an undo only its own press's) test_a_live_helper_held_then_reopened_keeps_its_press (no record left), test_the_hold_is_written_before_the_brake_and_undone_where_not_applied, test_a_helper_whose_compaction_declined_the_stop_is_not_held
the hold's saves (stop_hold.persist, which every hold save goes through) write only the object the registry holds for the key, checked right before each save and again at the save's locked commit (expected_slot_name); an object closed, replaced or under construction meanwhile is not written, and the key stays owed to the first ask on the object published under it test_a_helper_released_during_the_stops_save_stays_released_after_a_restart, test_a_hold_save_of_an_object_replaced_before_its_commit_is_refused, test_a_held_object_the_stop_could_not_write_is_saved_on_its_first_ask

What bounds the map: only Stops add keys (a channel's session and its helpers); a person's release drops a key, an undo its own press, and a restart starts empty. No code removes a binding in this build (CodeChannelStore.drop_binding has no caller), so an unreleased key stays until a person writes or the gateway restarts. A session transfer install mints a fresh key (name=None), so it never reopens a held key. Only stop_hold.py reads or writes a slot's _stop_held and _stop_hold_seq (the codec writes the line through stop_hold.held_flag); test_every_decision_goes_through_holds scans the product for any other access.

Left as is (low, from the Opus lane, each failing closed):

  • The channel's fact is keyed by the binding's session key, so a linked slot under another key that a person releases leaves that fact.
  • A hold applied on first ask is not saved when the last press ran with no dashboard state (memory only, as documented).
  • An undo restores only the object it pressed; decisions read the key's record, so another object's higher mirror changes no decision.
  • A relayed (Team Crew) or HTTP-pipelined request reads the press when it reaches the middleware, a few milliseconds after the process received it; a Stop inside that window is treated as a simultaneous send.

Where a turn's work begins. Review round 9 found the hold asked once, at the dispatch gate, while a turn's work also begins before it (the hook commands) and after it (the prompt write, behind the transport's own awaits). So the hold is asked at every point where a turn's work begins, each synchronously with no await before what it guards, and last at the write. Every effect a turn has between its arrival and the prompt write, and whether a held turn can cause it:

Effect Where the hold is asked Can a held turn cause it?
Admission's preparation: the memory-preparation wait, the code channel's worktree move, Slack option expiry, the turn marker save, app-agent binding, model switch, pending reset, context cap, memory recall prewarm _turn_admit, before its first await No, for a turn held as it starts. A Stop inside these awaits lets them finish for a turn that arrived before it: preparation only, no model request, hook or post.
Session claim (a provider process start, session/new or session/load) right before state.sessions.get_or_create, no await between No, for a turn held by then. A Stop inside the claim's awaits starts the process with no prompt; the write refuses the prompt.
Notices, agent welcome, model settle, crew-log seed, OAuth drain, identity publish, prompt build (history replay, folders, memory vectors and recall) the claim's ask, then the next ask Only for a Stop inside these awaits: the session's own state rows and off-loop compute, no model request. A /prompts get re-entry is a nested turn with all of these asks.
AgentSpawn and UserPromptSubmit hook commands _turn_dispatch_gates before the hooks; each command again right before its spawn, after its last await (run_script_hook(admit=)); again after the hooks No, except on Windows in the instant between the spawn worker's ask and CreateProcess (see Limits). A command asked held is not run and the turn ends channel_stopped.
Model probes (fallback restore, model routing: set_model, and the decision model when model routing is on) the post-hook ask Only for a Stop between that ask and the probe's own request: the decision-model request is in Limits.
Dashboard status ("Thinking…"), context breakdown, Slack echo and placeholder, code-channel turn start, cross-surface echo right after the model probes, before the first post No, for a turn held by then. A Stop inside the mirror's own awaits leaves the echo of a message that arrived before it; the gate then ends the turn, as for a Pause all landing there.
Monitor authorize, Pause all owe (refusals) They only refuse.
Dispatch gate, mark_accepted, turn/started, heartbeat stop_hold.gate, the last refusal No.
Prompt write (session/prompt, after ready-confirm, MCP reinjection, prompt build, timeout resolution, the write lock) stop_hold.write_gate as the transport's prompt_gate, under the write lock right before the frame No. Nothing is written; the turn ends as channel_stopped, as at the gate.
A / command sent to the engine (stream_command: _kiro.dev/commands/execute, or session/prompt on the prompt fallback) the slash gate, the dispatch gate, then stop_hold.write_gate(..., call="stream_command") as the transport's prompt_gate, under the write lock right before the frame, on both providers No. Nothing is written; the turn ends channel_stopped.
An agent's own cycle the gate sets the cancel owed It opens its stream only to send the cancel.

Limits

A turn that arrives after the press and was not sent by a person does not start. A turn already starting at the press is asked at the dispatch gate and again at the prompt write, and what it does between those two asks is not undone. Two things can still go out for a turn that was starting when the Stop landed:

  • A decision-model request: with model routing on, _route_model_for_turn awaits (the history budget) and then sends its request to the decision model; a Stop inside those awaits does not stop that request.
  • A hook command on Windows: its child is built on the spawn worker thread, which asks the hold right before CreateProcess; a Stop handled on the loop thread in the instant between that ask and CreateProcess still lets that one command start (no lock between them, no kill after the spawn).

This is the same window main's own Stop has for a starting turn: stop_slot_turn answers no_turn for it (its _turn_done still set) and cancels nothing. That is main's and #38243's behaviour, unchanged here; the write gate is what refuses that turn's prompt. The fix for the two rows belongs in the Stop itself, not in more asks here.

Two more follow from where the Stop now writes the hold:

  • The Stop reads whether the channel's session is running (feat(slack): a code channel's Stop also stops its helper agents #38243's pressed, stop_helpers.stop_channel) before it writes the holds and uses that answer after the write's await. If the session's turn ends during that write and a person then writes, their message releases the hold and the Stop still stops their new turn; the reply's closing sentence then describes a hold that is already released. This is feat(slack): a code channel's Stop also stops its helper agents #38243's known limit (a turn started during its first sub-agent sweep), with a longer window here. The fix is a turn-scoped cancel in the Stop, not this PR.
  • The saves before the brake (stop_hold.persist) run one after another, each behind the transcript's patient lock, so a busy transcript lock delays the Stop. This follows from writing the hold before the brake; the delay is not measured.

Known limits that fail closed (the work waits until someone writes): a Slack message in a thread linked to a dashboard chat outside a code channel, and an action button's answer, carry no stamp. An agent's session_continue on a held helper still answers "continued" while its entry waits held (an honest answer did not fit in three lines). A hold save refused at its locked commit (the slot replaced after persist checked it) is not owed again until the key's next registration, and a release's save of a slot no longer published is skipped; both leave the line held, so they fail closed.

Sensitive change

Two Sensitive Change Review paths, both this PR's own (not inherited): src/kiro_crew/hook_runtime/script_hooks.py and src/kiro_crew/sandbox_rlimit.py.

Sensitive change review

  • Head commit: 53fda25
  • What rule changed:
    • src/kiro_crew/hook_runtime/script_hooks.py (+45/-5 against main).
      • run_script_hook and ScriptHookStore.fire take one new keyword, admit: Callable[[], bool] | None = None. fire passes it to each run_script_hook only when it is set.
      • run_script_hook asks it after its own last await (the governance, deny-list and sandbox-argv vetting). Then, around the spawn only, it sets spawn_admit (platform_compat_offloop_spawn.py) to it, so a Windows build asks it on its worker thread right before Popen. It also passes it on to create_subprocess_limited, and resets spawn_admit right after the spawn and in its outer finally.
      • A refusal from any of these returns the same held() result: the command does not spawn, the sandbox's temporary file is removed, and the hook answers refused (exit_code=2, "not run: held by a code channel's Stop").
      • The other changes are type annotations: stored_run and gated become dict[str, Any].
      • No governance check, deny list, sandbox argv, environment allowlist or timeout changes.
    • src/kiro_crew/sandbox_rlimit.py (+13/-0).
      • create_subprocess_limited takes one new keyword, admit: Callable[[], bool] | None = None.
      • It asks admit right before every spawn attempt: the no-shim fallback, each pass of the interpreter-ENOENT retry loop, and the final unguarded attempt. Those asks come after the function's own awaits (the PATH lookup thread hop and the retry backoff).
      • False raises SpawnNotAdmitted, and nothing spawns. The check and the exception's import are local to the function (the exception lives in platform_compat_offloop_spawn), so sandbox_rlimit gains no module-level name and the sandbox facade, src/kiro_crew/sandbox.py, is unchanged.
      • No resource limit, shim, PATH screening, chdir_fd pinning, retry budget or preexec handling changes.
  • Before -> after (what was allowed/blocked, now):
    • Before: every vetted hook command spawned.
    • After: the same, except on a dashboard turn a code channel's Stop holds (turn_dispatch_gates._hook_admits, the hold's own read-only ask). There, no AgentSpawn or UserPromptSubmit command spawns once the Stop has landed. That includes a Stop during the spawn function's PATH lookup or retry backoff, and on Windows a Stop while the build waits for a spawn worker.
    • Every other caller of either function passes no admit and sets no spawn_admit, gets None, and runs exactly as before. create_subprocess_limited has 44 call sites, and only run_script_hook passes admit.
    • The new path only removes a spawn; it never adds or widens one.
  • Worst case if wrong (breaks commands / leaks secret / locks user out):
    • A hook command that should have run does not run on a turn the Stop held. That turn is refused as channel_stopped anyway, and the next person's message runs its hooks again.
    • On Windows, a Stop handled on the loop thread in the instant between the spawn worker's ask and CreateProcess still lets that one command start. There is no lock between them and no kill after the spawn.
    • No secret path or environment change, and nobody is locked out.
  • Evidence checked (which sandbox result proves it):
    • test_slack_code_channel_stop_hold_write.py:
      • ::test_a_stop_during_the_spawns_path_lookup_spawns_nothing
      • ::test_a_stop_during_the_spawns_retry_backoff_spawns_nothing
      • ::test_a_stop_during_the_last_backoff_runs_no_final_attempt
      • ::test_a_held_spawn_without_the_shim_spawns_nothing
      • ::test_a_hook_whose_spawn_is_refused_answers_held_and_cleans_up
      • ::test_a_hook_command_never_spawns_once_the_stop_lands[posix|windows]
      • ::test_a_stop_while_a_hook_is_vetted_spawns_no_command[AgentSpawn|UserPromptSubmit]
    • test_slack_code_channel_stop_hold_spawn.py:
      • ::test_a_stop_while_the_build_waits_for_a_worker_builds_no_child[shell|no-shim exec] (a one-worker pool held busy: no child, held(), the file removed, spawn_admit reset)
      • ::test_a_cancelled_build_the_stop_held_builds_no_child
      • ::test_the_ask_raising_on_the_worker_builds_no_child
      • ::test_an_admitted_build_spawns_as_today_and_an_unset_ask_is_not_asked
      • ::test_held_now_answers_as_queues
      • ::test_held_now_writes_nothing
      • ::test_a_hook_held_by_the_channels_fact_alone_still_writes_the_hold
    • Each check has a test that fails without it.
  • No regression:
    • Tools still work (which tools/commands were run, result): test/test_script_hooks.py, test/test_hooks_composition_contract.py and the hold's hook and spawn tests (test_slack_code_channel_stop_hold_write.py, test_slack_code_channel_stop_hold_spawn.py) passed in the scoped run below.
    • Backward compatible (old config / old data / old callers still work, how checked): both keywords default to None and spawn_admit defaults to None, so no caller had to change. fire passes admit only when it is set, so a test double that patches run_script_hook without the keyword still works. No hook config, schema or stored data changes.
    • Existing tests (which suites passed on this head): on the same patch one rebase earlier (6234c1113c on ec5abb77a5, range-diff = for both commits): the PR's own test files with the hold, hook, dispatch-gate, sandbox_rlimit, off-loop spawn and sandbox facade tests, 14,151 passed and 14 failed; the 14 fail the same way on clean main on this host (ten test_terminal_commands.py::TestRunProbe cases on the sandbox probe, two symlink-loop tests, one Python 3.13 type-hint repr, one edit-gate path test). The static gates (prepush-gates.sh), fail=0; every Fast Gate step run locally, rc=0; ratchets in PR mode, 178 passed; the agent-SDK boundary gate, passed; Semgrep, 0 findings.
  • How to undo:
    • Revert the sandbox_rlimit.py hunk. In script_hooks.py, revert the spawn_admit set and resets, the admit=admit argument and the SpawnNotAdmitted catch; the hook's own ask before the spawn stays.
    • In the unwatched platform_compat_offloop_spawn.py, the worker-side ask can stay or go: unset, it asks nothing.
    • To drop the whole spawn-time ask, also revert the rest of the script_hooks.py hunk and drop admit=_hook_admits from the two _fire calls in turn_dispatch_gates.py. The hold's ask before the hooks and its ask after them stay.

Backwards compatibility

Compatible. No config key or route changes; both servers gain one middleware, first in their lists, that only records a value on the request. One new metadata-line key, stop_held: an older build ignores it, and a line without it reads as not held. _run_chat gains the keyword _stop_hold_stamp. A send refused during admission while held answers 409 channel_stopped, as a Pause all answers 409 crew_paused.

Reader: src/kiro_crew/slack/code_channels/stop_helpers.py:reply_text -- gains held; its one caller stop_helpers.stop_channel passes the press; the reply stays counts only -- test_bang_stop_in_a_code_channel_stops_the_bound_session

Tests

test/test_slack_code_channel_stop_hold.py and test/test_slack_code_channel_stop_hold_send.py (new) have one interleaving test per await-table row. The path runs from its entry under a stepping driver that presses the Stop at one of its suspension points, then the next, through all of them. Rows:

  • the Stop's press, and its write before the brake (with the undo for a compacting channel session or helper);
  • the dispatch gate, with an AST check that nothing awaits after the gate, that mark_accepted follows it, and that it relays only for a person's words;
  • the dashboard send (queued before admission, refused only during it), Regenerate, Edit & Resend, Rewind and Continue, through the real test middleware chain (the arrival read, auth, the slot-ownership checkpoint and its transcript read) and the real handlers, stepped from the request's arrival so the Stop lands at each middleware await before the handler too, each also as an internal caller (no stamp);
  • the Slack message from _route_message and the Slack command from handle_slash, through the creation barrier and the bind lock; the linked route hands the entry's stamp on unchanged;
  • a / command turn: the hold's ask reaches the write on both providers, native commands/execute and the prompt fallback, a Stop while the command waits for the write lock or its readiness writes nothing, and a stamp from before the Stop never releases it (test/test_slack_code_channel_stop_hold_command.py);
  • a dispatch cancelled before its turn starts hands its queue off without starting a held session; a person's entry stamped after the Stop runs (test/test_slack_code_channel_stop_hold_unstarted.py);
  • a shared user's message, typed !stop, command, context-bar Stop and linked reply mint no stamp, press nothing and release nothing, each with the owner's control (test/test_slack_code_channel_stop_hold_shared.py);
  • a send to a held helper (queued, held: true, the tool's sentence);
  • the queue drain (a person's entry behind a held one, slot busy at send time; the newest stamp of a merged drain; a restored queue carries none);
  • enqueue_or_run_prompt, peer delivery with and without a relayed stamp, and the steer chokepoint;
  • AutoNudge;
  • restart resume, the line read after a pending press, and a refused reopen;
  • a local command at the slash gate, /workflow with the Stop at each await of its start (script and task plan), and the harness-local commands;
  • a person's steer into a held turn, and the channel's session closed at the press;
  • no drained transcript row carries the stamp;
  • the birth, the slot registration, and the write of a live empty helper's hold;
  • the codec round trip and the latest-value write.

test/test_slack_code_channel_stop_hold_write.py (new) covers the third table: a Stop while the prompt waits for the write lock writes nothing (the real session handle), the write's refusal ends the turn quietly as channel_stopped (the turn harness), a hook command never spawns once the Stop lands at any of its vetting awaits (stepped), a turn held as it starts claims and announces nothing, a person's Continue on a member held by both Pause all and the Stop sends its restored queue (an internal caller's is refused, the pause kept), and AST checks pin each ask before the point it guards with no await between.

A provenance guard scans the product's AST: seen() is called only at the arrival points in stop_hold.ENTRIES, before their first await; stamp() and http_stamp() only where the gateway's authorization admitted a human; nothing else reads the press. A planted late read fails it. test_the_arrival_middleware_is_first_in_both_apps checks both servers' lists, and the composition contract (test_dashboard_server_composition_contract_reach.py) pins each booted chain whole with the arrival middleware first.

Mutation checks: each test fails when its guard is removed or moved late.

Source pins: each hold ask in a dashboard turn is tested by what the turn does, through test/turn_harness.py's run_turn with a Stop pressed inside the await right before that ask (test_slack_code_channel_stop_hold_write.py): dropping any one ask fails its test. One read of the turn's source stays, test_a_harness_local_command_runs_in_the_span_of_its_ask (a row of 1 in test/test_source_pin_budget.py): no turn can land a Stop at an await added between that ask and the local command, and nothing asks again after it. The dispatch gate needs no such pin: the prompt write's ask follows it for both providers.

Each ask's mutation and the test that catches it (the hold's tests, the source pin deselected):

Site Outcome Mutation Test that catches it
dispatch gate replaced gate dropped test_a_stop_during_the_echo_is_ended_at_the_gate, test_a_persons_stamp_from_after_the_stop_releases_at_the_gate
gate handed "" instead of the turn's stamp test_a_persons_stamp_from_after_the_stop_releases_at_the_gate
an await added after the gate none: the prompt write's ask follows it for both providers
/prompts get stamp hand-on removed stamp dropped none: an equivalent mutant (the slash gate releases a person's / command before the nested turn; a Stop during the expansion holds it whatever its stamp)
/workflow and harness-local command replaced admit= dropped at the /workflow call test_a_stop_during_a_workflows_start_runs_nothing
local _admits() dropped test_a_stop_before_a_harness_local_command_runs_nothing
kept, 1 read an await added between the ask and the command test_a_harness_local_command_runs_in_the_span_of_its_ask
hook asks replaced pre-hook ask dropped test_a_stop_after_the_claim_fires_no_hook
admit= dropped on AgentSpawn test_a_stop_while_a_hook_is_vetted_spawns_no_command[AgentSpawn]
admit= dropped on UserPromptSubmit test_a_stop_while_a_hook_is_vetted_spawns_no_command[UserPromptSubmit]
post-hook ask dropped, or only its queues check test_a_stop_during_the_hooks_starts_nothing_after_them
ask before the first post dropped test_a_stop_during_the_prompts_last_steps_announces_nothing
write gate replaced write_gate not passed to the stream test_the_runner_hands_the_stream_the_write_gate
admission asks replaced first ask dropped test_a_turn_held_as_it_starts_prepares_nothing
ask before the claim dropped test_a_stop_before_the_claim_claims_no_session

test_slack_code_channel_stop_helpers.py, test_slack_code_channels_routing.py, test_slot_metadata_codec.py, test_chat_persistence_composition_contract.py (the merge's golden bytes), test_chat_runner_composition_contract.py (the entry signature), test_slot_sweep_invariant_gates.py (the census bound), test_dashboard_server_composition_contract.py and test_dashboard_server_composition_contract_reach.py (the arrival middleware's lazy import and its place in both chains), test_hooks_composition_contract.py (the shape digest, for run_script_hook's trailing admit=None), test_chat_runner_base_surface.py (_handle_workflow_command's admit=None), chat_test_helpers._make_app (the arrival middleware first, as in the servers), conftest.py (an autouse reset of stop_hold's process-wide records, as for the other process-wide registries, so one test's Stop never holds another test's key) and the chat-send tests whose _run_chat fakes list their keywords are updated for the reply's closing sentence, the new metadata key and the new keyword.

Manual verification

N/A: every path is covered through its real entry point. No live Slack workspace was used.

Related Issues

RFC: docs/request-for-change/rfc-slack-code-channels.md §3 "Stop" (#35935). Builds on the brake, #38243, as merged on main (its counts-only reply and its stop_helpers.stop_channel). Head 53fda2568da861a1dde44c1b2f19017d5d282a2c. Rebased onto #22370 as merged: its context bar's Create PR and Stop, its canvas comments and its view tabs are in the "Where it is asked" table.

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.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/hook_runtime/script_hooks.py

  • src/kiro_crew/sandbox_rlimit.py

  • No reasoning template for 53fda25 yet.

How to clear this check:

  1. The PR author posts the template below as a PR comment, with
    every field filled (N/A needs a reason). Keep the
    Head commit line: it must name the current head SHA.
  2. The check turns green within a minute, with no push.
  3. A new push resets this check: post it again for the new head.

Only the author's comment counts this way. A reviewer can instead
paste the filled template into an "Approve" review on this head.
Merging still needs a reviewer's approval.

## Sensitive change review
- Head commit: 53fda2568da861a1dde44c1b2f19017d5d282a2c
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 53fda2568da861a1dde44c1b2f19017d5d282a2c touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the Stop hold is one synchronous decision, read in the same span as each effect it guards, and it follows the rule RFC §3 records.

Notes

  • _FORCED_FULL_SAVES goes from 26 to 27, and the census comment says "until it lands the surface must not grow". The new site is pinned with expected_history_key and the unpinned count stays at 4, so the race the census guards against is covered. Even so, the PR description should cite Make the slot save merge-aware so a full save cannot erase a concurrent close #8361 and say why this growth is accepted.
  • admit now runs through sandbox_rlimit.create_subprocess_limited, the spawn_admit context variable, TaskRunner, WorkflowService and script hooks. That puts a gate owned by Slack code channels into layers shared by every caller. One generic "admission ask" seam would be easier to own long-term than a parameter added at each layer.
  • The description is cut off before ## Backwards compatibility, so I couldn't check the reader list against the code. The persisted stop_held key and the kwarg-only additions look additive.

[DESIGN-REVIEWED] 53fda25

Description read

[DESCRIPTION-READ] 42fe7d5a1c463aed97c7cab168b7bb9a4e592dec5904466acb85e35b26ea4fbf

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 53fda2568da861a1dde44c1b2f19017d5d282a2c — 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: PASS

Nothing blocks. The base RFC (partial, §3 "Stop", "What happens next") covers the hold, and its amendment notes "Nothing is built yet", so main did not diverge from it. Two mechanisms go beyond the Goal.

Notes

  • Item 7 — oversized: hold checks were added inside the hook-spawn layers below run_script_hook. By the description's own account, the window they close still stays open on Windows ("can still go out for it").
    Subtraction: remove admit from sandbox_rlimit.create_subprocess_limited, and remove spawn_admit/SpawnNotAdmitted from platform_compat_offloop_spawn.py. Keep the one check in run_script_hook after its last await.
  • Item 8 — rides along: stop_hold.run_local, _local and ENDABLE_LOCAL let a Stop cancel a KAS /context, /code or /knowledge command that is already running. That widens what Stop stops. The Goal is "nothing it stopped starts again".
    Subtraction: delete run_local, _local, ENDABLE_LOCAL and their cancel in press.

What this change ships

Inventory (9 items) — 7 justified

Intent: after pressing Stop in a Slack code channel, the owner wants nothing to start again until a person writes. This is an ADDITION (it builds the RFC's hold).

  1. After a Stop, the channel's session and its helpers start no turn by themselves (no nudge, patrol, wake or resume) — justified
  2. The Stop reply says "Nothing starts again until someone writes." — justified
  3. A person's Slack or dashboard message to a held session releases only that session — justified
  4. A peer's session_send to a held helper is queued and the tool reports held — justified
  5. The hold is saved on the slot's line (stop_held) and survives a restart; forced-save census goes from 26 to 27 — justified
  6. Helpers born of a held session start held; a channel session that registers later is held — justified
  7. Hook script spawns ask the hold inside the subprocess/off-loop spawn layers — oversized
  8. A Stop cancels a running KAS /context, /code or /knowledge command — rides along, outside the Goal
  9. /workflow and the task runner refuse to start a run for a held session — justified

[FIRST-PRINCIPLES-REVIEWED] 53fda25

Description read

[DESCRIPTION-READ] df5ed02d751aa4705f4dbfcc312774dcc0677818e301dfe8a18f99ba7a7f01a7

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 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 53fda2568da861a1dde44c1b2f19017d5d282a2c. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/slack/code_channels/stop_hold.py:434 -- Fence lazy-window hold saves against slot replacement

await save_slot_off_loop(state, slot, expected_slot_name=slot.key, **pin)
Trigger: Stop persists a helper with window_pending=True; before its worker acquires the transcript lock, the helper is closed, reopened under the same key, and renamed. persist → save_slot_off_loop → _save_slot_to_history supplies no expected_history_key, so close does not drain this worker; the empty-window merge also skips the identity check because refuse_stale_empty_merge is false.
Outcome: The detached slot’s metadata merge overwrites the replacement’s saved title with its old title, losing the acknowledged rename after restart.
Anchor: residual/crash-data-loss-corruption
Fix: Honor expected_slot_name under the empty-window merge’s lock independently of the stale-queue refusal opt-in.
Sites: src/kiro_crew/slack/code_channels/stop_hold.py:136 (first-ask persistence) and src/kiro_crew/slack/code_channels/stop_hold.py:270 (release persistence) reach the same save path.

[BLOCK-MERGE] 53fda25
[GPT-REVIEWED] 53fda25

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

The one finding was fenced, so there was nothing to rule on in the downgradable set. For F1 I kept the block in place (UPHOLD-FENCED) rather than flagging it for a human override.

F1 (fenced): I confirmed the mechanism at save_transaction.py:371-374. The empty-window merge only checks whether the slot was replaced (_replaced_refusal) when refuse_stale_empty_merge is set. The Stop-hold save at stop_hold.py:434 passes expected_slot_name without that opt-in, so the check never runs. The trigger needs a race: close, reopen and rename all land before the save worker takes the lock. I didn't confirm from code that close fails to drain this worker, and I found no step that recovers the overwritten title, so I can't make the rarity case a FLAG would need.

[ADJUDICATION] 53fda2568da861a1dde44c1b2f19017d5d282a2c total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 53fda2568da861a1dde44c1b2f19017d5d282a2c

[ADJUDICATION-FENCED] 53fda2568da861a1dde44c1b2f19017d5d282a2c fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/slack/code_channels/stop_hold.py:434 -- the empty-window merge skips the replaced-slot check unless refuse_stale_empty_merge is set (save_transaction.py:371-374), and the close/reopen/rename race is ordinary user activity, not a contradictory combination, so the silent title-loss claim stands.
[GPT-ADJUDICATED-FENCED] 53fda2568da861a1dde44c1b2f19017d5d282a2c

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

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 53fda2568da861a1dde44c1b2f19017d5d282a2c — this comment is updated in place on each push.

Review details

No findings. None of the six candidates holds up against the code.

[OPUS-REVIEWED] 53fda25

Verdict parsed from the review's SHA-scoped output markers for commit 53fda2568da861a1dde44c1b2f19017d5d282a2c.

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

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 53fda2568da861a1dde44c1b2f19017d5d282a2c newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 8 classified, 0 newly refused, 8 still allowed.
  • ubuntu-latest (platform posix): 8 classified, 0 newly refused, 8 still allowed.
  • windows-latest (platform windows): 7 classified, 0 newly refused, 7 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: The change adds a refusal outside the shell deny composite. After a Slack code channel's Stop, a turn, a queue drain and a script-hook spawn are all refused until a person writes. None of the three shell tiers is touched, so the 15 shell candidates can only show the composite is unchanged. The new refusals are an admission gate that nothing could classify, and they are named under UNADJUDICATED below. No regression is confirmed, and no gap could be shown with a call path.

TIGHTENING: a hold after a code channel's Stop, at turn admission and at script-hook spawn (stop_hold.queues / decide, run_script_hook(admit=...), create_subprocess_limited(admit=...), and the spawn_admit ContextVar asked on the off-loop worker thread right before Popen) -- the ONE threat it refuses is a stopped session or its helper agents starting work again before a person writes: "After a code channel's Stop, nothing it stopped starts again until a person writes.", and if not getattr(turn, "_agent_started", False) and stop_hold.queues(slot, getattr(turn, "_stop_hold_stamp", "")): return _end_held(turn) in turn_admission.py, plus if admit is not None and not admit(): raise SpawnNotAdmitted in sandbox_rlimit.py / platform_compat_offloop_spawn.py.

ADJUDICATED: 15 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: The rows cover posix and windows, with no any rows, because every row names an executable or a path. The diff's one platform-specific part is the Windows off-loop spawn: spawn_admit is read on the loop and asked on the worker thread, and IS_WINDOWS with windows_cleanup_owner takes the legacy-path admitted() branch. So each script-hook command, spec-hook command, test run and status check is written twice: once in posix spelling (python3, /, "$VAR") and once in Windows spelling (.exe names, \ separators, %VAR%). Those rows go through the shell composite, though, not through the admit callable. Which platform's spawn path gets refused is decided by the hold itself, and no row can reach that.

UNADJUDICATED:

  • Guard: stop_hold.decide / queues / gate / held_now, and the admit callable passed into ScriptHookStore.fire → run_script_hook → create_subprocess_limited (POSIX shim loop and legacy path) or make_subprocess_transport_off_loop.build (Windows worker thread).

  • Call paths:

    • Slack: events._on_event (reads seen()) → route_gate._route_to_slot(stop_hold_stamp=...) → the queued entry's meta["stopHoldStamp"] → _turn_admit (asked twice: before the first await and before the session claim) → _turn_dispatch_gates.gate (a hold is released here) → write_gate under the transport write lock.
    • Dashboard: stop_hold_arrival_middleware (outermost) → http_stamp(request) → run_kwargs → _run_chat(_stop_hold_stamp=...).
  • Legitimate inputs I would have submitted:

    1. A dashboard user's chat send to a held session. http_stamp gives a stamp only when is_dashboard_user is True and neither internal_auth nor app is set. An owner sending from an app-hosted chat (ctx.chat_slots.open) or through an MCP tool on loopback therefore gets no stamp and stays held.
    2. A person's message sent after a gateway restart. restore seeds the key at press 0 under a new BOOT, so any person's stamp from the new boot releases it. But a queued entry stamped before the restart carries the old boot and never releases the hold. That entry may still be a person's legitimate request, made before the Stop.
    3. A wake, a peer send (including the channel's own session), a cron nudge or a resume into a held helper. These carry no stamp by design and return QUEUED_TEXT, and only a person's message to that helper releases it.
    4. A stored stop-event or postToolUse script hook for an unrelated session. Whether it is held depends on the admit the caller passes, and I could not trace every fire(...) call site to confirm the callable is scoped to the held session's key.
    5. Local / commands other than /context, /code and /knowledge (ENDABLE_LOCAL). These are not cancelled, but _turn_slash_gate asks first, so a held /clear sent by a person with an older stamp is refused.

    None of these is a shell command line, so the classifier can't give a verdict on any of them, and none counts as a demonstrated gap.

[SCOPE-REVIEWED] 53fda25

@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from e472a38 to 4ab67cb Compare November 18, 2026 03:14
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from 4ab67cb to bb30a25 Compare November 18, 2026 07:38
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch 2 times, most recently from cc4735e to ad078e9 Compare November 18, 2026 10:15
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from ad078e9 to dee3673 Compare November 18, 2026 15:11
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from dee3673 to 0d49cff Compare November 18, 2026 19:29
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 18, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from 0d49cff to 2c306bd Compare November 18, 2026 20:35
@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 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from 2c306bd to 6ba5919 Compare November 18, 2026 22:25
@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 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/code-channel-stop-hold branch from 6ba5919 to 53fda25 Compare November 19, 2026 01:15

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

readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant