Skip to content

Clear a plan failure once a newer plan generation supersedes it (APT-1207) - #40

Open
reoring wants to merge 12 commits into
mainfrom
fix/apt-1207-plan-failure-clears
Open

reoring wants to merge 12 commits into
mainfrom
fix/apt-1207-plan-failure-clears

Conversation

@reoring

@reoring reoring commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What (APT-1207)

After a plan generation failed, a later generation for the same draft that succeeded did not clear the plan failure on the build page until reload (appthrust.ink, Console 0.5.11: a generation failed during an operator rollout at 04:35Z, another succeeded at 04:52Z).

Causes (confirmed in source and reproduced with the mock):

  1. useBuildSession's failure is cleared only by retry or a reply, never by a newer generation.
  2. draftPollInterval (web/src/api/queries/build.ts) stops polling when all jobs are settled, so a generation made elsewhere (another tab, Platform, or the user) was never read.

Change

  • A supersedable plan failure (not quota, policy, the generation limit, the repository destination, or an unconfirmed write) records its target: the generation the request started from (the value in the plan idempotency key), or the failed generation reported by the observer.
  • When the draft's latest generation is newer than that target and pending, running or succeeded, the failure display clears and its conversation notice stays only as history (info, 「このあと、計画づくりをもう一度始めました。」 / "Planning started again after this.", no retry), also after a reload.
  • The tab's request counts as met only when that newer plan succeeded, no reply is running or waiting, and it was made for the intent this tab would send; then lastPlannedIntent is adopted and no second generation is made (prepareRequested kept, so 「計画を更新して作る」 continues). Otherwise the request stays and the normal flow plans with the newer input.
  • While such a failure is shown, the draft is re-read at the normal interval while the page is visible.

Verification (local, committed tree cce0f10)

  • RED on the base for the hook (6 of 11, then 3 more for the review cases) and for the new mock story e2e/stories/build-plan-superseded.mock.spec.ts.
  • typecheck, typecheck:e2e, bun test src 2124/0, check:response-boundaries 0, check:console-schema, mock e2e build-plan-superseded + build-run-failure + app-build-ai 11 passed.
  • Independent review: proxy probe-astra (implementer: Claude Opus designer). Round 1 changes required (request loss, stale planned intent, marker race); round 2 on cce0f10 merge OK, no findings, no judgment points.
  • Not run: appthrust.ink.

Builds on Console 0.5.12 (main 26814c2, merged in). Not in 0.5.12.

A failed run takes its retry action from Platform's failure.retryable; a known
reason only narrows the wording and removes skip where skipping cannot help.
Unknown reasons use the generic wording; runs without failure (older Platform)
keep today's failureReason reading. The run reader is rebuilt from the schema
shape so a refined upstream schema still loads. Draft fixtures gain the lists
the newer api-schema requires.
Skip and the typed change instruction are taken away only for the proposal
reasons Platform refuses at run start (pending, closed); skip alone stays hidden
for an exhausted quota. A non-retryable failure names who must act and then the
way on: write what to change, or skip the task. With Platform's decision a reply
typed after a stopped run is sent as a change run.
Platform dropped the run schema's refinement (platform #6976), so the run
reader extends ApplicationDraftImplementationRun like the task and execution
readers instead of rebuilding its shape.
…124)

The preview card states that it is a pre-publish check that only the builder
can see and that others cannot reach the app until it is published. Verified on
appthrust.ink: the workspace preview admits only its owner, and before
publishing the app URL sends other users to request access. The line is not
shown once the app is published.
PO lead decision: the line claims only what was verified on the screen path.
Members with Cluster Access Gateway access to the Project namespace are outside
it.
0.1.7 carries Platform's implementation failure contract (platform #6976).
…ion for the preview line (APT-1158, APT-1124)

Review follow-ups for 0.5.12:
- The pre-publish preview line follows publication (stage publish), not a
  live release, so it is shown until the app is published and hidden after.
- The sentence after a blocked run names only what the current screen offers:
  change and skip, change only, skip only (new), or nothing. The build page
  derives change from the same condition it uses to send a change run; the
  console build page and the improve page do not send change runs.
- A pending or closed proposal offers no new run, retry included.
- The proposal-pending and proposal-closed bodies match Platform: request
  changes reopens a pending proposal; a closed one (including expiry) is
  continued from Improve with AI.
- The no-internal-terms test covers every reason identifier and every
  follow-up sentence.
…APT-1124)

Review follow-up: access granted at publication is not taken back, so a later
run's release can reach those people once it is live. The line now follows
draft.publishedAt instead of the publish stage. The web README describes the
per-screen follow-up sentence and the proposal rule.
Review follow-up: the prop follows draft.publishedAt since 35069d0.
…1207)

On appthrust.ink a plan generation failed during an operator rollout and a
later generation for the same draft succeeded, but the build page kept the
plan failure until reload.

Two causes: the session's failure state is only cleared by retry or a reply,
and nothing re-reads a draft whose jobs are all settled, so a generation made
elsewhere was never seen.

A plan failure that a newer plan can supersede (not quota, policy, the
generation limit, the repository destination or an unconfirmed write) now
records the draft's latest generation. When a different generation is
pending, running or succeeded, the failure clears, the tab does not ask for
another plan, and the conversation keeps the notice as history without its
retry (also after a reload). While such a failure is shown the draft is read
at the normal interval while the page is visible.
… the same input (APT-1207)

Review follow-up:
- The failure marker is the generation the request started from (the value
  in the plan idempotency key), so a newer generation read while the POST
  was outstanding cannot become the marker.
- Clearing the failure display is separate from meeting the request: the
  notice becomes history as soon as a newer plan is live; the request is
  treated as met only when that plan succeeded, no reply is running or
  waiting, and it was made for the intent this tab would send
  (lastPlannedIntent adopted, no second generation). Otherwise the request
  stays and the normal flow plans with the newer input.
@reoring reoring added the needs-human-review Waits for a person's review before merge label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human-review Waits for a person's review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant