Skip to content

fix(content): show a live page's Start on the agent's waiting page - #1524

Merged
gkhngyk merged 49 commits into
ansvisor:mainfrom
cihan-gyk:fix/optimize-start-run-steps
Oct 26, 2026
Merged

gkhngyk merged 49 commits into
ansvisor:mainfrom
cihan-gyk:fix/optimize-start-run-steps

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #1523 (same file). The PR's own changes are its commits after #1523's branch.

The Content Agent's waiting page shows the run under way, with its real steps, counts and Stop (CE-027/035). It read only write and rewrite runs. But a Start on a live page (Optimize) runs as a Fix: content-writer.js startWritingRun starts it as kind fix, with the draft's writing claim. So since the run steps landed (#1401), an Optimize draft the agent was working on showed the fixed four-step list and no Stop. Found in the pre-push review of #1523.

The page now waits on the run the server starts for it:

The page Run kind read
A new page's Start write
A live page's Start fix
The whole page rewritten rewrite

It's one kind each, not a list. A run of another kind under way on the same draft never shows its steps or its Stop there. For example, a Fix another tab started while this one waits on a rewrite.

Stop needs no server change. POST /api/content-drafts/:draftId/stop stops the run named, and lets go of the draft by the claim the run holds, which a Start's fix run carries.

Related issue

Follow-up to the editor test findings 2026-10-25 (group F, #1523's review).

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Create content with Optimize from a live page URL, and choose Start with Agent.
  2. The waiting page shows the run's steps: "Reading N rules" › "Gathering N sources" › "Writing changes" › "Checking sources". It no longer shows the fixed list, and it has Stop.
  3. Press Stop. The editor opens on the page as it was ("Stopped · nothing was changed").
  4. A new page (Create › Start with Agent) and Rewrite page show their steps as before.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): 0 errors; the 6 warnings are in files this PR doesn't touch
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Web: yarn test and yarn build. A pre-push review ran; its test and comment fixes are the last commit (typecheck, lint and the editor tests rerun after it).

Tests:

  • A live page's Start (fix) shows its steps, and Stop names its run.
  • A new page's rewrite still shows its rewrite run.
  • A Start's write doesn't stand in for a rewrite.
  • No fix run shows for a new page or a rewrite.

Left for a separate server PR: startDraftWriting doesn't refuse a Start or Rewrite while a person's Fix open rules is still running on the same draft. For a moment, the waiting page could then read that Fix as its run. This is older than this PR (two model calls at once). The test "stays away when the agent was stopped from the wait screen" used a write run on a live page, which the server never starts; it now uses the fix run it does.

🤖 Generated with Claude Code

cihan-gyk and others added 28 commits October 25, 2026 21:35
…adings' answers and what the last rewrite came to, and offer a Length it can reach

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… for, keep its numbers on the row (00285), and read the floor's sections closer (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and count the last rewrite only within its Length's band and the same kept text (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er to rewrite the cited passages too when they hold the Length out of reach

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e back, release an unused hold, keep a cited-too miss as evidence, and offer it only when cited passages hold the Length (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he agent and Next step move on, and count open rules as the Rules tab does

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es read the page, keep the Length's own words, and wait for the passages before dropping skips (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion, not the next step, and say how many placeholders it leaves to fill

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aphs, and read a rewrite's once, not on every key (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y why a run left nothing, and show a failed last run on the card

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… id and kind, not by clocks, and clear a failed last run once another starts (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e rules before they're accepted, and say which rule met now one would break

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age as it is now, and count a rewrite's Length as its own line reads it (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wasn't given or drops a name a passage has

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…give claims only to sources the page or its input names, and put a rewrite's as a placeholder (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…editor shows them, and hold the rules chip until its count stands

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aracters as the toolbar counts them, and the run's rule count

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…for the brief and catalog before the rules' count, hold the panel's counts with it, and read the shown rewrite's Length by the editor's count (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s open suggestions for the page before, and drop a batch's card once the page no longer has it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e left open never holds the next run out of sight

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…estions when they can't be set aside, and hold History while the agent works or a decision saves (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a sweep on the step under way, a line on what it does, and the page drawn in

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, true without an outline, and silent on rules or sources read none of; even step spacing; steadier tests (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hich runs as a Fix, with its steps and Stop

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a Start's write doesn't stand in for it; the rewrite prop says what it reads (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 25, 2026

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

Looks good.

What I checked:

  • Stack. The PR's own change is two commits on #1523's head (9bb59a1): b0d3db3 and 41ce796. There are no merge commits, and it merges cleanly with its stack. It's web only, with no migration of its own.

  • The kinds match the server. startWritingRun (content-writer.js) starts:

    • a new page's Start as write;
    • a live page's Start as fix;
    • a rewrite as rewrite.

    That has been on main since #1400. The page passes rewrite from the draft's agent_run, so "Rewrite page" on a live page waits on its rewrite run. Try again and Rewrite from brief on a live page wait on fix, which is what the server starts for them.

  • Never an old run. useAgentRun shows only a run that is under way and of the kind asked for, so a Fix that finished earlier on the same draft never shows here.

  • Stop.

    • A live page's Start holds the draft's claim (claimedAt from agent_state_at). Stop ends its run and lets go of the draft, so the editor opens on the page as it was.
    • A person's Fix can't start under a Start: the API refuses it while the draft is writing.
    • The reverse case, a Fix already running when a Start begins, is the server fix the description leaves to a separate PR.
  • Step names. A fix run's step names (write_changes and the rest) are the card's existing strings. The line on what it does uses the live page's lines, with the counts this run read.

  • Tests:

    • a live page's steps and Stop;
    • a new page's rewrite;
    • no other kind standing in;
    • the stopped-from-the-wait test moved to the fix run the server really starts.
  • Before the API deploy. It needs only the run rows and the Stop route from #1400, which are older than every server change still waiting for a deploy. Today a live page's Start shows the fixed list without Stop. With this PR it shows its steps and Stop, and nothing that works today is lost.

No findings.

cihan-gyk and others added 15 commits October 26, 2026 10:11
…ead "per" only as an attribution, "claims" and "states" only before "that", and "göre" not as a comparison; keep a change that keeps every name worded or cased another way, or as bullets; know a source by its possessive, never its last word alone; let the prompts name Your input as a source (review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e Doe", "Recently Gartner"), keep a sentence's first word out of a placeholder, read "per" on English pages only, read "U.S." as one name, and start a name only at a word's start (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged the PR below it forward (ea8b63c), which brings in main now that #1514–#1519 are in. No conflicts; its diff against main is its own files again.

Checks after the merge:

@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 26, 2026

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

Looks good.

The new head, ea8b63c, only merges #1523's new head (5588e42), and through it main. Re-merging its parents (41dd8f2 and 5588e42) is clean and gives the commit's tree (71f61089), so the merge hides nothing. Its own change against #1523 is the same as in round 31, line for line. With its stack, it merges cleanly on main. The verdict stands.

@gkhngyk
gkhngyk merged commit b428349 into ansvisor:main Oct 26, 2026
4 of 5 checks passed
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