Skip to content

feat(chat): deliver scheduled runs to Chat and the Inbox, with No change and notices (W3-04a) - #2015

Merged
gkhngyk merged 45 commits into
ansvisor:mainfrom
cihan-gyk:feature/chat-schedule-delivery
Nov 4, 2026
Merged

gkhngyk merged 45 commits into
ansvisor:mainfrom
cihan-gyk:feature/chat-schedule-delivery

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

What a scheduled job's run leaves behind (CHAT-12 items 13, 16, 18, 20, 24, 26–27), behind CHAT_AGENTIC. Stacked on #2014 (W3-02, on #2003 = #2003) and on #1958 (chat_notices, 00441, merged in, not rebased): merge those first. Needs migration 00461 on prod, after 00446. Plan: Chat waves plan, W3-04a.

Delivery to Chat and the Inbox

  • The answer is posted in the job's own chat, which belongs to its creator, so it reaches their Inbox as an unread result. No extra notice is needed for a success.
  • Notices (chat_notices, new kinds) appear at the top of the creator's Inbox (Needs you and All), with Open to the job's chat:
    • schedule_failed: "{Job} didn't run", with the reason in plain words. This only comes after the 10-minute retry also failed; the first failure is retried silently.
    • schedule_paused: "{Job} is paused", sent when the job turned itself off. Reasons: the monthly AI limit, the creator's role or brand access, a deleted brand, a skill that is off, or 3 failed runs in a row.
    • One notice per event. Both close once the job runs again or is turned back on (after the limit resets, too).

"Notify only if the answer changed" (schedule/fingerprint.ts)

  • When the read phase ends, the engine fingerprints what the run read: sha256 of each read's tool, input and result, keys in order, with times and dates left out. This way "last 7 days" read on two Mondays with the same numbers matches.
  • If a change-only job's fingerprint matches its last delivered run's, the run stops before the writing step: "No change since the last run". No writing-model call, no file, no writing-step usage. The run row is marked unchanged.
  • The first run always delivers. A delivered run's fingerprint becomes the job's last_fingerprint; a "No change" run keeps the previous one.
  • engine.ts only gets a 4-line hook. The worker passes changeOnly: { last } in the run's progress.
  • Limit: models on one phase (no separate read step) always deliver.

"1 of 3 ready" and usage

  • parts_done / parts_total count the task strip's tasks that are ready (a /tasks job), otherwise the files the run made. They update every minute while the run works, and once more when it ends.
  • usage_share: the server keeps each scheduled run's share of the monthly limit after every charge or release of its steps (refreshScheduleRunShare). Only Ansvisor-key spend counts. Never dollars.

Migration 00461 extends chat_notices_kind_check with schedule_failed, schedule_paused and followup_result (W3-05 uses the last one). The list keeps 00446's agent_went_live / agent_go_live_off, because 00446 is applied first. It also adds an index for a job's open notices. schema.sql is rebuilt.

Help: help/chat/scheduling.md gains "Results and notices".

Related issue

None. Chat waves plan, Wave 3 (W3-04a).

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

With CHAT_AGENTIC on and 00461 applied:

  1. Create a weekly job with Notify only if the answer changed (W3-02's card). Set its next_run_at to now: within a minute it runs in its own chat, and that chat shows in the Inbox as a new result. Its run row is done, and the job's last_fingerprint is set.
  2. Set next_run_at to now again with the data unchanged. The run's answer is "No change since the last run…", its row is unchanged, and no writing step ran.
  3. Make the job's brand inaccessible to its creator, or delete its skill. On its next slot the job turns off, and the creator's Inbox shows "{Job} is paused" with the reason and Open.
  4. Make a run fail twice (first try and the retry 10 minutes later). The Inbox shows "{Job} didn't run" with "Something went wrong." The next successful run closes it.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (changed files: 0 errors)
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

Run locally: web — format:check, eslint on the changed files, typecheck (the fingerprint test's types fixed in the follow-up commit), and 46 test files / 778 tests (schedule, engine, components/chat, schema, help, subscription-guard coverage, key-health, agent-sweep). Server — lint, and the full suite once: 5,121 passed, 1 timing test failed under load (content-people.test.js, unrelated; it passes alone). Full CI runs on the fork.

Screens: shown to the owner in a local preview (1024px, light and dark, with preview data) and approved on 2026-11-02.

CI passed on this branch (9c982d5), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41475593013): schema is up to date; web format:check, lint, typecheck, all tests and yarn build pass; server lint, format:check and all tests pass.

🤖 Generated with Claude Code

cihan-gyk and others added 30 commits November 1, 2026 12:08
…440)

