Repository navigation
feat(platform): pause issue desk on NEEDS_HUMAN with a shared workflow sandbox - #2542
Merged
Merged
Conversation
Reuse one workflow-scoped sandbox across advise/execute/grade/dream and resume the same run via TaskReviewCard instead of ending at In review.
Review fixes for the NEEDS_HUMAN pause + workflow-scoped sandbox: - Seed-less variables namespace: config.variables lands under config.*, so `variables.planReviewRound == 0` was false on the FIRST NEEDS_HUMAN and the pause never fired (fell straight to the exhausted path). Guard every pre-bump read with `(… || 0)` and drop the misleading seeds. - Resume a hibernated session: re-claim the per-org slot through the FIFO ticket queue (new resumeWorkflowSessionSlot; a stopped row must not jump to cap+1), probe sessionIsAlive, and re-create against the preserved workspace when the spawner idle/TTL sweep stopped the container — resuming after a >35 min pause previously died on SessionNotFound and rolled the task back. - Hibernate on pause: a fresh task-review request stops the workflow-scoped session row so a paused run frees its org slot for the whole wait (scheduled from createTaskReviewRequest, not from the durable handler — a journaled step would break replay of in-flight paused executions). - Bound the judge's wrong_approach replan loop (bump_replan + replan_gate on maxReworkLoops) — it previously looped Advise+Execute+Grade until the workflow timeout. - Round-aware plan_review_decide + bump planReviewRound on approve so a stale approve can never auto-pass a later NEEDS_HUMAN cycle (request_review replays its recorded decision per (execution, step)). - Pre-clean the shared collect dir each fresh segment: a stale summary.md faked summaryWritten (masking laundered API errors) and a stale grade.json fed the judge the previous round's grade. - Keep the shared session alive through a step's budget-exhausted re-entry; drop the step checkpoint on the fail() and SessionNotFound-resume paths so same-slug re-executions start fresh. - Schedule completion teardown outside the wasTerminal gate so a pre-failed execution still releases its shared session. - advise_check/grade_check failure routes, execId-filtered getWorkflowSandboxOp (no cross-step op shadowing), `:@workflow` owner/hash suffix (a step slugged `workflow` collided), indexed checkpoint delete, gradeJson re-harvest after the summary re-entry, lint fixes, stale desk-implementer wording.
The `review` render kind mounts the interactive TaskReviewCard only
when the step output carries a `taskId`; request_review returned only
{approvalId, pending, responded}, so the desk's plan-review pause
rendered as a raw JSON dump under "Awaiting approval" instead of the
Approve / Request changes card. Ride the taskId along in the action
output.
The desk v2 workflow has mutually-exclusive variants of one concept — two plan-review gates (round 0/1), one dream step per judge verdict — and the run view rendered each as its own lane, so an execution showed "Review the plan: Done" next to "Review the plan: Up next" plus three "Capture lessons" twins for steps that will never run. Steps sharing a ui.labelKey now collapse into a single lane (dedupeSpineLanes in the shared step_display module): variants the run actually touched all show (both review rounds when both happened), and while none has run the first stands in as the lane's one upcoming placeholder. Steps without a labelKey keep their own lane.
Every lane showed two same-looking chips ("work" + "implementer") with
no cue that one is the pipeline stage and the other the acting agent
role. The StageTimeline breadcrumb already owns the stage dimension, so
the per-step stage chip only duplicated it; the role chip now carries a
bot icon so it reads as the step's actor.
… body After a human responds, the resumed step persists the recorded decision and TaskReviewCard (which only shows PENDING reviews) rendered nothing — an expanded "Review the plan: Done" lane showed an empty card. A responded gate now shows an Approved / Changes requested badge plus the reviewer's feedback; the pending path (interactive card / question fallback) is unchanged.
A task waiting on a human review had no affordance in the app's task table — the row where every other waiting state already gets its verb (Start for todo, Merge pull request for in_review). Reviews are the same kind of thing: a state with one obvious action. - listTasksByProjectPaginated stamps each row with `pendingReview` (one bounded org-level pending scan, extracted from getTaskOpsIndicators into a shared collectPendingReviewsByTask). - Connected tables learn effect-only actions (EffectActionSpec / EffectButton): a button that applies a declarative effect against the row instead of calling a function. - The desk view gains a "Review" action (`when: "pendingReview"`) that opens the task's detail overlay — the embedded run view where the pending review card (Approve / Request changes) already lives. Reaching the new view config in an installed org still requires an app Reinstall (bundle files are install-time snapshots).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The issue desk now runs its four phases — Advise → Execute → Grade → Dream — on one shared sandbox workspace per workflow execution (
sessionScope: "workflow"), and an ambiguous plan (NEEDS_HUMAN) pauses the same run for a human plan review instead of dead-ending at In review. Approve resumes implementation on the same workspace; Request changes sends feedback back to the advisor (two bounded rounds, then park for manual takeover).Mechanism
sessionScope: "workflow"reuse one deterministic session (wf-<exec>-…, owner<exec>:@workflow); per-step durable checkpoints (<session>::<step>); torn down byon_workflow_complete/ user Stop (owner-range sweep).request_reviewapproval gate (idempotent per execution+step); the engine parks onawaitEventwith no timeout.stopped, freeing its per-org workflow slot for the whole wait (scheduled fromcreateTaskReviewRequest, deliberately not a journaled engine step — that would break replay of in-flight paused executions).resumeWorkflowSessionSlot; a hibernated row must not jump to cap+1), thensessionIsAlive→sessionCreatere-attaches the preserved workspace when the spawner's idle/TTL sweep reclaimed the container mid-pause.summary.md/grade.jsonwould fakesummaryWritten/ feed the judge old data); step checkpoints dropped on every terminal path so rework/replan re-executions of the same slug never resume a dead exec; the judge'swrong_approachreplan loop is bounded like the rework loop.Notable review fixes folded in (the branch's original commit had these):
variables.*is only populated byset_variables— the unguardedvariables.planReviewRound == 0gate meant the pause never fired (first NEEDS_HUMAN fell straight to the exhausted path); round-aware decide + approve-side round bump so a recorded approve can't replay into a later NEEDS_HUMAN cycle; budget-exhausted re-entry no longer destroys the shared workspace.UI
ui.labelKeycollapse into one spine lane (no more "Review the plan: Done" next to "Review the plan: Up next" + three "Capture lessons" twins).when: "pendingReview", new effect-only action primitive) opening the task detail overlay — same column and pattern as Start / Merge pull request.Verification
:@workflow), the pause graph + replan bound +(… || 0)guards,dedupeSpineLanes, review-panel outcome states,collectPendingReviewsByTask, effect-action discrimination. Targeted suites green (server 2223 + tasks 1073 + UI 41/85); fullserver+piirun has 13 failures in known-flaky convexTest suites (SCIM/conversations/slack/cancel-codes) that pass in isolation and touch nothing in this branch..git+.desk/plan.mdintact) → implementer continued per the plan without re-cloning.Notes for operators
Installed apps snapshot their bundle at install time — picking up the new workflow/view/agents requires an app Reinstall (env/secrets survive; per-agent runtime overrides currently don't — known gap, tracked separately).
Done checklist
pendingReviewis computed)aria-hiddenicons, AA badges:workflowowner refs,resumeStoppedSessioncallers, action-spec consumers, stage-chip surfaces