Skip to content

feat(subagents): per-chat agent-queue priority (low/medium/high) - #15543

Open
Pearcekieser wants to merge 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/agent-queue-priority
Open

Pearcekieser wants to merge 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/agent-queue-priority

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let each chat set its agent-queue priority to Low, Medium or High, so an urgent chat's sub-agents start first when spawns have to wait.

When the gateway is at its sub-agent cap, new spawns wait in a queue. Today every chat gets an equal turn in that queue (round-robin across chats, FIFO inside one). There is no way to say "this chat matters more right now": a long background sweep in one chat delays the spawns of the chat the person is actively waiting on, and a low-value chat competes on equal terms with everything else.

Why it matters

People run many chats at once, and the sub-agent cap is often the bottleneck. Without a priority knob the person has to stop or close other chats to get one chat's work through. A per-chat tier lets them push one chat forward, or park a background chat behind everything else, without touching anything that is running.

Not a goal

  • Preempting or pausing sub-agents that are already running. Priority decides which WAITING spawn starts next, nothing more.
  • Aging or anti-starvation for the Low tier. Low means "after everything else"; a busy High chat can hold Low spawns back indefinitely.
  • An MCP tool or agent-settable priority. Only the dashboard owner can set it.
  • A sidebar badge for non-default tiers.
  • Tiers on a gateway with Shared Crew admission on. Its lane resolver files a session under the person whose turn ran last, so a chat's tier would move to that person's whole lane. Per-person tiers are Agent-queue tiers under Shared Crew (per-person lanes) Pearcekieser/KiroCrew#67.

What changed (motivation → approach → change)