AGENT-OWN-KEY PR 2. When the workspace's own AI key fails, every run ends
"Something went wrong" and nothing names the key. This adds what the next
PRs use to stop runs, pause agents and tell Admins. Nothing is visible yet.

- lib/agent/key-errors.ts: classifyProviderError(provider, error) unwraps
  the AI SDK's RetryError and reads the APICallError's status and body:
  invalid (401, 403, Google API_KEY_INVALID), no_credit (insufficient_quota,
  OpenRouter 402, Anthropic's low credit balance or billing_error), model
  (404, Azure DeploymentNotFound), transient (408/409/429/5xx/529, Google
  RESOURCE_EXHAUSTED, a dropped connection, a timeout) or request (anything
  else, and OpenRouter's 403 moderation flag). invalid, no_credit, model and
  unreadable (a key that can't be decrypted, ours) are the key classes.
- lib/chat/key-health.ts: ownKeyFailure reads the active key's failure
  without decrypting; markKeyFailing starts one episode however many runs
  fail at once (a conditional update on failing_since) and keeps the latest
  class; markKeyWorking clears it only when set and resumes the agents
  paused own_key; resumeOwnKeyAgents for a key that went out of use.
- 00440: organization_ai_keys gets checked_at, failing_since,
  failure_class, failure_status and notified_at, failing_since set exactly
  while failure_class is. A new key string clears all five in a trigger,
  so a key replaced in Settings starts unchecked whatever the route sends,
  and the web may deploy ahead of the migration. chat_agents.paused_reason
  and chat_agent_runs.stop_reason gain own_key. schema.sql and the
  Supabase types are regenerated.

Agents resumed by the system aren't logged, as the cap resume isn't.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g it to the AI limit

AGENT-OWN-KEY PR 7 (§3.1 point 2, §13 item 1). When the workspace's active
own key couldn't be decrypted (the master key rotated without a re-save, a
malformed row), resolveAgentModelConfig answered null and Chat silently ran
on Ansvisor's key and the workspace's AI budget, while chatRunsOnOwnKey
still said "own". A workspace that keeps its data with its own provider
would have had it sent through Ansvisor's key.

- lib/agent/key.ts: readActiveKey tells none saved, unreadable (with its
  provider) and ready apart. resolveAgentModelConfig keeps answering null
  for both, so today's Agent Chat still asks for a key.
- lib/chat/key.ts: resolveChatModelKey throws OwnKeyUnreadableError on an
  unreadable own key, never Ansvisor's key, and marks the key failing
  unreadable (key-health, best effort). The run ends in error; PR 3 gives
  it its own words. chatRunsOnOwnKey already reads it as own.
- Agents: aiLimitReached reads an unreadable key as the workspace's own
  (no AI limit), and the agent form still says the agent runs on that
  provider's key.
- Help "Use your own AI keys": a key the server can no longer read stops
  Chat; save it again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AGENT-OWN-KEY PR 3 (§5.1, §5.2). A revoked key, an account out of credit or
a model the key can't reach ended every run "Something went wrong", the
reading model's failure was tried again on the same key, and a triggered
agent kept firing until 3 failed runs in a row paused it.

- Engine: a failed model call on the workspace's own key is sorted by
  classifyProviderError (engine-key.ts stepFailure). A key class ends the
  run at once with code own_key: no read→write second call, and a Help
  answer stops too. The key is marked failing (one episode) and the run's
  progress keeps keyFailure. The words name the provider and the class
  ("Anthropic turned down your workspace's key." / "…out of credit." /
  "…can't find the model {model}…" / "…can't be read any more.") plus "So
  Chat stopped here. What's done so far is kept."
- A saved key that can't be read (PR 7) ends the run the same way before
  any call.
- A provider that didn't answer after the SDK's retries ends provider_down:
  "{provider} didn't answer, so Chat stopped here… Try again in a moment."
  The key isn't marked.
- Ansvisor's own key failing keeps today's path: it isn't the workspace's
  to fix.
- ChatModels carries the key's provider and its health at the run's start;
  the first answered call on a key marked failing marks it working, which
  resumes the agents it paused (key-health).
- The run's error box: Admins get Open AI Providers, others read "An Admin
  can fix it in Settings › AI Providers." (run.error code own_key,
  kept on reload).
- Agents: an error run with keyFailure is stopped own_key ("Stopped · AI
  key not working"), not failed, so it doesn't count toward 3 failed runs in
  a row. A triggered agent pauses own_key ("Your AI key isn't working"); a
  person's Run now or Run agent doesn't pause it.
- Help: chat.md "When your AI key fails"; agents.md "When your AI key fails".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AGENT-OWN-KEY PR 4 (§5.2 items 4–6). While the workspace's own AI key was
failing, Run now and Run agent queued runs that then failed, Resume turned
a paused agent back on into the same failure, and nothing outside a run
said the key was the cause.

- runChecks refuses own_key_failed (409) when Chat runs on the workspace's
  own key and it is marked failing (failingOwnKey): Run now and Run agent
  queue nothing, on any brand; Activate, Resume and Take over are refused
  the same way. The words: "{why} An Admin can fix it in Settings › AI
  Providers, then run the agent again."
- The runner ends a queued run before any model call: stopped own_key; a
  triggered agent pauses own_key, a person's run doesn't.
- Agent Center: a banner while the key fails, "Your {provider} key isn't
  working · agents are paused" and why; Admins get Fix in AI Providers,
  others read that an Admin can fix it there. The list's answer carries
  the key's class and provider (keyFailure), no dates.
- The composer, on Chat's pages and in the side panel: one line over the
  box, "{why} Chat stops on it until it's fixed.", with Fix in AI Providers
  for Admins. Sending stays on. Read only where Chat runs on the own key.
- Help: agents.md and chat.md "When your AI key fails".

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

Settings › AI Providers gets Test on each saved key and on the Replace form:
one call with no retries, sorted into working, out of credit, refused or
unchecked. What it finds is kept on the key (00440): a failing key starts an
episode, a working one ends it and restarts the agents it paused. The list
shows each key's health. The agent sweep restarts agents paused for the own
key once it works again, or once Chat no longer runs on it.

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

# Conflicts:
#	web/src/app/[locale]/(dashboard)/dashboard/chat/_chat-page-access.ts
#	web/src/components/chat/agents/agents-list.tsx
…ils (00441)

AGENT-OWN-KEY PR 6: when the workspace's own key stops working, every
Admin gets one notice for the episode: a row at the top of the Chat
Inbox, "Your {provider} key isn't working · agents are paused", with
Fix it to Settings › AI Providers, and an e-mail (00441 chat_notices,
unique per person and episode). If the key still fails 3 days later,
one reminder. The notices close once the key works again or is removed.
Only while Chat is on for the workspace; nothing on self-hosted.

Help: AI providers.

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

# Conflicts:
#	help/settings/ai-providers.md
#	web/src/app/api/settings/ai-providers/route.test.ts
#	web/src/app/api/settings/ai-providers/route.ts
#	web/src/lib/chat/agent-sweep.test.ts
#	web/src/lib/chat/agent-sweep.ts
#	web/src/lib/chat/key-health.ts
…or a test passes

Saving a new key string clears the old key's failure (00440's trigger), so
markKeyWorking found nothing failing and never closed the Admins' notices.
The PUT now closes the provider's open notices before the new key's check
is kept, and a passing check closes them whether or not a failure was
still marked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ess and demo coverage tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3-DB, 00457–00459)

