Skip to content

fix(studio): give a stale plan ask its own error code - #2311

Merged
kantord merged 1 commit into
mainfrom
studio-followups/01-stale-plan-ask
Oct 15, 2026
Merged

kantord merged 1 commit into
mainfrom
studio-followups/01-stale-plan-ask

Conversation

@kantord

@kantord kantord commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

The plan-ask route returned stale_run_control, the same code as a stale permission ask or run, so clients could not tell them apart. It now returns stale_plan_ask (still 409).

Part of #2303 ("Tiny follow-up fixes"); it does not close it. This is PR 1 of 14 in a stack of draft PRs, reviewed and merged in order.

What changed

  • stalePlanAsk() in apps/server/src/routes/chat.ts returns stale_plan_ask.
  • Tests and e2e mocks that encoded the old code for plan asks only are updated.
  • One service test pins the existing failed_precondition mapping as stale (the only generic failed_precondition on this path is a live run owning its plan continuation). It passes before and after; the route test is the regression guard.

Behavior changes

POST .../plan-asks/{askId} on a stale or consumed ask returns code: "stale_plan_ask". Steer, cancel and permission paths are unchanged. Studio's own web code does not branch on the plan code (it was only checked for steer and cancel).

API compatibility

This is the Studio BFF /api/v1 contract, not the daemon wire API. The wire-API rule is scoped by path (contracts/proto, internal/adapter/server, engine/*, sdk/typescript/src and others) and none of those change, so it is not triggered. The change is additive on an open string: code is z.string(), so the OpenAPI document and generated types are byte-identical. The only observable change is for an external BFF client that matched stale_run_control on the plan route.

Verification

Biome, typecheck, the full Studio test suite and pnpm generated:check pass on this branch, run on the assembled stack. The full Playwright suite passes on the stack tip (122 passed, 30 skipped, 0 failed, including chat-approval against a real mecated build). With the route code reverted, the plan route test fails.

Not included

Any change to permission or run codes, and the daemon wire API.

Fully or partially written by an AI agent.

🤖 Generated with Claude Code

The plan-ask route returned stale_run_control, the same code as a stale
permission ask or run, so clients could not tell them apart. It now
returns stale_plan_ask (still 409).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@kantord
kantord added this pull request to stack #2325 October 14, 2026 13:27
@kantord kantord changed the title studio followups/01 stale plan ask fix(studio): give a stale plan ask its own error code Oct 14, 2026
@kantord kantord mentioned this pull request Oct 14, 2026
41 tasks done
@kantord
kantord marked this pull request as ready for review October 15, 2026 08:41

@peppescg peppescg 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.

Thanks Daniel. A small change with a clear reason, and the e2e mock tells plan runs and ordinary runs apart instead of rewriting the code everywhere. LGTM.

@kantord
kantord merged commit 0e1ce3c into main Oct 15, 2026
55 checks passed
@kantord
kantord deleted the studio-followups/01-stale-plan-ask branch October 15, 2026 09:25
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants