Skip to content

feat(content): show the content agent's steps while it works, and stop it (CE-027, CE-035) - #1401

Merged
gkhngyk merged 60 commits into
ansvisor:mainfrom
cihan-gyk:feature/editor-agent-steps
Oct 23, 2026
Merged

gkhngyk merged 60 commits into
ansvisor:mainfrom
cihan-gyk:feature/editor-agent-steps

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Content Editor v1.1, CE-027 and CE-035 (web): while the Content Agent works, the editor shows its real steps, named by the data it reads, and Stop, which leaves the page as it was. A dashed card in the draft shows where the change is being drafted, and no agent state spins a ring any more.

Stacked on #1400 (CE-027/035 server, 00249), which is stacked on #1399 → … → #1387. Merge after them.

On the agent card (_agent-card.tsx)

  • Working, under "Content Agent is working" and its dots, the run's steps show as chips:
    • for example "Reading 20 cited pages › Matching 21 fan-outs › Writing changes";
    • done steps are green with ✓, the step under way is in full, the rest are dashed;
    • a step about data the draft has none of (e.g. 0 Search Console queries) is left out.
  • The sliding line stays under the chips.
  • Stop shows once the run is read (before that there is nothing to stop), and is disabled once pressed — for that run: another run under way can be stopped again.
  • The card works for Fix open rules and for the brief (Brief's Run Agent, Sources' Rebuild with selection, Impact's Use lost prompts), which the side panel reports (onBriefRebuilding). If the panel closes mid-rebuild, the card stops waiting on it.
  • One agent run at a time: while Fix runs, the brief's buttons in Brief, Sources and Impact are disabled and say why.
  • A stopped run says "Stopped · nothing was changed" (a toast, not an error), also when the answer is lost on the way after Stop. A Stop that fails says the agent may still finish, and can be pressed again.

In the draft (_agent-drafting.ts)

  • While Fix runs, a dashed card sits under the H1, where a summary goes: "Content Agent is drafting a change here…" and "Drafting from 4 cited pages and 2 fan-outs…" (only what it has: "from 2 cited pages…"; or "Drafting from your rules…"), with shimmering lines.
  • Without motion, the lines are still.
  • It's a decoration, so no save, export or copy has it.

The waiting page (_agent-writing.tsx) (Start with Agent, Rewrite the whole page)

  • Once the run reads, its steps take the place of the fixed list, with the time it has taken, and a Stop button (outside the status region, so it isn't re-announced).
  • A successful Stop re-reads the draft, which the server has let go, so the editor opens as it was. The last steps stay only while Stop ends the run.

No spinning ring (brief's hard rule)

  • The agent's dots (_working-dots.tsx, in the text's color) replace the spinner on the waiting page's step under way, and on the agent's buttons: Rules → Run Agent, Brief → Run/Rebuild and Rewrite, Sources → Rebuild with selection, Impact → Use lost prompts, and the editor's agent Retry.
  • Other spinners in the editor (page load, Mark ready, brief save) aren't the agent's; they're left for a follow-up.

Data (agent-runs.ts, agent-runs-client.ts)

  • The run is read from the browser (Supabase client, RLS), and Stop goes through the API's same-origin proxy (/api/aeo), not through server actions:
    • Next runs server actions one at a time, and Fix and the brief are long server actions, so a read or a Stop behind them would only go out once the run had ended.
  • useAgentRun reads the draft's latest run a second after the last read answered (no pile-up) while the agent works, and shows only:
    • a run of the kind it waits on (Fix → fix, brief → brief, waiting page → write/rewrite), never an earlier run of another kind the server hasn't closed yet;
    • a run under way: not finished, and not one a stopped server left (older than 10 minutes);
    • a read that changed nothing keeps the run as it was, so the editor doesn't redraw every second.
  • 'stopped' is added to Fix's and the brief's error lists.
  • REBUILD_LIMITS (brief.ts) names the most of each source the agent takes, shared by rebuildSources and the drafting card.
  • supabase.ts gains content_agent_runs.

Related issue

Content Editor v1.1 (Drive spec, 2026-10-23): CE-027 and CE-035, web half. No GitHub issue.

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. With feat(content): write the Content Agent's runs step by step and stop them (CE-027, CE-035, server) #1400 deployed (00249 applied), press Run Agent in Rules.
    • The card shows "Content Agent is working", then its steps as they come, and Stop.
    • The draft shows the dashed "drafting" card under the H1. The Run Agent button shows the agent's dots, not a spinner.
  2. Press Stop. The toast says "Stopped · nothing was changed", no suggestions come, and the page is as it was.
  3. Rewrite page or Start with Agent: the waiting page shows the run's steps and Stop. Stop opens the editor again with the page unchanged.

Checked locally at 1024 px, light and dark (web :3002 + this branch's server :8082, dev DB with 00249; temp draft deleted afterwards):

  • the waiting page's steps, clock and Stop, no spinner, no overflow; Stop ended the run (stopped_at set, agent_state cleared) and the editor opened;
  • Run Agent in Rules: the card showed only the fix run's steps (an earlier rewrite row wasn't shown), the drafting card, dots on the button in both themes, no spinner.
  • The review fixes after that (Sources/Impact buttons blocked with the Brief tab's amber reason line, Stop per run, the drafting wording) are covered by tests and weren't re-checked in the browser.

Tests:

  • agent-runs.test.ts: reading a run, under way vs ended or stale, the same read twice, steps shown and their messages.
  • agent-runs-client.test.ts: the latest run read, a failed read, Stop's request (proxy URL, bearer, brand), no run under way, and its failures.
  • _agent-card.test.tsx: working with the run's steps, done ones checked, the one under way marked, only Stop, disabled once pressed.
  • _use-brief-rebuild.test.tsx: a stopped rebuild says so, not that it failed.
  • page.test.tsx:
    • the card working (no Stop before a run reads) and the drafting card, which goes once the batch lands;
    • a Fix run's steps (a data step with none left out), Stop calling /stop, and the stopped toast with no error;
    • Stop then a lost answer: stopped, no wait for a batch; Stop with no run under way; a failed Stop; drafting from the kept data (only cited pages: no "0 fan-outs");
    • the brief stopped from the card, then a Fix whose answer is lost still waits for its batch (no stale Stop);
    • the brief's buttons disabled, with the reason, while Fix runs;
    • an ended run's and another kind's run's steps not shown; no spinner;
    • the brief rebuilding shows the card, a stopped rebuild, and the panel closed mid-rebuild;
    • the waiting page's steps, no spinner, Stop, and the draft read again.

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 untouched files, as on main)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: web yarn test and yarn build.

🤖 Generated with Claude Code

cihan-gyk and others added 21 commits October 23, 2026 02:24
The workspace's one AI budget (Improve, the Content Editor's AI and the
Action Center's task writer) had no meter: the first sign of it was an
"AI usage is used up" error. Migration 00242 records what each AI call
was for (prompt_improve_usage.feature, backfilled) and sums the period's
spend by feature (ai_usage_by_feature). GET /api/billing/ai-usage
returns the shares of the plan's budget, and the Billing page shows the
share used, when it resets and what used it, with Agent Chat noted as
running on the workspace's own key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The workspace's AI budget was checked by reading the period's spend; the
call's cost was written once the model answered. Calls running at once
(two tabs, a teammate, an Action Center sweep) all read the same spend
and all ran past the budget. 00243's reserve_ai_usage takes a
per-organization lock, reads the spend with the calls in flight, and
holds the call's estimated cost; reserveAiBudget turns the hold into the
real cost or releases it. Improve, the brief rebuild, Apply rules with
Agent, Start Agent and the Action Center task writer use it in place of
enforceImproveQuota, which goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes:
- Apply rules with Agent and Start Agent charge an answer the provider
  billed but that missed the schema (NoObjectGeneratedError), as Improve,
  the brief and the task writer do; before, the hold was let go and the
  call ran free.
- A call holds the org's median cost over its last 20 calls this period,
  never less than the model's typical cost, so calls in flight pass the
  budget by far less.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply rules with Agent makes at most 8 small edits a run, which can't
bring a long page to its Length (about 2% a run on prod). The Content
Agent can now rewrite the whole page in one background call, left as ONE
suggestion (kind 'page', migration 00247) to compare and accept or reject:
- POST /api/content-drafts/:draftId/rewrite, through Start Agent's claim,
  budget hold and background run;
- passages AI quotes today, tables, images, quotes and HTML blocks go to
  the model as [[KEEP n]] lines and come back as they were; a rewrite that
  drops one fails the run;
- one H1, only the page's own links and the ones offered, the editor's
  tags; the page as it was is kept on the suggestion (before_html).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Length

Review fixes:
- Kept blocks are described under the page (a quoted passage's words, a
  table's rows, an image's alt) and their text counts toward Length, so a
  rewrite aims at the whole page's length; with Length off it keeps the
  page's own. A kept H1 stays first, and the page's language is kept.
- The answer is taken out of a code fence, text left at its root goes in
  paragraphs, and an answer in Markdown fails the run.
- The page's own links stay exactly as written (query and anchor too).
- Kept blocks go back untouched (an empty table cell stays), only the
  page's first H1 counts as its title, a page that writes "[[KEEP" gets
  markers of its own, and a page that is only kept blocks isn't sent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…compare it

The Rules tab opens with the agent's two ways to meet its rules: Apply
rules with Agent (small edits, up to 8 a run) and Rewrite the page to
these rules (the whole page as one change). The rewrite is recommended,
with a one-line reason, when the page is more than 30% off its Length or
4 rules or more are open.

A rewritten page comes back as one suggestion with its own bar over the
page: the characters before and after and the agent's reason, Compare
(the page and the rewrite side by side), Accept (History keeps the page
first), Reject, and Undo. A page that changed since the agent read it
isn't written over. The page waits for the rewrite with its own steps,
and a failed rewrite's Try again rewrites again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes:
- A page is compared with the one the agent read by its words, with a
  space between blocks, so stored line breaks and lists don't read as a
  change (Accept and Undo were refused on imported pages).
- One agent run at a time from the page; a rewrite never starts before
  the locked passages are read, and sends the editor's own locked keys.
- Accept holds the page still from the start and checks it again before
  putting the rewrite in; Undo puts the page back as it was (two H1s too),
  and the bar waits while the HTML view is open.
- No rewrite advice for an empty page or one too long to send whole; the
  rewrite mark survives a reload; the waiting view says the rewrite waits
  in the editor; Compare's links don't navigate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1, part 1 (CE-025, CE-026, §4): the agent row and the
rewrite bar become one card above the toolbar, in three states:
- waiting: "Content Agent has {n} suggestions for you", what they change
  and the rules they gain ("Rules 5 → 6 of 13"), with Review (scrolls to
  the first suggestion and marks it), Reject all and Accept all; a page
  rewritten shows its characters, with Compare;
- all reviewed: what was accepted and the rules met and still open, with
  Undo all and Run Agent;
- working: while Apply rules with Agent runs.
The tile moves a little (a soft ring, a blink, a spark; a sweep and a
breath while working), never a rotating ring, and not at all with reduced
motion. The card wraps on a narrow page; Accept all and Run Agent are the
primary buttons.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Run Agent on the card keeps to one agent run at a time and says why it
  waits; Apply rules never starts beside another run or before the locked
  passages are read.
- Ghost buttons show their hover on the card's grey; the tile and its
  count are hidden from screen readers (the title says it) and the count
  is darker for contrast; "+N more" comes from en.json, the reason's first
  letter is upper-cased in the page's locale.
- Review picks the first open suggestion in the page's order and focuses
  it; the sweep shows on the light tile in dark mode; the spark is slower
  once all are reviewed; without motion the working line is a faint full
  line; "0 still open" isn't said.
- globals.css keeps its own lines; only the motion block is added.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…split Run Agent

Content Editor v1.1 part 2 (CE-028–CE-031): the side panel's tabs become
Instructions · Sources · Live page. Instructions holds Brief | Rules, with
the rules still open on the tab and the segment. Each segment opens with a
status card: Rules has one split Run Agent ▾ (Fix open rules, or Rewrite
the whole page, which renames it "Rewrite page") in place of the two rule
buttons; Brief has Run Agent while empty and Rebuild brief once written.
Why the agent can't run is written under the card, and each card's ⓘ tip
opens below it. The brief shows "Not set yet" and its Length in characters
and about as many words; the toolbar counter adds the page's words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Run Agent's choice is worked out once and falls back to Fix without a
  rewrite; once a rewrite starts, the button is back on Fix.
- ▾'s choices are menu radio items; Fix is off when only rules the agent
  can't fix are open, and the card says what to do instead.
- The reason line under the card stays mounted for screen readers; Rewrite
  from brief writes its reason too; the tab's count is read out.
- Brief | Rules switch with the arrow keys, one tab stop.
- An edited brief's rebuild question sits under the card; a brief without
  H2s says to rebuild it; an empty brief shows no origin line.
- Plural copy for the open suggestions and the counter's words; rule names
  joined by the formatter; Run Agent's tip leaves ▾ out without a rewrite.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1 part 3 (CE-032, CE-034): under each Run Agent card,
"Uses your data: 1 prompt · 21 fan-outs · 20 cited pages · 10 Search
Console queries · Edit sources", counted as the Sources tab keeps them, so
turning one off lowers it at once. The Sources tab carries its count, and
its top says "N sources in use" and when the Content Agent last wrote from
them (its latest suggestions or the brief it built). A first visit's note
at the top of Instructions says the agent writes from the person's data;
closing it is kept in their own user metadata.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- "Last used by Content Agent" also counts the agent writing the page
  (agent_state_at: Start with Agent, Rewrite from brief on a new page),
  not a run that failed; a value that isn't a date is skipped.
- The latest batch's time is its first suggestion's, not a sort per render.
- Tests: the Brief segment's line, no line while the sources can't be read,
  the tab's count, the note showing again after a failed write, and a
  suggestion read with its createdAt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… name them

Content Editor v1.1, CE-033 (server): Fix open rules, Start with Agent and
Rewrite the whole page read the sources the Sources tab keeps, numbered
S1, S2… (content-sources.js). Each suggestion keeps the sources it names
and the words each supports (content_draft_suggestions.sources and
source_marks, 00248); a page rewritten whole keeps its sources.

No number without a source: the model reads a source by its words only, so
a number the agent adds must be the page's, the brand's, the brief's, the
rules', today's, or in a source's own words (then marked to it). A
suggestion with any other number is not kept; a page written whole gets a
placeholder in its place. Source numbers written into the words are taken
out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1, CE-033 (web) and the rest of CE-034: under each
suggestion, "Based on" chips name the sources it used (number, kind, name;
the Sources tab's details on hover), and a small number marks the words
each supports. A click on either opens Sources on that row, scrolled to
and ringed for a moment, once. The agent card adds "built from N of your
sources · See sources". Fix open rules sends the kept sources, and the
first-visit note says every change shows the sources it used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1, CE-027/035 (server): each Content Agent run (Fix open
rules, Start with Agent, Rewrite the whole page, the brief) is written in
content_agent_runs (00249) with its steps named by the data it reads
("Reading 20 cited pages", "Matching 21 fan-outs", "Writing 3 changes") as
it reaches them. POST /api/content-drafts/:id/stop marks the run stopped
and aborts its model call; the run checks before it keeps anything, so a
stopped run changes nothing (no suggestions, page, brief or History).

A run that can't be written still runs; runs a stopped server left are
closed when the next starts, and Stop ignores them. Background runs are
written before Start answers, so Stop finds them at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stop also clears the draft's 'writing' state at once: a background run lets
go once it sees the stop, but one no server holds any more never would, and
the waiting page would wait out the 10 minutes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…p it (CE-027, CE-035)

The agent card, the brief and the waiting page show the run's real steps
(content_agent_runs, read from the browser every second) and a Stop button
that ends the run through the API proxy, leaving the page as it was. A dashed
decoration under the H1 says where Fix is drafting, and the agent's dots
replace every spinner on its buttons.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk CE-027/035 web half, stacked on #1400 (please merge after it). Reads the run from the browser (Supabase + RLS) and stops it through the /api/aeo proxy on purpose: Next runs server actions one at a time, so a poll or Stop behind Fix's long server action would only go out after the run ended. Checked locally on the waiting page and the Rules card (light/dark, 1024 px) against a server without AI keys, so the Fix run failed fast; a real-key run with Stop pressed mid-way would be the one thing left to see on staging.

@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 23, 2026
gkhngyk
gkhngyk previously approved these changes Oct 23, 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. Approve, with three low follow-ups.

What I checked:

  • Polling. The run is read from the browser one second after the last read answers, so slow reads never pile up. It reads only while this page waits on the agent (Fix, the brief, or the waiting page). The draft's agent_state stops counting as writing after 10 minutes, so even the waiting page's loop is bounded. Each read is a single row on (draft_id, started_at desc) with limit 1. The RLS check is a subquery over the org's own drafts (14 drafts on prod today), so a read costs next to nothing.
  • Stop. It goes through the same-origin proxy with the bearer token. The API route checks brand access and that the draft belongs to that brand before anything is stopped, the same access check as the other agent routes. It can't be stuck behind the long Fix or brief server actions.
  • States.
    • Stopped (including when the answer is lost after a Stop): a neutral toast, and nothing is applied.
    • A Stop that fails: an error toast, and Stop can be pressed again.
    • Nothing to stop: Stop quietly comes back.
    • A run that finished normally: the usual success path.
  • i18n. Every new string, including the steps with and without a count, is in en.json, and every key stepMessage can produce exists. The drafting card builds its DOM with textContent and is never in the saved document.
  • Tests cover the hook's filtering, the client, the card, and the editor and waiting-page flows.

Low, follow-up:

  1. Runs are per draft, not per run (several tabs). stopAgentRun sends only the draft (web/src/lib/content/agent-runs-client.ts:50), and /stop stops whatever is under way on that draft. #1400's startRun also marks every unfinished run on the draft as failed, including one that is still live (server/src/lib/content-runs.js:88-94). So if a second tab or a teammate starts Fix or a brief rebuild on the same draft:

    • the first tab's card loses its steps and Stop while its run goes on and still lands;
    • a Stop pressed in the first tab within the next second stops the other tab's run.

    Fix: send the run id with Stop and stop only that row (.eq('id', runId)). In startRun, close only runs older than RUN_STALE_MS, or refuse a second Fix or brief run with 409 while one is under way.

  2. The waiting page goes back to its fixed list for a moment. At the end of a run, the writer clears agent_state before finishRun. Once the run reads as finished, run becomes null (_agent-writing.tsx:86). The generic four-step list then shows "Writing" again, with the clock, until the next draft read up to AGENT_POLL_MS (5 s) later. Fix: keep the last steps shown (live ?? shown) until the page switches, or re-read the draft as soon as the run reads as ended.

  3. Hidden tabs keep reading every second (_use-agent-run.ts:35). Reads are cheap and the loop is bounded, so this is optional: slow to AGENT_POLL_MS while document.hidden, and read once on visibilitychange.

Deploy order: this needs 00249 and #1400's server live first. Merging auto-deploys the web. Without the table, the UI falls back to no steps and no Stop, but readAgentRun logs an error on every poll.

cihan-gyk and others added 4 commits October 23, 2026 14:45
# Conflicts:
#	server/src/lib/content-writer.js
#	server/src/lib/content-writer.test.js
#	supabase/schema.sql
…le it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk and others added 5 commits October 23, 2026 15:15
…s-server

# Conflicts:
#	server/src/lib/content-writer.js
… and stop the run named

- A Stop that aborts a model call already sent keeps its hold on the AI
  budget as its cost (reserveAiBudget's keep()), since the provider bills
  it; a run stopped before its call sends nothing (runCall).
- A background run ends only the claim it still holds (agent_state_at), so
  one stopped from another server never clears a newer run's.
- A run closes only runs a stopped server left (older than RUN_STALE_MS),
  and /stop takes an optional runId, so another tab's run goes on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…agent-steps

# Conflicts:
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_agent-card.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.tsx
#	web/src/lib/actions/content-drafts.ts
…e editor shows

The step chips read the server's short names (Reading 4 rules, Gathering 52
sources, Writing changes, Checking sources). Stop sends the run's id, so
another tab's run goes on. The waiting page keeps the run's last steps and
reads the draft as soon as its run ends, and a hidden tab reads the run every
AGENT_POLL_MS, then at once when it shows again.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Follow-ups done, after merging #1400 (with main):

  1. Runs per run, not per draft. stopAgentRun(draftId, brandId, runId) sends the run the card or the waiting page shows, and feat(content): write the Content Agent's runs step by step and stop them (CE-027, CE-035, server) #1400's /stop stops that row only; startRun no longer closes a live run (only ones older than RUN_STALE_MS). A second tab's or a teammate's run goes on, with its own steps and Stop.
  2. The waiting page never goes back to its fixed list. It keeps the run's last steps (live ?? shown), and when the run reads as ended (done, failed or stale) it reads the draft at once (onRunEnded, also after Stop), not on the page's next 5 s look. Test with fake timers.
  3. Hidden tabs. The next read waits AGENT_POLL_MS while document.hidden, and a visibilitychange to visible reads at once (unless a read is out, which sets the next one). Tests in _use-agent-run.test.tsx.

Also: the step chips use #1400's new short names ("Reading 4 rules → Gathering 52 sources → Writing changes → Checking sources"; the brief "Gathering … → Writing the outline → Matching fan-outs").

@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk I merged main (#1404–#1410) forward through the content stack, bottom-up: #1393 → #1394 → … → #1403 → #1411 → #1412. Each PR is now mergeable again.

gkhngyk
gkhngyk previously approved these changes Oct 23, 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.

Still approve. The three follow-ups are done (20e919e):

  1. Stop names its run.
    • The editor and the waiting page send the run they show. stopAgentRun adds runId only when it has one, so an older server still accepts the call.
    • #1400's startRun no longer closes a run that is still going.
    • The server still lets go of the draft's Start claim when a Fix or brief run is stopped. That fix belongs on the server side, in #1400.
  2. The waiting page keeps the last steps.
    • run = live ?? shown, so the fixed list never comes back at the end.
    • When the run reads as ended, the page reads the draft right away (onRunEnded).
  3. Hidden tabs.
    • A hidden tab reads every AGENT_POLL_MS, and reads at once on visibilitychange unless a read is already out.
    • The listener is removed on cleanup.

Also checked:

  • The new step names: every key in RUN_STEP_KEYS matches the server's runSteps, and each one has both a message with a count and one without in en.json.
  • The merge commits:
    • 5871f03's conflicts are resolved with both sides kept: the reason line from #1395, rewrite read from agentRun, and both the writing and stopped errors.
    • 48df4d7 re-merges to the same tree.

The PR merges cleanly on current main. The deploy order is unchanged: 00249 and #1400's server must be live first.

cihan-gyk and others added 4 commits October 23, 2026 22:59
A Stop that named a Fix or brief run cleared agent_state whatever the run
was, so a Start or Rewrite on the same draft went on without its claim.
Each run now carries the claim it holds (content_agent_runs.claimed_at,
00249), stopDraftRun answers it, and the route clears agent_state only
where agent_state_at is still that claim.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t-steps-server

Main squash-merged ansvisor#1389 and ansvisor#1393–ansvisor#1399; its tree is ansvisor#1399's last head
(b84e724), so this is that merge: this branch's changes on top of it.
ansvisor#1400 adds the column to 00249.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Main merged (with #1400's fix below it). supabase.ts now has content_agent_runs.claimed_at, as you noted.

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

Still approve.

  • The one new commit (3b7e3d3) adds content_agent_runs.claimed_at to supabase.ts (Row, Insert and Update), as in #1400's 00249.
  • The PR's own diff on #1400 is otherwise unchanged.
  • The merge commit 7c0132d re-merges to the same tree.
  • The PR merges cleanly on main.

Deploy order is unchanged: 00249 and #1400's server first.

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

Re-approving after merging main into the branch. The merge only brings in the squashed parent PR; the tree matches the one tested (web and server tests, typecheck, lint, format).

@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 23, 2026
@gkhngyk
gkhngyk merged commit 3cd2051 into ansvisor:main Oct 23, 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