Chat's Wave 3 tables in one PR (one DB PR per wave), behind CHAT_AGENTIC:
nothing reads or writes them while the flag is off. Tables, types, tests
and the demo's coverage only; the code that uses them comes in W3-01,
W3-06 and W3-11. Every new table has row level security on; members only
ever read, anon gets nothing, and every write is the server's.

- 00457: chat_schedules (CHAT-12): once, recurring or a follow-up check;
  run at / ready by, due and next run, the RRULE and time zone; title,
  prompt or skill, the brand fixed at creation, the creator it acts as and
  its own chat; delivery to chat and/or email, recipients only people of
  the workspace (a trigger checks), change-only with the last fingerprint;
  mode, model, effort; on/off with the reason, failures in a row, the one
  retry; a follow-up check's target, metric and who set it (card or
  full_auto, the latter only for follow-up checks). A job whose brand or
  creator is deleted turns off (missing_source, owner_role) instead of
  running on without them. chat_schedule_runs: slot and attempt (unique,
  so a slot never runs twice), Run now, the Chat run and answer, status,
  parts done, fingerprint, usage as a share, email outcome.
  chat_conversations.schedule_id with origin 'schedule' (one live chat per
  job; it stays the creator's), prompt_improve_usage.schedule_id, and
  reserve_chat_ai_usage taking p_schedule_id (default null, old calls still
  match): the row is named by the chat's job, a job that isn't the chat's
  is refused. Creator and Admins read a job, within their brands.
- 00458: chat_skills (CHAT-13): name unique in the workspace in the
  format's rules, body up to 50 KB, licenses MIT, Apache-2.0,
  BSD-2-Clause, BSD-3-Clause, ISC (an import needs one), source user or
  import with the pinned commit and checksum, scan and removed parts,
  review status (only an approved skill can be on), private or workspace.
  Private or unapproved: creator and Admins; approved workspace skills:
  every member. chat_settings.disabled_skills for library skills.
- 00459: chat_memory_items (CHAT-14): Me, brand and workspace lines, 1–300
  characters, at most 4,000 a scope (a trigger under a lock per scope,
  deleted lines left out), one profile line a person, deleted_at for Undo;
  brand lines go with the brand, Me lines with the account and when the
  person leaves the workspace (trigger on profiles). Me: only its person;
  brand lines: brand access; workspace lines: every member.
  chat_settings.memory_enabled and chat_user_prefs.memory_enabled, both on.

web/src/types/supabase.ts carries the new tables and columns; schema.test.ts
checks the Wave 3 policies, limits, vocabularies, triggers and the hold's
signature from the SQL; brand-access-policies.test.js lists the new tables;
the demo coverage skips chat_schedules and chat_memory_items.

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

Each / menu shortcut (CHAT-08) now has a hidden playbook in skills/
(metadata.hidden: "true"): its allowed reads, default scope, output,
question rules and next moves, checked by the same format, scan and CI as
the library skills. The menu gains /start, /optimize, /opportunities and
/audit; "Create a report on" moves to /new-report, as /report is the
Weekly report skill's.

The composer sends shortcutId with the message while its trigger words
stay (rewritten, it drops), and keeps it on Retry. Home chips whose job
is a shortcut's send its id; chips for the focus areas' skills ask with
the skill's /name. The server takes the id only for a message that is
still that shortcut's, writes chat_messages.shortcut_id, loads the
playbook first as one of the run's three skill bodies, offers only the
reads in its data plan, and tells the model in one line what the plan
leaves out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rt (W2-03)

Before work in several like parts (drafts, pages, tasks), the model calls
the engine's plan_parts with how many; the server counts how many the AI
limit left covers (fitChatUnits and POST /api/internal/chat/budget/fit,
each part one write step's worst case, an agent run's own cap included):
a count, never dollars.

All covered, the work goes on. None, the run pauses at the AI limit as
before. Some, a question card asks "Your remaining AI limit covers about
{k} of the {n} ...": Do the first {k} now (Recommended), Get more AI
credits (pauses at the limit) or Cancel (stops). With no one there (an
agent's or a scheduled run), the first {k} are done and filed and the run
stops at the AI limit as it ends. A skill's run is checked as it starts,
before anything is read. Nothing is checked on the workspace's own key.

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

Move the RRULE subset (DAILY/WEEKLY/MONTHLY on a zone's clock) from
agent-schedule.ts to schedule/rule.ts, which agent-schedule.ts re-exports,
and add nextJobRun for a chat_schedules row. Extract openHeadlessRun
(headless-run.ts) from openAgentRun: the chat, the message, the answer,
the Chat run and its state, written in the same order; agent runs use it
unchanged. No behaviour change: the agent tests pass as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Chat's scheduled jobs (CHAT-12) now run by themselves, behind
CHAT_AGENTIC. The server's minute cron calls the new
/api/internal/chat/schedules/tick (CHAT_INTERNAL_SECRET) right after the
agents' tick; it settles open runs, resumes jobs the AI limit paused and
runs the due ones (schedule/worker.ts):

- A due job is claimed by moving next_run_at (or retry_at) from what was
  read, so two workers run a slot once; chat_schedule_runs' unique slot
  and attempt is the backstop. A recurring slot over an hour late is
  skipped (no catch-up); a busy workspace waits for the next minute.
- Each run re-checks its creator: Admin or Manager and the brand still
  theirs (else owner_role), brand there (missing_source), skill on
  (skill_off), AI limit (paused_cap, the job pauses at cap). A read-only
  workspace skips the slot; with Chat off nothing is touched.
- The run opens in the job's own chat as its creator (openHeadlessRun),
  Queued then claimRunSlot, always Auto · Normal, with no session, so
  every change waits as a card.
- A failed run retries once 10 minutes on; 3 failures in a row turn the
  job off. After the reset a cap-paused job goes on at its next slot.

Engine (thin hooks): a job's own run is metered as feature 'schedule'
with its scheduleId (budget.ts meteredAs; the server passes
p_schedule_id), and a question in it takes the Recommended option and
lists it at the top of the answer (schedule/unattended.ts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…W3-02)

- schedule/when.ts reads a date phrase on the person's clock: 09:00 for a
  day with no time, working days only when said, ready by vs run at, the
  RRULE subset for repeats (at most once a day), and ambiguous phrases
  ("next Friday", "the 31st") returned with their likely dates for a
  question card. CHAT-12's acceptance examples are its tests.
- create_schedule registry row (Scheduling area, row 78): WRITE, Ask, a
  card in every mode, Admins and Managers; its precheck refuses what
  won't read, a skill that's off and a full plan (Trial 1 · Starter 5 ·
  Growth 25 · Enterprise 100 active jobs; follow-up checks don't count).
  It runs through a session server action and logs with a 30-day Undo
  that deletes the job.
- A reusable editable approval card: ChatConfirm.form, FormCard and the
  row hooks form/stepKind/doneStep. The Approve sends the edited values;
  the server applies them and checks them against the row's schema
  before the change runs. W3-08 and W3-12a reuse it.
- The schedule step shows "Scheduled: {title}" with when and where.
- The card's usage line comes from a new internal estimate route (the
  workspace's average Chat run over 30 days, as a share; never dollars).
- Help article help/chat/scheduling.md (approved: false).

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

# Conflicts:
#	server/src/routes/internal-chat-budget.js
#	server/src/routes/internal-chat-budget.test.js
…nge and notices (W3-04a)

- A job's answer stays in its own chat, its creator's, so it reaches
  their Inbox as an unread result.
- "Notify only if the answer changed": at the end of the read phase a
  scheduled run fingerprints what it read (times and dates left out);
  a change-only job that read what its last delivered run read stops
  before the writing step as "No change" (run status unchanged). The
  first run always delivers; a delivered run's fingerprint becomes the
  job's last_fingerprint.
- "1 of 3 ready": the run row's parts follow the task strip's ready
  tasks, else the files the run made, while it works and when it ends.
- The server keeps each scheduled run's usage_share after every charge
  or release of its steps (Ansvisor-key spend over the included budget).
- chat_notices for the creator: schedule_failed after the retry also
  failed, schedule_paused when the job turns itself off; closed when the
  job runs again or is turned back on. The Inbox shows them with Open.
- Migration 00461 widens chat_notices_kind_check (keeps 00446's kinds,
  adds schedule_failed, schedule_paused, followup_result).
- Help: "Results and notices" in help/chat/scheduling.md.

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 Nov 2, 2026
gkhngyk
gkhngyk previously approved these changes Nov 2, 2026
@gkhngyk

gkhngyk commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Approved, with notes:

…heck hits

The fit check (fitChatUnits) took the smaller of what is left of the
month's AI limit and what an agent run's own cap leaves, but only returned
the count. The engine then paused every new cap path (a skill's run that
can't start, a job none of whose parts fit, Get more AI credits, and the
parts done with no one there) at the month's limit. For a triggered run
stopped by its own cap, the agent driver read capHit 'month' and paused
the whole agent until the month resets instead of ending the run as
"Stopped at its limit".

The server now returns which limit binds ('run' when the run's cap leaves
no more than the month, as reserveChatStep's run_cap), the route passes it
on, and the web client reads it (the month's when absent). The engine
pauses with that limit, keeping it on the parts card and on limitStop, as
modelStep already does for run_cap refusals.
…e input

A one-time job that has run stays enabled with no next run, so it kept
counting toward the plan's job limit: on a trial every later schedule was
refused until the finished job was deleted. The limit now counts live jobs
only, enabled with a next run or a retry still to come.

The count and the insert were separate steps, so two creates at once could
go one over the limit. After the insert the new job must be among the
first `limit` live jobs, oldest first; otherwise it is deleted and the
create is refused as quota_exceeded. Both racers see the same order, so
exactly one of them keeps the last place. No schema change.

createChatSchedule is a server action and can be called with anything. It
now parses the job with the create_schedule tool's schema (moved to
schedule/input.ts so the action and the tool share it) and the run's place
with a small schema, refusing bad input as invalid before any check or
write.

The test fake's or() gains `column.not.op.value` terms.
# Conflicts:
#	server/src/routes/internal-chat-budget.test.js
# Conflicts:
#	help/chat/chat.md
#	server/src/lib/chat-budget.test.js
#	server/src/routes/internal-chat-budget.js
#	server/src/routes/internal-chat-budget.test.js
#	web/messages/en.json
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
# Conflicts:
#	server/src/lib/brand-access-policies.test.js
#	server/src/lib/chat-budget.js
#	supabase/schema.sql
#	web/src/lib/chat/agent-driver.ts
#	web/src/lib/chat/schema.test.ts
#	web/src/types/supabase.ts
# Conflicts:
#	server/src/lib/chat-budget.js
#	server/src/lib/chat-budget.test.js
#	server/src/routes/internal-chat-budget.js
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
# Conflicts:
#	server/src/lib/chat-budget.test.js
#	server/src/lib/chat-notices/own-key.js
#	server/src/middleware/demo-brand.test.js
#	server/src/routes/internal-chat-notices.js
#	server/src/routes/internal-chat-notices.test.js
#	supabase/schema.sql
#	web/messages/en.json
#	web/src/app/api/settings/ai-providers/route.test.ts
#	web/src/app/api/settings/ai-providers/route.ts
#	web/src/components/chat/chat-inbox.test.tsx
#	web/src/components/chat/inbox-notices.tsx
#	web/src/lib/actions/chat-notices.ts
#	web/src/lib/chat/agent-sweep.ts
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/subscription-guard-coverage.test.ts
#	web/src/types/supabase.ts
gkhngyk
gkhngyk previously approved these changes Nov 2, 2026
# Conflicts:
#	help/chat/chat.md
#	server/src/routes/internal-chat-budget.js
#	server/src/routes/internal-chat-budget.test.js
#	web/messages/en.json
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
#	web/src/lib/chat/registry/define-tool.ts
#	web/src/lib/chat/registry/tools.test.ts
#	web/src/lib/chat/registry/tools.ts
#	web/src/lib/chat/schedule/worker.test.ts
#	web/src/lib/chat/schedule/worker.ts
#	web/src/lib/chat/undo.ts
@gkhngyk

gkhngyk commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

This PR now conflicts with main: #2014 was squash-merged, so its commits are on main under new hashes. Could you merge main into this branch (or rebase it onto main) and resolve the conflicts? Once CI is green I'll merge it.

Stacked on it and needing the same, in order: #2018 → #2028 → #2029 → #2034 → #2047. Updating each after the one below it has merged keeps the conflicts small.

cihan-gyk and others added 4 commits November 4, 2026 00:51
…chat-schedule-delivery

# Conflicts:
#	supabase/schema.sql
#	web/messages/en.json
#	web/src/components/chat/inbox-notices.tsx
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
#	web/src/lib/chat/schedule/worker.ts
@gkhngyk
gkhngyk merged commit 9575e05 into ansvisor:main Nov 4, 2026
5 checks passed
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 4, 2026
…ly job's reading

Main now has two paths the single recovery meets: a run that waits on a card
and goes on as the same run (an agent's run_agent too, ansvisor#2052), and a change-only
job that stops on "No change" once its reading ends (ansvisor#2015). The recovery a run
spent before its card stays spent after it, and a reading step the provider
ended with nothing in it is taken as read enough: the job still stops on "No
change" with no retry and no writing step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk pushed a commit that referenced this pull request Nov 4, 2026
…y its cause (#2113)

* fix(chat): recover an empty answer once a run, the kind picked by its cause

A provider error retry (#2064) and the ask for the answer (#2040) each had
their own once-a-run flag, so one empty answer could take 3 model calls (4
with the language rewrite). One flag, progress.recovered, now holds the run's
single recovery: a writing step the provider ended in an error runs again as
it was; the model's own empty or next-moves-only reply is asked for the answer
with ANSWER_NOTE and no next moves tool. A reading step with nothing in it no
longer spends the retry: it moves on to writing anyway. A recovery step that
is empty too ends the run as before.

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

* test(chat): hold the run's one recovery across a card and a change-only job's reading

Main now has two paths the single recovery meets: a run that waits on a card
and goes on as the same run (an agent's run_agent too, #2052), and a change-only
job that stops on "No change" once its reading ends (#2015). The recovery a run
spent before its card stays spent after it, and a reading step the provider
ended with nothing in it is taken as read enough: the job still stops on "No
change" with no retry and no writing step.

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

---------

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-migration Adds or edits a migration — apply it to the hosted database

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants