Repository navigation
fix(content): read how an agent run ended when its answer is lost, and say why a run left nothing - #1518
Merged
Conversation
…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]>
… one more pass 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]>
7 of 12 tasks
gkhngyk
approved these changes
Oct 26, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Stack. The PR's own change is its two commits on #1517 (20958e4, 4a0664d), with no merge commit. With the stack, it merges cleanly on main. No migration:
whygoes incontent_agent_runs.steps, which is jsonb (00249). - Why a run left nothing (API).
emptyWhyreads what the model proposed against the same passages and locked keys thatkeepSuggestionsused.- It returns
lockedonly when every proposal is a replace on a locked passage, whichkeepSuggestionsdrops before any other check. - Anything else is
dropped, and an empty answer isnone.
- It returns
- It runs only when no row was kept.
whyis written on step 2, the writing step (write_changesfor bothfixandhandoff), beforefinishRun, andfinishRunkeeps it when it adds the count.- Both
/suggestionsand/handoffanswer it, since the hand-off goes throughfixDraftRules.
- The lost answer (web).
- The previous run is read once, after the save and before the call, from Fix's kinds only. The poll then takes only a row with another id that has finished.
- Stopped and failed come from the row at once.
- A done row with a count of 0 is "nothing", with why.
- A done row with a count waits for its batch, which the API inserts before it finishes the row.
- The row is read through RLS (members of the draft's organization, 00249), on
content_agent_runs_draft_started.
- Who is told.
- The automatic hand-off stays quiet on "nothing" and on failures, as before.
- The card's failed line is set only when a run failed, never on a refusal (
running, open suggestions, budget). - It clears when the card follows a new run: Fix, a hand-off or the brief.
- API and web out of step. The web takes
whyonly as one of its three values (fixEmptyWhy,agentRunFrom); anything else reads as the plain "nothing". An older web ignoreswhy. - Before the API with this PR is deployed. Nothing breaks.
- The prod API already writes the run's row with its outcome and the writing step's count. So a run whose answer is lost and that left nothing now says "Content Agent found nothing it could change without new facts." instead of "couldn't run".
- A stopped run says it stopped, and a failed one says so as soon as its row does.
- The card's failed line works at once.
- Only the "all in passages AI answers quote" line waits for the deploy.
Low, follow-up (please fix before Quality phase 3 goes on):
_draft-editor.tsx:2383: Hand off sends the customer cases' paragraphs as locked, soemptyWhy(content-agent.js:486) also reads a change on a customer case aslocked.- The person then reads "…all in passages AI answers quote… Unlock the ones you're fine to change (Edit anyway)". But a customer case isn't quoted by AI answers and has no Edit anyway.
- When a hand-off sent cases, say it more broadly for
locked, e.g. "…all in passages the page keeps as they are (quoted by AI answers, or your customer cases)…". - Or send the cases apart from
locked, so the API can tell them from cited passages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #1517. The PR's own changes are its last two commits.
In the live editor test (2026-10-25), Fix open rules once ended in "Content Agent couldn't run. Try again." (compare #1350's false failure).
The cause. When the API call's answer is lost (a gateway timeout), the editor waited up to 90 seconds for an open suggestion batch, and for nothing else. A run that finished with nothing to review never makes a batch, so it always ended in the failure toast. That happens, for example, when every change it had was in a passage AI answers quote, which it keeps word for word.
How a run ended, read from its row (
_draft-editor.tsx,agentOutcome).content_agent_runs): Fix's kinds only, and not the run there was before it was asked. It no longer compares clocks.Why a run left nothing (
content-agent.js,emptyWhy).whywith a count of 0:none: the model proposed nothing;locked: every change it proposed was in a quoted passage;dropped: the checks dropped the rest.whyon the run's writing step (stepsis jsonb), so an editor whose answer was lost reads it too.locked, the editor says: "Content Agent's changes were all in passages AI answers quote, which it keeps. Unlock the ones you're fine to change (Edit anyway), or change them yourself."The card's last run.
The route doc comments name
why.Related issue
Editor test findings 2026-10-25 (group D).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Server tests cover
emptyWhyand thewhyanswer. Web tests cover:Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): 0 errors; the 6 warnings are in files this PR doesn't touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Server: format, lint,
npm test. Web:yarn testandyarn build. A pre-push review ran; its findings are the last commit.🤖 Generated with Claude Code