Piece What it does
Priority tiers in taskq/lanes.py A pick only considers the waiting chats in the highest tier present; the existing weighted round-robin runs inside that tier
SubagentManager.set_lane_priority_source The dispatcher asks the dashboard for each chat's tier on every pick and every store refill
PATCH /api/chat/slots/{slot}/queue-priority Sets a chat's tier; owner-only. The tier is kept in gateway memory only, so every chat starts at Medium after a restart
Session menu → Sub-agent priority Radio submenu with High, Medium (default) and Low, under a short caption saying what the tier does
Area Change
src/kiro_crew/queue_priority.py, src/kiro_crew/taskq/lanes.py the tier names in a leaf module (so dashboard imports stay free of the task store); LaneScheduler.priorities and the tier filter in pick
src/kiro_crew/subagent_manager/ fairness.py lane_priorities() feeds both scheduler balances (taskq_bridge.py), and the refill fetch brings higher-tier lane heads into the dispatch window first
src/kiro_crew/subagent_parts/ set_lane_priority_source (config_surface.py, bound in manager.py, listed in admission_surface.py)
src/kiro_crew/dashboard/ state.py slot field + lane_queue_priorities; chat_handlers.py route; routes/chat.py, chat.py registration; slot_projection.py row field
website/src/components/ QueuePrioritySubmenu.tsx, SessionActionsMenu.tsx (the radio items ui/context-menu.tsx already exports)
website/src/hooks/, website/src/api/, website/src/types/ useSessionActions.ts setQueuePriority; chatOrganization.ts setSlotQueuePriority; index.chat.ts QueuePriority, re-exported by index.ts
website/src/i18n/ four submenu strings in all 12 locales (locales/*.json), translator context for "Low" (en.context.json)
website/src/test/ stubRadioMenu.tsx radio-menu stand-ins for happy-dom; ApiClient.refactor.surface.test.ts key order
docs/ system-specs/modules/taskq.md, system-specs/modules/subagent.md, feature-map/README.md
temp-screenshots/agent-queue-priority/ evidence PNGs (fork PR, committed per the template)

The queue already groups waiting spawns into one lane per chat, and a sub-agent's own spawns inherit the lane of the chat that started the tree. A tier per lane is therefore the smallest change that turns the existing fair queue into a priority queue: LaneScheduler.pick keeps only the contending lanes of the top tier, and lower tiers neither win nor gain round-robin credit while a higher tier has work. Tiers apply to root picks only: a pick under the child reserve, and the children-only refill that feeds it, ignore them, so a High chat can never hold back the child an already-running tree is waiting on. With every chat at Medium the order is exactly today's.

Strict tiers were chosen over larger lane weights because weights only change the share, so a Low chat would still take regular turns, which is not what "Low" promises. The tier is pulled from the dashboard on each pick (DashboardState.lane_queue_priorities, keyed by the session each chat's turns run on) instead of being pushed into the manager, so a restored, forked or closed chat cannot leave a stale entry behind. A failing source reads as all Medium.

The route refuses app and crew-member callers with 403 before it looks the slot up (so the answer does not reveal whether a chat exists), because a tier reorders other chats' waits and an agent must not raise its own chat above the person's. The value is validated against the three names and stored in memory per session (DashboardState._session_queue_priority, keyed by the session the chat's turns run on), written for every live session on the chat's dispatch lane. Each read maps the sessions to their current lane, so every slot on a lane reads the same tier, including a slot that joins later. With no Shared Crew lane resolver installed, a lane is one session or system, so a tier is exactly per chat. While Shared Crew admission is on, chat tiers are off: the resolver files a session under the person whose turn ran last, so a stored tier would rank that person's whole lane. The dashboard then reports no tier for any lane, every row carries queue_priority: null (the menu entry is hidden), and the route answers 409 queue_priority_shared_crew and stores nothing. The tier is projected on the slot row and the one-row slot patch. A cron- or hook-bound chat has no tier, judged from its session key alone. A cron- or hook-bound chat: its row carries queue_priority: null, the menu entry is hidden, and the route answers 409 queue_priority_system_lane. lane_queue_priorities reports only lanes that still have a live slot. Each PATCH also drops the stored tiers of sessions with no live slot, so the map never holds more entries than there are live slots plus the one being set. No tier is written to or read back from the chat's metadata line, because that line is a file the agent's own tools can write. A restored tier would let a prompt-injected agent move its own chat past the owner-only route: plant High, or rewrite an owner's Low to Medium and wait for a crash restart. This is the same rule jev_route follows. After a restart every chat is back at Medium, and the submenu caption says so. The submenu stays open after a pick, so the moved check and any error notice are visible. The menu is not optimistic. It sends one PATCH at a time per chat, so the server applies picks in order, and the row moves only when the gateway's queue_priority slot patch arrives, which the route pushes to every live slot of the lane once the tier changes. There is no local tier to roll back or reconcile, so an older request, another dashboard's pick or a lost answer cannot put a stale tier on the row. A failure shows an in-menu ErrorNotice with its agent hand-off (a separator keeps the hand-off apart from the tiers), which carries the request's report (endpoint, status and error code), and localized lines, never the gateway's English error text. A gateway refusal (any 4xx, all answered before the route writes) says "The priority wasn't saved. Try again." A 5xx, which a proxy can return after the gateway applied the pick, or a transport failure may have committed, in which case the slot patch still moves the row, so it says "Priority not confirmed" / "The gateway didn't answer. Pick the priority again to make sure it's saved." Only the slot's latest pick may show a notice, so an older failure never contradicts a newer pick. The system lane (cron, hooks, heartbeat) has no chat to raise, so the tier filter never drops it: it takes part in every tiered pick and keeps its weighted share beside the top tier, so a High chat that keeps spawning delays waiting automation by at most one round. That bound is about picks among rows already in the dispatch window. Which rows are in the window is main's unchanged refill: with a window of one row, the child-only refill can replace a cron root with any chat's nested child on each pass, with or without tiers. Against Low chats alone it still ranks Medium. The dispatch-window refill fetches the absent lanes' heads in tier order, so a High lane's head enters the window before a Low one's. Each refill reads the lane tiers once and hands that one mapping to the fetch. While a root slot is free, the child-only refill that follows fetches the same way; it runs untiered only when the free capacity is reserve-only. The refill eviction stays tier-blind, exactly as on main: it takes spares first and then a lane head, whatever the tiers. A tier-aware eviction was tried in earlier rounds and removed, because keeping higher-tier entries let a High backlog evict the only windowed cron head on every pass. The cost is that, when more lanes wait than the window has places (64 by default), a High root can start one refill late. The per-lane memory share (lane_share_holds) holds a start back only for a waiting lane on the same or a higher tier, or for the system lane, which has no tier, so a High chat's start never gives way to a Low chat's memory wait but still gives way to a waiting cron or hook spawn. The submenu sits in the bottom group directly above "Turn time limit", the other run-behaviour submenu. The feature map row and the taskq.md / subagent.md specs describe the tiers.

Backwards compatibility

Compatible: the default tier is Medium, and with every lane at Medium the dispatch order is unchanged. Older transcripts carry no queue_priority key, and a key written into one is ignored. The slot row gains one optional field.

Tests

  • test/test_fairness_lanes.py: with no child reserve, a dispatch window of 2, a High backlog and a queued nested child, a waiting cron spawn still starts before the High backlog drains; tier names normalize (unknown → Medium); the top tier wins every pick and lower tiers accrue no credit; weighted round-robin still runs inside a tier; no priorities equals today's round-robin; the refill interleave puts a High lane first; an untiered pick ignores priorities; under the child reserve a High chat does not take the reserve every pass; the system lane keeps its share beside a High chat and still ranks Medium against Low. Through the real manager and task store: spawns queued Low, Medium, High start High, Medium, Low; with three High spawns queued, a fresh cron spawn starts in the first round while a Medium chat still waits (this is that test's setup, not a general bound: taskq.md notes that a High lane can take up to 17 starts before the next automation grant, depending on the credit system carries); a change reaches the next pick; a failing source keeps FIFO; lane_snapshot reports each lane's tier.
  • test/test_chat_queue_priority.py: the route sets each tier without saving the transcript and the lane map sees it at once; a pick applies to every slot on the session and patches each; a slot that joins the session later (minted with a link, linked afterwards, or rehydrated) reports the session's tier; a cron-bound chat gets 409 queue_priority_system_lane and serializes queue_priority: null; lane_queue_priorities drops lanes with no live slot; with a Shared Crew lane resolver installed, a High tier set on a channel chat never reaches the lane of the next person who posts there (the source reports no lane and the row is null), the route answers 409 queue_priority_shared_crew and stores nothing, and a non-owner still gets 403 first; reports and audits no-op changes, rejects bad values (including "HIGH", bools and lists), 404s an unknown slot, and 403s app, non-owner and crew-member callers; nothing is written by a save and every restore starts at Medium; a tier written into the transcript is ignored; the dashboard installs itself as the source.
  • test/test_chat_slot_facade_contract.py: the projected slot row carries queue_priority.
  • test/conftest.py: the autouse fixture that clears an inherited Shared Crew admission service also clears the lane resolver that service installs, so a test that leaves one behind cannot turn tiers off for later tests on the same worker.
  • test/test_json_object_body_guard.py: the new route's body read is registered with the default cap for bounded control fields.
  • website/src/components/QueuePrioritySubmenu.test.tsx: both menu families show the caption and list the three tiers, Medium is checked when unset, a pick is reported, every pick is sent once, including the tier that is checked, the failure notice carries the agent hand-off described by the notice, and a given heading replaces the failure title. SessionActionsMenu.cov80.test.tsx: the entry sits directly above Turn time limit and is hidden for queue_priority: null.
  • website/src/hooks/useSessionActions.cov80.test.tsx: a pick is sent to the server and the row follows the gateway's slot patch, a refusal shows the localized retry line rather than the gateway's text and leaves the row, a transport failure says the priority is not confirmed, a refusal keeps another dashboard's slot patch, a refusal after a lost answer and a later save keeps the saved tier, and an older failure says nothing once a newer pick is in flight; picks for one chat are sent in order; a failure is exposed for that chat and cleared by the next success. QueuePrioritySubmenu.test.tsx renders the error notice and hand-off item only when given an error, and a pick keeps the menu open.
  • test/test_channel_slots.py: a re-surfaced channel chat whose metadata names Low or High starts at Medium.
  • website/src/components/SessionActionsMenu.cov80.test.tsx: the menu shows the slot's tier and wires the pick to that slot.

Manual verification

On an isolated gateway built from this branch (kiro_crew.testing.harness.spawn_feature_gateway("minimal")), right-clicked a chat, opened Sub-agent priority, and picked High. The PATCH answered 200 {"ok": true, "queue_priority": "high", "changed": true}, the reopened submenu showed High checked (aria-checked="true"), and GET /api/chat/slots returned queue_priority: "high" for that chat and "medium" for the others.

Screenshots / video

Right-click menu on a chat, default state (Medium checked):

Sub-agent priority submenu, Medium checked by default

After picking High:

Sub-agent priority submenu after picking High

A refused pick: the menu stays open, Medium stays checked, and the notice shows the localized retry line with the agent hand-off.

Sub-agent priority submenu after a refused save

A pick whose PATCH got no answer shows the same notice with the title "Priority not confirmed", and the previous tier stays checked until a slot patch says otherwise.

The first two stills were rendered from 75d2181e71 and the refused-save still from 920771b, all with stubbed API responses and show the shipped caption "Higher-priority chats' waiting sub-agents start first. Resets to Medium on gateway restart."

Related Issues

no linked issue: feature requested directly by the maintainer's team.

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

Follow-ups

Review items deferred from this PR, one issue each:

@Pearcekieser
Pearcekieser requested a review from a team September 30, 2026 19:00
@Pearcekieser
Pearcekieser requested a review from a team as a code owner September 30, 2026 19:00
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: Let the dashboard owner give each chat a Low, Medium or High agent-queue priority, so that when sub-agent spawns queue at the cap, a higher-tier chat's waiting spawns start before a lower tier's, with today's round-robin kept inside a tier.
Not a goal: preempting running sub-agents, anti-starvation aging for Low, agent-settable priority, or a sidebar badge.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Sep 30, 2026
@Pearcekieser
Pearcekieser force-pushed the feat/agent-queue-priority branch from 8c0a8a2 to 0aaeb5e Compare September 30, 2026 20:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Pushed 0aaeb5ec58, which fixes the three Windows backend reds on 8c0a8a2f27. All three came from this PR:

  • test_error_code_contract: the new route's 404 had no code; it now answers slot_not_found.
  • test_dashboard_handlers_lazy_tasks: the dashboard imported the tier names from kiro_crew.taskq, which loads the task store. The names now live in the leaf module kiro_crew/queue_priority.py, which taskq/lanes.py re-exports.
  • test_json_object_body_guard: the route's body read now has its cap row (default cap, bounded control fields).

The queued runs on the old head could not be cancelled from the fork; please ignore them.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of baf22c52d06018151ea57806b45f0a003ecb059b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

No blocker found. The screenshots show every added control and state, but no first-time reader has seen them, because this fork lane has no blind read. A maintainer can push the branch to this repository to get one.

Notes

  • Two committed images, menu-save-failed.png (attachment-06) and menu-unconfirmed.png (attachment-07), have no separator between "Ask the agent" and "High". The code puts a <Separator /> there, and attachment-03 shows it. Re-capture both so the evidence matches the shipped menu.
  • The caption and the error line both use "gateway": "Resets to Medium on gateway restart" and "The gateway didn't answer." Check that word against the product's other user-facing copy. If it isn't used there, write "Resets to Medium when Kiro Crew restarts."

[UX-REVIEWED] baf22c5

Description read

[DESCRIPTION-READ] 91dbd1b5d9391f5f769e5b1e5ad34855a8d04d5bd1bd04495839073f37ad2506

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of baf22c52d06018151ea57806b45f0a003ecb059b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: tiers are off unless someone sets one, so the default pick order stays the same. The tier lives in memory only, which a revert or a gateway restart undoes completely.

Notes

  • The refill eviction ignores tiers, so a High chat's first start can come one refill late. Both specs say so (taskq.md and subagent.md); the risk stays small only while the window holds more places than there are waiting lanes.

[DESIGN-REVIEWED] baf22c5

Description read

[DESCRIPTION-READ] 64039ee66be44fd5a5168deb209ad699af14e862e76f7555046d005b53ac5ec9

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of baf22c52d06018151ea57806b45f0a003ecb059b via the fork AI-review pipeline — 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. Every chat defaults to Medium, so dispatch order stays the same unless the owner picks a tier. Two small surfaces are second spellings or have no consumer outside the module.

Notes

  • Item 9 — duplicate of slot_directory.queue_lane_of: chat_handlers.py adds a nested def queue_lane_of ("Same mapping as slot_directory.queue_lane_of"), so the patch defines it twice (grepped def queue_lane_of, 2 hits). Subtraction: delete the nested copy and call the one slot_directory copy through a DashboardState binding, as queue_priority_of already does.
  • Item 10 — zero consumers: queue_priority.normalize_queue_priority is public, but its only non-test caller is priority_rank in the same module (grepped, 1 internal hit plus 1 test). Subtraction: fold it into priority_rank as a private step.

What this change ships

Inventory (10 items) — 8 justified

Intent: let the person push one chat's waiting sub-agent spawns ahead of others, or park a chat behind them, when spawns queue at the cap. ADDITION.

  1. Session menu gains a "Sub-agent priority" submenu (High / Medium / Low) — justified
  2. High-tier chats' waiting spawns start before Medium, and Medium before Low, on free root slots — justified
  3. Child-reserve picks ignore tiers — justified
  4. Cron and hook spawns keep their share beside the top tier — justified
  5. The memory-share hold ignores waits from lower-tier lanes — justified
  6. Store refill brings higher-tier lane heads into the window first — justified
  7. Tier is in memory only, so a restart resets every chat to Medium — justified
  8. Picker hidden, and the route answers 409, for cron/hook chats and while Shared Crew is on — justified
  9. Second inline copy of the session-to-lane mapping in the route — duplicate of slot_directory.queue_lane_of
  10. New public normalize_queue_priority — zero consumers

[FIRST-PRINCIPLES-REVIEWED] baf22c5

Description read

[DESCRIPTION-READ] 7fd1917daa223e208eb6f5174ad8a1f7f0e4115fe8f82bc5782c676f2f6d0f87

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings (all downgraded on adjudication)

Reviewed baf22c52d06018151ea57806b45f0a003ecb059b via the fork AI-review pipeline; updated in place on each push.

Opus 5.5 adjudication downgraded every blocking finding. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

Review details

BLOCKING -- src/kiro_crew/subagent_manager/admission/taskq_bridge_window.py:151 -- Child-only refill repeatedly displaces High roots with Low children

tiered = not children_only or self.capacity_view().root_slot
Trigger: With dispatch window 1, cap 2 and child reserve 0, a Low parent remains running while a High root and Low children queue. _drain_queue_pass_impl runs normal then child-only refills; _refill_make_room evicts the High root, and the child-only fetch excludes it.
Outcome: Each freed slot starts a Low child instead of the eligible High root. This repeats across the Low-child backlog, defeating the owner's priority—not merely delaying High by one refill.
Anchor: defect
Fix: Make tiered refills compare resident and incoming lane priorities before eviction; preserve untiered child hydration when capacity is reserve-only.

[BLOCK-MERGE-DOWNGRADED] baf22c5
[GPT-REVIEWED] baf22c5

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

F1 — LOW harm, and it needs a non-default config. The High root is only evicted when the window is full with no spare entry: the eviction count is computed at taskq_bridge_window.py:206-208 and the head is dropped at :492-494. The child-only refill counts a lane as absent when only a root sits in the window (:181). pump.py:286-287 runs both refills on every pass. With the default window of 64 (taskq/store.py:113), the extra entries from the Low-child lane are evicted first (:489-491), so this needs a tiny agent.task_dispatch_window or more than 64 lanes at once.
Recovery: the High row is never lost. Each normal refill brings it back first (the tiered fetch), and it starts as soon as the Low-child backlog drains or the window stops being saturated. The cost is a visible delay in priority order, with no data loss. The spec already documents the tier-blind eviction as a known gap.
The real fix is a tier-aware eviction that compares the priority of the resident entry with the incoming lane's, while keeping the reserve-only hydration untiered. That adds a new ordering contract to the eviction loop that only serves this rare saturated-window case, which costs more than the harm it prevents.

[ADJUDICATION] baf22c52d06018151ea57806b45f0a003ecb059b total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/subagent_manager/admission/taskq_bridge_window.py:151 reason=disproportionate-remedy
[GPT-ADJUDICATED] baf22c52d06018151ea57806b45f0a003ecb059b

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Vocabulary collision with queued composer prompts (span=cd200de6be8a)

fixed in 7070b2a: the submenu is now labelled "Sub-agent priority" in all 12 locales, so it no longer shares the word "queue" with held composer prompts.
The API field and route keep queue_priority; only the user-facing label changed.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Refused pick reverts silently (span=b62b805b1a3c)

rebutted: the only refusal the route makes is owner_only (app, crew-member or non-owner caller), and the session menu is the owner's own dashboard, so the owner cannot reach it from this surface.
A transport failure is already reported by the dashboard's gateway-offline surface; the reverted check mark is what the next open shows. A per-menu error notice for an unreachable branch is not proportional.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Pick gives no acknowledgment when nothing is waiting (span=d9a202488019)

fixed in 7070b2a: the submenu opens with a one-line caption ("Waiting sub-agents from High chats start first, then Medium, then Low."), and the picked tier is the checked radio item on every reopen.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Rename the label or add a caption (span=cbbc9fc5f7e4)

fixed in 7070b2a: both, the label is "Sub-agent priority" and the caption line sits above the three tiers. Screenshots in the body are recaptured on this head.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • High chat also holds the system lane back (span=d9b9e282f905)

fixed in 7070b2a, by the first clearing option: taskq.md and subagent.md now state that the system lane (cron, hooks, heartbeat) is always Medium, so a High chat with spawns waiting goes ahead of waiting automation until its own queue drains.
This is the intended meaning of High: the owner asked for that chat first. Nothing changes for a gateway where every chat stays Medium, which is the default.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Pin SYSTEM_LANE to the top tier (span=f2482d47493c)

rebutted: exempting the system lane would let any scheduled job outrank the chat the owner just marked High, which inverts the control the PR adds. The behaviour is documented instead (see span d9b9e282f905), and a maintainer who wants automation exempt can say so; it is a one-line change in LaneScheduler.pick.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed baf22c52d06018151ea57806b45f0a003ecb059b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] baf22c5

@Pearcekieser
Pearcekieser force-pushed the feat/agent-queue-priority branch from 0aaeb5e to 7070b2a Compare September 30, 2026 22:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in modules this PR imports (acp/, adaptive/controller.py, resource_status.py and their tests) since 0aaeb5ec58 was pushed (c1a02ce9 -> current main); CI re-running. The same push carries the UX/Design dispositions above (label "Sub-agent priority", caption, system-lane note) and re-triggers the incomplete fork GPT lane.

@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 30, 2026
@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Priority is published before it is durable (span=78d6e248f252)

rebutted: this is a per-chat preference field, not an acknowledged content write. It follows the same dirty-plus-push convention as its closest sibling api_chat_slot_color, and the 5 s periodic flush makes it durable.
A crash inside that window restores the previously persisted tier, which the reopened submenu shows as the checked radio item; no transcript or user data is involved. The adjudicator downgraded it as disproportionate-remedy.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • No blind read on the fork lane (span=a027cb4c61cd)

needs-a-decision: the fork lane cannot run the blind read. A maintainer who wants the cold read can push this branch to the main repo; the label and caption are in the recaptured screenshots in the body.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Non-default tier visible only inside the submenu (span=1a9bc2edeb0f)

accepted as scoped: a sidebar badge is listed under Not a goal. The submenu caption says what Low means, and the tier is the checked item whenever the menu opens. A badge can follow if maintainers want it.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Successful no-op requests bypass SEL auditing (span=78d6e248f252)

fixed in 6447dbc: the allowed SEL event is now emitted for every authorized, validated request, changed or not; only the mutation, dirty flag and patch push stay behind if changed:. Test: test_same_value_reports_no_change_and_logs_allowed.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Re-surfaced channel chats lose their saved priority (span=1ce50744f47d)

fixed in 6447dbc: surface_channel_session restores queue_priority through normalize_queue_priority beside the pinned restore, so a re-surfaced channel chat keeps its tier and the next save writes it back. Test: test_channel_slots.py::...test_restores_persisted_queue_priority.

@Pearcekieser

Pearcekieser commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • ABA mutations can roll back a newer successful choice (span=a3f2266a57bf)

fixed in 6447dbc: each pick takes a per-slot generation in onMutate, and onError rolls back only when its generation is still the slot's latest, replacing the value comparison. A new hook test drives High (held), Low (ok), High (ok), then fails the first High and asserts the row stays High.

@Pearcekieser

Pearcekieser commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Channel-surfacing hydrator drops queue_priority (span=6ea1f40929bd)

fixed in 6447dbc: surface_channel_session restores queue_priority via normalize_queue_priority beside the pinned restore (same defect the GPT lane raised as span 1ce50744f47d). Test: test_channel_slots.py re-surfaced chat keeps high.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at a04aaf3, reserved for maintainer sign-off.

Our r131 items are answered. Each deferred item now has its own issue, Pearcekieser#59 to #64, linked in the description's Follow-ups section, and each one names the file and the fix. The UX note on the unconfirmed notice moved to #64. This head is a rebase of 20a5266 with the same patch apart from two en.context.json comma lines. Every check is green, all AI lanes pass, and the branch merges cleanly. The issues live on your fork rather than this repository; the maintainer who signs off should confirm that is acceptable.

What still blocks: the new owner-only PATCH /api/chat/slots/{slot}/queue-priority route decides who may reorder other chats' spawn waits, so a maintainer has to approve it. Our change request from 20a5266 can be dismissed when they do.

AI findings judged non-blocking:

I read the source and CI; I did not run any PR code.

— crew-pr-reviewer (r134)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Shared Crew automation loses its priority exemption (span=b5db0b49ab61)

fixed in ee93470. set_lane_resolver now takes the automation principal, and install_service passes AUTOMATION_PRINCIPAL.id, so lanes.is_untiered_lane matches principal:<automation id> as well as system while the resolver is installed. The tier filter in LaneScheduler.pick, _refill_evict_ceiling, the memory-share filter and slot_directory.queue_tier_exempt all use it. is_system_lane is unchanged, so main's system lane weight keeps its meaning. Tests: test_a_high_chat_never_holds_the_shared_crew_automation_lane_back, test_installing_shared_crew_marks_its_automation_lane_untiered and test_no_eviction_ceiling_while_the_shared_crew_automation_lane_waits in test_fairness_lanes.py, and test_a_chat_charged_to_the_automation_principal_has_no_tier in test_chat_queue_priority.py.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • With Shared Crew on, cron and hook spawns miss the tier exemption (span=8d1b4408b79b)

fixed in ee93470. set_lane_resolver now takes the automation principal, and install_service passes AUTOMATION_PRINCIPAL.id, so lanes.is_untiered_lane matches principal:<automation id> as well as system while the resolver is installed. The tier filter in LaneScheduler.pick, _refill_evict_ceiling, the memory-share filter and slot_directory.queue_tier_exempt all use it. is_system_lane is unchanged, so main's system lane weight keeps its meaning. Tests: test_a_high_chat_never_holds_the_shared_crew_automation_lane_back, test_installing_shared_crew_marks_its_automation_lane_untiered and test_no_eviction_ceiling_while_the_shared_crew_automation_lane_waits in test_fairness_lanes.py, and test_a_chat_charged_to_the_automation_principal_has_no_tier in test_chat_queue_priority.py.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • A sub-agent completion turn takes a chat's tier away under Shared Crew (span=420fdb4ad597)

fixed in 5637b1c. queue_tier_exempt now reads only lanes.is_automation_key on the session key, so a person's chat stays tierable after a turn charged to automation and a PATCH no longer answers 409. While the session's current lane is untiered, lane_queue_priorities reports nothing for it, so the automation lane every cron job and hook shares is never ranked, and the stored tier waits until the person's next turn binds the session back. queue_priority_of shows the chat's own tier meanwhile, and a pick in that state writes only the caller's session. Test: test_a_turn_charged_to_automation_keeps_the_chats_tier_dormant in test_chat_queue_priority.py. The four temp-screenshots/agent-queue-priority/*.png files stay: they are the fork-PR evidence the description lists.

@Pearcekieser

Pearcekieser commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Priority changes during refill let a lower-tier root start first (span=9cd791b15d8b)

deferred to the follow-up PR, not rebutted; the adjudication downgraded it on this head. It needs a dispatch window of 1 and a PATCH that lands inside the awaited refill, and the outcome is one start on the previous tier: the High root stays queued and the next pick reads the new tier. Re-reading the tiers after each awaited step and repeating the root refill on a change is tracked in Pearcekieser#66 and goes in the follow-up PR with #59, which touches the same refill path.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

The Fork GPT 6.1 Review lane never started for head 5637b1c, so PR Readiness still waits on it; it needs a re-run.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes (issue required) at 1edf1c9.

The Shared Crew fixes since our r134 read correctly. set_lane_resolver now marks the automation principal's lane untiered (admission_gate.py#L1711). A chat charged to automation for one turn keeps its stored tier, and that tier is dormant until the person's next turn. Opus and GPT have no blocking findings, and every check is green.

What blocks:

  1. A deferral without an issue. Your disposition on GPT span=9cd791b15d8b (comment) moves "re-read the tiers after each awaited step and repeat the root refill" to the follow-up PR "with Pearcekieser#59". #59 covers the system-lane eviction exemption, and it does not mention this. Add the item to #59's body, or open its own issue and link it in Follow-ups.
  2. Merge conflict. The branch conflicts with main again in website/src/i18n/en.context.json.
  3. Maintainer sign-off. The owner-only PATCH /api/chat/slots/{slot}/queue-priority route decides who may reorder other chats' spawn waits, so a maintainer has to approve it. That maintainer should also confirm that follow-up issues on your fork are acceptable.

AI findings judged non-blocking:

  • Design note: under Shared Crew a tier picked in one chat reorders all of that person's chats, and the caption does not say so. The description states the rule, so only the caption wording is missing. The maintainer may want to weigh this at sign-off.
  • Design note on _floor_fit_ids and First Principles item 6 (the eviction ceiling): you answered both, and #62 tracks the fold.
  • UX notes: attachment-07 is a stale screenshot, and "gateway" is a wording nit. Neither changes what a user sees in the code.

I read the source and CI; I did not run any PR code.

— crew-pr-reviewer (r137)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): reply to iamwhatever's r137 on 1edf1c9.

  1. The refill-snapshot deferral now has its own issue, agent-queue priority: re-read tiers across the awaited refill steps Pearcekieser/KiroCrew#66, which names taskq_bridge_window.py, the window-of-1 trigger and the fix (re-read the lane tiers after each awaited refill step and repeat the root refill on a change). It is listed in the description's Follow-ups, and the disposition on span=9cd791b15d8b links it.
  2. The conflict is gone: a175c09 rebases on current main. The en.context.json conflict was the usual append and keeps main's notes. Main had brought shared_crew/admission_gate.py to its 2000-line cap, so this PR no longer edits that file: lanes.set_lane_resolver now defaults the automation principal to AUTOMATION_PRINCIPAL.id when a resolver is installed, which keeps the Shared Crew automation lane untiered with no change on the admission side. 1855 backend tests, 373 frontend tests, tsc, gen:ui, i18n and the 24 pre-push gates pass locally.
  3. The owner-only PATCH /api/chat/slots/{slot}/queue-priority route, and whether follow-up issues on my fork are acceptable, still need a maintainer.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • An absent automation lane lets Medium displace High (span=9cd791b15d8b)

fixed in 8d78873. _refill_evict_ceiling no longer lifts the ceiling when an untiered lane is absent: a cron or hook lane ranks medium there, so a refill cannot evict a windowed High entry for it. Its head still competes by weighted round-robin for each window place a start frees, because absent lanes' heads are fetched first and the tier filter never drops an untiered lane. The head drop in _evict_for_lanes also ignored rank, which let a window of one Medium and one High head lose the High one; under a ceiling it now drops entries in tier order (held first, lowest tier up, untiered last), with the old spare and one-head rules inside each group. Tests: test_a_waiting_cron_spawn_never_lets_medium_displace_a_windowed_high (window 1, your trigger; fails 3 of 3 on the old ceiling) and test_a_tiered_eviction_drops_the_lower_tier_head_first (fails on the old head drop) in test_fairness_lanes.py. This also resolves Pearcekieser#59, so it is gone from Follow-ups.

resolution: removed -- the absent-untiered exemption in the eviction ceiling is gone and eviction under a ceiling runs in tier order

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes at e29fa44f9e69db21b4534d70e6295890d55d4910.

The r137 items are answered: the refill-snapshot deferral now has its own issue (Pearcekieser#66, linked in Follow-ups), and the branch merges cleanly with main.

What blocks:

  1. The tiered eviction drops a Medium head while cron and hook lanes keep spares. The Opus lane raised this on this head and I confirmed it in the code. Once any chat is at Low or High, _refill_evict_ceiling gives a Medium absent lane a ceiling of rank 1 (L269-L282). _evict_for_lanes then visits the groups in tier order and drops a head in the first group with no spare, before it looks at the untiered group, which sits last (L584-L616). With one Medium lane A in the window next to several system entries, A loses its only head while system keeps its spares, and the next pass does the same to the next Medium lane. Cron and hook spawns then hold most of the window, which breaks the rule the docstring states. Smallest fix: under a ceiling, look for a spare across every group first, and use tier order only to pick which spare goes, or which head goes when no group has one. Please add a test with this window shape.
  2. Maintainer sign-off. The owner-only PATCH /api/chat/slots/{slot}/queue-priority route decides who may reorder other chats' spawn waits, so a maintainer has to approve it. That maintainer should also confirm that follow-up issues on your fork are acceptable.

CI is still running on this head (Backend Tests, Frontend Tests, E2E and Build Desktop).

AI findings judged non-blocking:

  • First Principles item 6: the automation_principal keyword on set_lane_resolver is used only by tests. It is a simplification.
  • Design note: _floor_fit_ids is kept in sync at four sites. Pearcekieser#62 tracks folding it.
  • UX notes: "gateway" in the caption and a stale menu-save-failed.png. These are wording and evidence nits; the code renders the separator.

I read the source and CI; I did not run any PR code.

— crew-pr-reviewer (r145)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • A tiered eviction drops a Medium head while the system lane keeps spares (span=ac21bfe4dede)

fixed in 17d28b6ab7 by narrowing the eviction. _evict_for_lanes takes spares exactly as it did before the tier work: the youngest entry of the most-represented eligible lane, across every lane. Tier order now applies only when no lane has a spare, and then it chooses which head goes: an entry that cannot start now first, then the lowest tier, with an untiered lane counting as medium as it does in the ceiling. So the system lane gives up a spare before any lane loses its head, and a High head still never goes while a Medium head stays windowed. Test: test_a_tiered_eviction_takes_a_spare_before_any_head in test_fairness_lanes.py (one Medium head and two cron entries under a ceiling; fails on e29fa44).

resolution: narrowed -- spares are taken exactly as before the tier work; only the no-spare head drop follows tier order

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): reply to iamwhatever's r145 on e29fa44.

  1. Fixed in 7652e46. _evict_for_lanes takes a spare first across every lane, exactly as it did before the tier work; tier order now only chooses which head goes when no lane has a spare (an entry that cannot start now first, then the lowest tier, an untiered lane counting as medium). test_a_tiered_eviction_takes_a_spare_before_any_head in test_fairness_lanes.py has your window shape: one Medium head beside two cron entries under a ceiling. It fails on e29fa44, where the Medium head went.
  2. The same push regenerates the three turn goldens main added in test(dashboard): golden for a replayed chat turn and slot-list pass-work budgets #29304. They pin the slot rows of a turn, and every row now carries queue_priority: "medium"; that field is the only change in the fixtures.
  3. The owner-only PATCH /api/chat/slots/{slot}/queue-priority route, and the fork-hosted follow-up issues, still need a maintainer.

The First Principles note (drop the test-only automation_principal keyword) goes in the follow-up PR with #60 to #64 and #66.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Proxy failures misreport an applied priority as unsaved (span=a3f2266a57bf)

fixed in e3eca20 by narrowing the "not saved" claim. The notice now says "The priority wasn't saved" only for a 4xx: the queue-priority route answers every refusal (403, 404, 400/413/415, 409) before it writes, and nothing after the write can turn into a 4xx. Every 5xx, including a proxy 502/504 that lost the reply to a committed pick, and every transport failure now reads "Priority not confirmed", and the slot patch still moves the row if the pick landed. Test: reports a 5xx unconfirmed in useSessionActions.cov80.test.tsx (a 502 ApiError; fails on 7652e46); the "not saved" test now uses a 409.

resolution: narrowed -- "not saved" now only for a 4xx the route answers before it writes; every 5xx and transport failure reads as unconfirmed

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at 05b63af for a maintainer.

The eviction defect from our r145 review is fixed: _evict_for_lanes now takes a spare across every lane before any head, and tier order only picks which head goes when no lane has a spare. test_a_tiered_eviction_takes_a_spare_before_any_head pins that window shape. All checks are green and the branch merges cleanly.

What still needs a maintainer:

  1. The owner-only PATCH /api/chat/slots/{slot}/queue-priority route decides who may reorder other chats' spawn waits. A new route and admission rule are reserved for human review.
  2. The follow-ups are tracked one per issue, but on the author's fork (Queue priority: say in the caption that Low can wait while higher-priority work waits Pearcekieser/KiroCrew#60 to fix(build): pip --prefer-binary so backend deps install on Amazon Linux 2 #64 and ci: run stubbed E2E on PR via GitHub Actions #66). A maintainer should confirm that is acceptable or ask for them in this repository.

AI findings judged non-blocking:

— crew-pr-reviewer (r147)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • A chat's tier moves onto the lane of the next person who posts in it (span=420fdb4ad597)

fixed in 6442b0b by narrowing the scope: chat tiers are off while Shared Crew's lane resolver is installed (lanes.lane_resolver_installed()). With the resolver installed, lane_queue_priorities reports no lane, every row carries queue_priority: null so the menu entry is hidden, and the PATCH route answers 409 queue_priority_shared_crew and stores nothing; the owner-only 403 still runs first. A stored tier therefore never reaches a principal:<id> lane, so another person's turn cannot raise their lane. Without a resolver a lane is one session or system, so a tier is exactly per chat, as the goal says. The automation-lane code that only Shared Crew needed (is_untiered_lane, _AUTOMATION_LANE, the dormant-tier branches) is removed. Tests: test_a_channel_chats_tier_never_moves_to_the_next_persons_lane (fails on 9f406e0 with {'principal:q': 'high'}), test_with_a_resolver_the_route_refuses_and_stores_nothing, test_with_a_resolver_a_non_owner_still_gets_403_first. The body lists Shared Crew tiers under "Not a goal"; per-person tiers are Pearcekieser#67.

resolution: narrowed -- chat tiers are off while a Shared Crew lane resolver is installed, so no principal lane ever carries a tier

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Child refills repeatedly evict automation before dispatch (span=9cd791b15d8b)

removed in 6442b0b: the tier-aware refill eviction is gone. _refill_evict_ceiling, _refill_held_roots, the tier head-drop order in _evict_for_lanes and the _floor_fit_ids record are removed, so both the root refill and the child-only refill evict exactly as on main (spares first, then a lane head, whatever the tiers); _evict_for_lanes and _refill_make_room carry main's digests again, and gate.py, pump.py and admission_surface.py match main. A High backlog no longer makes the cron head the only evictable row. The tiered fetch that brings higher-tier lane heads into the window first stays. The cost, stated in the body and taskq.md: when more lanes wait than the window has places, a High root can start one refill late. Test: test_a_high_backlog_beside_a_queued_child_does_not_starve_a_cron_spawn (no child reserve, window of 2, a High backlog, a queued nested child and a cron spawn, through the real manager and task store; the cron spawn started last of 6 on fc8f9c4a0c and now starts before the backlog drains).

resolution: removed -- the tier-aware refill eviction is gone and eviction is tier-blind as on main

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Child-only refill defeats High priority while root capacity is free (span=9cd791b15d8b)

Acknowledged, no change: this is main's refill order, and the PR body names it as a limitation. Since 6442b0b the eviction is tier-blind. _evict_for_lanes and _refill_make_room carry main's digests, and pump.py runs the ordinary refill and then the child-only refill exactly as on main. A child-only fetch brings in only the nested rows of a running tree, so on main those rows take the window's last place from any waiting root, with or without tiers. The case needs task_dispatch_window below the number of waiting lanes (64 by default), and it clears once that tree has no queued children, as the adjudicator found. A tier-aware eviction across both refills is the mechanism this PR removed after six rounds on this span (resolution: removed on 9f406e0), so it stays out of this PR.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maintainer note on 8b23010. All 100 checks pass. This is a new user-facing feature (a session-menu submenu, a new route and a scheduler change), so I'm giving a design brief for the owner's sign-off rather than approving.

On the open change request from 11-04 (e29fa44): point 1 is gone with the design change. The refill eviction (_evict_for_lanes) is now tier-blind, so it no longer drops a Medium lane's only head while system lanes keep spares. Tiers act only on which waiting lane's head is picked and fetched first. Point 2, sign-off on the owner-only route, is what this brief is for.

Design brief:

  • What it does: each chat gets a sub-agent queue tier, High, Medium (the default) or Low. A pick considers only the waiting chats in the highest tier present, and the existing weighted round-robin runs inside that tier. The tier is set from the session menu through the owner-only PATCH /api/chat/slots/{slot}/queue-priority, which refuses app and crew-member callers with 403 before looking the slot up. It lives in gateway memory only, so every chat is Medium again after a restart.
  • Pros: a person can push one chat's sub-agents through, or park a background chat, without stopping other chats. With every chat at Medium, dispatch order is unchanged, and cron and hook spawns keep their place.
  • Cons: Low has no aging, so a busy High chat can hold Low spawns back indefinitely, which the PR states as a non-goal. Tiers are off under Shared Crew admission (issue #67 on the author's fork). The tier is forgotten on restart.
  • Tech debt: small. There is one leaf module (queue_priority.py), a tier filter in LaneScheduler.pick and a resolver hook. _floor_fit_ids is kept in sync at four sites, tracked in issue #62 on the author's fork. Follow-ups are tracked on that fork, not in this repo.

The sign-off is the owner's.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): one correction to the tech-debt line, for the sign-off.

_floor_fit_ids is no longer in the diff. It went out with the tier-aware refill eviction in 6442b0b, so admission/gate.py, admission/pump.py and subagent_parts/admission_surface.py match main again. Pearcekieser#62 is closed as not planned for that reason. The follow-ups still open on the fork are #60, #61, #63, #64, #66 and #67.

bolichen97
bolichen97 previously approved these changes Nov 11, 2026
Each chat can set its agent-queue priority from the session menu. When the
gateway is at its sub-agent cap, waiting spawns of a High chat start before
any Medium one, and Medium before Low; the weighted round-robin still runs
inside a tier. Nested spawns inherit the root chat's lane and so its tier.
Picks under the child reserve ignore tiers, and the system lane (cron, hooks)
is never filtered out by a tier.

- taskq.lanes: strict priority tiers above the weighted round-robin
- SubagentManager.set_lane_priority_source; DashboardState installs
  lane_queue_priorities (tiers stored per session key, in memory only)
- PATCH /api/chat/slots/{slot}/queue-priority (owner-only), projected on the
  slot row; never written to the transcript, so every chat is Medium again
  after a restart
- Tiers are off while Shared Crew's lane resolver is installed (409
  queue_priority_shared_crew, row reports null)
- Session menu: Sub-agent priority radio submenu, 12 locales
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/feature-map/README.md and 589 more shared paths since this head went green (73e3275 -> ab62492); CI re-running.

@bolichen97

Copy link
Copy Markdown
Contributor

Holding my approval on this one for now, and I have turned off auto-merge.

The work is careful and the scheduler change reads correctly. My concern is scope: per-chat sub-agent priority feels like a personal workflow knob more than something most users need, and it adds surface we would carry for a long time (the tiered flag threaded through every pick path, a tier that lives in memory and resets on restart, and a separate per-person design still owed for Shared Crew).

Before we take it, I would like to see the same need from more users. Thanks for sticking with all the review rounds.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 15% chance that this change introduces a defect, above the 12% limit for approving on its own.

I'd approve this PR as it stands, with moderate confidence. Each chat gets a Low, Medium or High tier, held in gateway memory only and settable only by the dashboard owner. The tier is applied only when a top-level (root) start is free. Starts under the child reserve ignore it, as does the children-only refill when only reserve capacity is free. The system lane (cron, hooks, heartbeat) is never filtered out by a tier, and with no tiers set the order is exactly main's. I traced every caller of the scheduler and the tier source. The tier snapshot is read on the event loop and passed explicitly to the refill fetch that runs on the task store's writer thread (via the *fetch_args forwarding). Lane keys match the parent_session_key that sub-agent spawns actually carry. Tiers are switched off while Shared Crew's lane resolver is installed, both on the route and in the source. Cron- and hook-bound chats are exempt. Tests cover the scheduler, the end-to-end dispatch through the real manager and task store, the memory share, the route's auth and validation, the absence of persistence, and the frontend hook and menu. CI tests passed; at decision time PR Readiness was still pending, waitin

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit b2b327800a · 2250 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

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

drive-to-green PR claimed by drive-to-green pipeline fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants