Skip to content

fix(content): leave rules held by quoted passages to the person, so the agent and Next step move on - #1516

Merged
gkhngyk merged 10 commits into
ansvisor:mainfrom
cihan-gyk:fix/next-step-held-rules
Oct 26, 2026
Merged

gkhngyk merged 10 commits into
ansvisor:mainfrom
cihan-gyk:fix/next-step-held-rules

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #1515 (and so on #1514). The PR's own changes are its last two commits.

In the live editor test (2026-10-25), 3 of the 4 sentences over 150 characters sat inside passages AI answers quote. Those passages are locked: the agent keeps them word for word, so no Fix run could close the Sentence rule. The Length was out of a rewrite's reach too. The agent kept being offered for both, Next step never left Fix / Rewrite ("bi adım sonraya geçemiyorum"), and Next step's "N rules are still open" didn't match the Rules tab's "N rules are not met".

Rules held by what the page keeps (rules.ts openRulesForAgent(rules, only, held), which now returns held beside forAgent and notForAgent):

Where held rules leave the agent's work:

  • the Fix run's request;
  • the card's Run Agent;
  • Run Agent in the Rules tab;
  • rewriteAdvice's open count;
  • Next step (rulesForNext).

So when only held rules are left, Fix isn't offered and Next step moves on to proof / check.

What the person sees:

  • Rules tab, Sentence row: "Kept by AI citations · yours to decide: the long sentences are in passages AI answers quote, which the agent keeps. Shorten them yourself (Edit anyway), or leave them quoted."
  • Run Agent, with only held rules open: it says why.
    • Sentence: "kept by AI citations".
    • Length alone: "a rewrite can't reach it".
    • The One H1 message still comes first.
  • Next step's Fix reason counts as the Rules tab does: "1 rule is still open for the agent… 2 more are yours to decide in the Rules tab."
  • Skip now reads Skip this step.

Next step doesn't drop a skip until the quoted passages are read (nextRead waits for citedRead). Before that, the Sentence rule would read as the agent's, and a skip would be lost on every opening.

Related issue

Editor test findings 2026-10-25 (group A, part 1).

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. Open an Optimize draft whose only long sentences are in quoted (green) passages, with the Sentence rule on.
  2. The Rules tab's Sentence row says it's kept by AI citations and yours to decide. Run Agent sends the other open rules, not Sentence. Next step moves past Fix once those are done.
  3. With only the Sentence rule (or a Length out of reach) left, Run Agent says why instead of running.
  4. Next step's Fix reason names the rules for the agent, and how many more the Rules tab counts.
  5. Unlock a quoted passage (Edit anyway). Its long sentence becomes the agent's 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 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 findings are the last commit. The editor test checks that a held Sentence rule isn't sent to Fix. The browser check is in the next batched local test session.

🤖 Generated with Claude Code

cihan-gyk and others added 9 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]>
@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 a369990 and 109d174, on #1515's head (65515ec), with no merge commits. With the stack, it merges cleanly on main. It's web only, with no route, migration or server change of its own, so nothing here waits for the API deploy. The Fix request keeps its shape; it just lists fewer rules.
  • Sentence, held.
    • htmlWithoutLocked takes out the blocks whose words make a key that's still locked. Unlocked passages stay in.
    • The editor reads what's left with the rule's own readPage + checkRule. So Sentence is held only when every long sentence the rule counts is in a passage the agent must keep word for word.
    • When one long sentence is outside, the rule stays the agent's. It becomes held once that sentence is fixed. Edit anyway gives a passage back to the agent.
    • Keys are made the plugin's way (passageKey of the block's words). A block whose HTML text reads differently is simply not held, which is how it worked before.
  • Length, held only when lengthOutOfReach says so, so the agent still gets any Length a rewrite can reach.
  • Where held rules leave the agent's work.
    • The Fix request (fixRules, with or without only).
    • The card's Run Agent and the Rules tab's Run Agent.
    • rewriteAdvice's open count.
    • rulesForNext.
    • The order of messages is the same in the toast, the card and the Rules tab: One H1 or the feed first, then held. The Sentence row's note shows only while Sentence is held and not met.
  • Skips. nextRead waits for citedRead. loadCited sets that in finally, whether the read worked, failed or found nothing quoted. It starts true for a page without a source URL, so it can't hang. A skip made at the old set of rules is dropped once, when the held rule leaves openRules.
  • Cost. The held read parses the page only while Sentence is open and a passage is locked. It reads pageHtml, which is already debounced, and is memoized.
  • Copy. The new en.json keys don't clash. Every test that clicks Skip now clicks "Skip this step".

Low, follow-up:

  1. Next step's Fix reason (_next-step.tsx:101-105, _draft-editor.tsx:2865).
    • others is every open rule less openRules, so a Length that's only a little off counts as "yours to decide in the Rules tab".
    • Fix open rules sends that Length, though: fixRules (_draft-editor.tsx:2135-2139) asks the agent for every forAgent rule, Length included. The reason can then say "1 rule is still open for the agent… 1 more is yours to decide" while the run asks the agent for both.
    • Count as others only the rules the run leaves out (notForAgent and held) and a rule that's notSet (Who it's for).
  2. Both rules held (rules.ts:822-823, en.json:5255). With Sentence and Length both held, heldMessage says only that what's left is kept by AI citations. The Length can be out of reach because of the headings and their answers, or the last rewrite, not the citations. When both are held, name both, e.g. add "…, and the Length is out of a rewrite's reach."

@gkhngyk
gkhngyk merged commit 85f9eb6 into ansvisor:main Oct 26, 2026
4 of 5 checks passed
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 26, 2026
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