Skip to content

fix(chat): read on or look up before saying anything is missing - #2449

Merged
gkhngyk merged 4 commits into
ansvisor:mainfrom
cihan-gyk:fix/chat-never-give-up
Nov 16, 2026
Merged

gkhngyk merged 4 commits into
ansvisor:mainfrom
cihan-gyk:fix/chat-never-give-up

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

#2448 and #2420 are merged, so this diff is this PR's change alone.

Merged with main (16 Nov, evening): via the updated #2448, with no conflicts. help/chat/chat.md merged on its own (union of keywords, later dates), and the Help checks pass. tsc is clean, and 334 test files (4,823 tests) pass. The branch is 0 commits behind main and merges cleanly.

Summary

The writer was told to "say plainly when data is missing". A read that ran out of time told it to say the data "couldn't be read now". So Chat answered "I couldn't read it", "I hit the read limit" or "38 actions are missing" about data it could have read.

Now the rules and the engine's messages say what to do next:

  • read the next page;
  • look the item up;
  • try once more, narrower.

A "no" is kept for true refusals, with why and what the person can do.

Changes

  • Reader rules (READ_ON_RULES):
    • Look an item up by the code, id, title, words, domain or URL the person named.
    • A list with next_offset has more: read the next page when the question needs all of it. Prefer a narrower read for a long list.
    • Read the rest of a cut result, or read it narrower.
    • After a failed or slow read, try once more, narrower. Never with the same input.
  • Writer rules (NEVER_GIVE_UP_RULES). These replace "say plainly when data is missing".
    • Read on first.
    • Say "not found" only after a direct lookup, and say where you looked.
    • Never offer substitutes ("the closest").
    • A partial answer says what it covers ("the newest 50 of 451 signals") and offers the rest as a next move.
    • A failed read: "not available right now", with an offer to try again.
    • A true refusal (plan, role, AI budget, an Admin setting, a feature that is off): why, once, and what the person can do.
    • Never "couldn't read", "couldn't reach", "couldn't access", "read limit", "hit the limit", "rows" or a count of missing items, in any language. Turkish is named: "okuyamadım", "ulaşamadım", "erişemedim", "okuma sınırı", "sınırına takıldım", "eksik" about the data, and "bulamadım" before a direct lookup.
  • Messages to the model:
    • Timeout: one narrower try (a shorter period, a filter, a smaller page). A second timeout of the same read: no more tries. A third call is refused without reading.
    • Failed read: it now has a message (try the same data another way once). It reaches the writer's read log, so the answer can name the figure.
    • Reads used up: answer for what was read, say what it covers, offer the rest. Never "a limit". An agent's run still makes its changes first.
    • Per-tool cap (pages opened): the same tone.
    • Cut result: the writer's rule now says to read the rest or narrow, and how to read a page (total, next_offset, note).
    • explain_change partial: the rule and the Why card no longer say "Not every answer could be read". They now say causes come only from prompts whose answers were all compared.
  • Step labels: "Couldn't read this" is now "Not available right now". "Timed out" is now "Took too long this time".
  • Budget (run-limits.ts):
    • A next page of a list the run already read counts as a quarter of a read (PAGES_PER_READ = 4).
    • The hard ceiling is 12 next pages a run (MAX_NEXT_PAGES).
    • The data budget (dataChars) still applies.
  • Help, Use Chat:
    • new section "Long lists";
    • "When something goes wrong" and "What explains the change" updated;
    • approved-articles.json regenerated.

How to test

  1. Ask Chat on Signals: "What changed this month? Go through all of them."
    • The reader reads the next page (offset: 50).
    • A next page shows in the run's progress as pages, not reads.
  2. Make a read time out, for example citations on a large brand over 90 days.
    • The step says Took too long this time.
    • Chat tries once with a shorter period.
    • The answer says the figure isn't available right now and offers to retry. It never says "couldn't read".
  3. Ask in Turkish about an item past the first page.
    • The answer never says "okuyamadım", "ulaşamadım" or "sınırına takıldım".
  4. Run cd web && yarn vitest run src/lib/chat/read-on-rules.test.ts src/lib/chat/run-limits.test.ts src/lib/chat/engine.test.ts -t "runs out of time|read-on".

Checks

🤖 Generated with Claude Code

https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9

The writer was told to "say plainly when data is missing", and a read
that ran out of time told it to say the data "couldn't be read now".
Answers like "I couldn't read it", "I hit the read limit" or "38 actions
are missing" followed, about data Chat could have read.

- Rules: the reader looks an item up by what the person named, reads the
  next page of a list that has more (next_offset), reads the rest of a
  cut result or narrows it, and tries a failed or slow read once more,
  narrower. The writer reads on first, says "not found" only after a
  direct lookup, never offers substitutes, says what a partial answer
  covers ("the newest 50 of 451 signals"), and keeps "no" for a true
  refusal (plan, role, AI budget, an Admin setting, a feature that is
  off) with why and what to do. Neither ever writes "couldn't read",
  "couldn't reach", "read limit", "rows" or a count of missing items, in
  any language, Turkish named (READ_ON_RULES, NEVER_GIVE_UP_RULES).
- Messages: a timeout asks for one narrower try, never the same input,
  and a second timeout of the same read for none (a third call is refused
  without reading). A failed read says to try the same data another way
  once, and now reaches the writer's read log. Reads used up: answer for
  what was read and say what it covers; never "a limit". explain_change's
  partial line and the Why card's say causes come only from prompts whose
  answers were all compared. Step labels: "Not available right now",
  "Took too long this time".
- Budget: a next page of a list the run already read counts as a quarter
  of a read (PAGES_PER_READ 4), up to 12 next pages a run
  (MAX_NEXT_PAGES); the data budget still holds.
- Help: Use Chat gains "Long lists"; "When something goes wrong" and
  "What explains the change" say the new behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
gkhngyk previously approved these changes Nov 16, 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.

LGTM.

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

LGTM.

@gkhngyk
gkhngyk merged commit cc8f72f into ansvisor:main Nov 16, 2026
11 checks passed
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 16, 2026
Brings in ansvisor#2449, ansvisor#2450, ansvisor#2457, ansvisor#2460 and ansvisor#2461 (Chat and MCP lookups by
code, id, words, domain or address; never give up on data it could read).

Conflicts, resolved as the union of both sides:
- agent-eval.ts: the scenario keeps askedSignals/askedDomains and checks;
  QUESTION_SCENARIOS holds action-by-code, signal-by-code,
  citation-by-domain and the three ai-revenue questions; every run gets
  "never gives up on data it could read" and then its scenario's checks.
- agent-eval-data.ts: EvalWorkspace is default, action_backlog,
  long_lists and conversions_off; both sides' imports.
- agent-eval.test.ts: both sides' imports.
- brand-scope.test.ts: the AI-revenue reads and the lookups.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
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.

3 participants