Repository navigation
Backlog
Labels
enhancementNew feature or requestorchestrationTask lifecycle, REST API handlers, orchestrator Lambdas, durable execution
Description
Problem
Step 1b of reconcileTerminalChild (cdk/src/handlers/orchestration-reconciler.ts) moves a failed child's issue back and replaces its reaction. Since #1084 a try that did not land inside the settle window leaves a mark on the child's row (unsettled_task_id), and the next write on the task record tries once more.
The step can only read two booleans, and they say less than it needs:
revertStateanswersfalsewhen the request failed and when there was nothing to move (revertIssueToNotStarted,cdk/src/handlers/shared/linear-feedback.ts). A state call that failed alone is therefore not owed.replaceIssueReactionanswersfalsewhen the tracker could not be reached and when a marker stayed that it could not remove (swapReaction, same file). After the window the step cannot tell an outage from a marker that will never go, so the late try is the last one, and an outage that outlasts it loses the settle.swapReactiontakes a failed read of the reactions for an item without reactions: it adds the wanted marker and answerstrue, with the agent's marker left beside the new one.- The markers are matched by emoji alone, so the swap also tries to delete a person's own reaction with a marker emoji. The Channel contract says "A human's reactions are never touched" (
cdk/src/handlers/shared/orchestration-channel.ts). If Linear refuses that delete (not verified on a live workspace), the swap answersfalseon every try for such an issue: it is marked, and the late try moves the issue back once if a person has taken it over.
All four were reproduced in the review round of #1084 with the real handler and the real adapter against a stand-in tracker. For the fourth the stand-in refuses the delete; what Linear itself answers is not known.
Proposal
- Let
revertStateandreplaceIssueReactionreport that the tracker could not be reached or the token could not be resolved, apart from "nothing to move" and "a marker stays". Whether as a third answer or as a throw is to decide: every other caller ignores the answer.revertStatehas no other caller.replaceIssueReactionhas one,upsertEpicPanel(orchestration-rollup.ts), which calls it inside atrythat logs a warning. The comment swap sharesswapReactionwith it, and seven of its nine calls have notryof their own (linear-webhook-processor.ts,fanout-task-events.ts,replyToIterationCommentin the reconciler), so a throw out ofswapReactionitself would turn a best-effort marker into a handler error there. The Slack adapter implementsreplaceIssueReactionas well and answers a plain boolean. The reconciler does not reach it today (its registry tables name Linear and Jira only). The Channel contract has to say what a plainfalsemeans for an adapter that cannot tell. - In step 1b: mark the settle as owed when either call could not reach the tracker, keep the mark after a late try that could not reach it, and do not mark for a marker that stays.
- In
swapReaction: answerfalse, or the new answer, when the read of the reactions failed. - Delete only the application's own markers: read the reaction's user with the reactions and compare it with the token's own user, as
agent/src/linear_reactions.pydoes. Check on a live workspace first whether Linear refuses the application's delete of a person's reaction.
Acceptance criteria
- A state call that fails alone inside the window is retried by the next record of the task, also after the window.
- A late try that could not reach the tracker keeps the mark; one that reached it removes the mark whatever it changed.
- A person's own reaction with a marker emoji is neither deleted nor a reason for a mark.
- A swap whose read of the reactions failed does not answer
true: inside the window the settle is owed, and the next record removes the agent's marker. - No other caller of the reaction swap gets a throw or has to read the answer:
upsertEpicPanel(orchestration-rollup.ts),replyToStandaloneTrigger(fanout-task-events.ts), the comment handlers oflinear-webhook-processor.ts, andsettleRetryCommentandreplyToIterationComment(orchestration-reconciler.ts). What they do at the tracker changes in one point: a person's reaction with a marker emoji is left alone.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestorchestrationTask lifecycle, REST API handlers, orchestrator Lambdas, durable execution
Activity