Skip to content

feat(chat): let an agent run another saved agent (W4-26, W4-27) - #2052

Merged
gkhngyk merged 18 commits into
ansvisor:mainfrom
cihan-gyk:feature/chat-run-agent
Nov 4, 2026
Merged

gkhngyk merged 18 commits into
ansvisor:mainfrom
cihan-gyk:feature/chat-run-agent

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

An agent can run another of the workspace's saved agents (CHAT-27 phase 2, items 14–18 and 25), behind CHAT_AGENTIC. W4-26 (the run_agent core) and W4-27 (the Can call setting and the called runs' view) ship together: the setting does nothing without the tool. Stacked on #2003 (W3-01, feature/chat-schedule-worker): merge it first. No migration of its own: it uses 00466 (already on main): chat_agent_versions.can_call, chat_agent_runs.called_by_run_id, trigger kind agent, and its checks (at most 5, not itself, same workspace, no chains, at most 3 calls a run). Plan: Chat Wave 4, lane G.

The run_agent registry row (registry/agent-call-tools.ts, area Agents)

  • WRITE, Ask as its default and its maximum, a card in every mode. Growth and up, Admins and Managers. No MCP tool. Its result taints the run: every later change asks (CHAT-20 §16a).
  • Offered only in an agent's run whose version's Can call names an agent that is on (a new offerIn hook on rows). It is never offered in a person's own chat or in a run another agent started.
  • The card: "Run another agent · {agent}", what it asks, and AI use: "Up to {N}% of the monthly AI limit". The AI use row is a new card target kind (aiUse), labelled as the agent's page labels it. The name and share are read within the run's workspace: target and cardDetails now get { organizationId } from the engine, so an id from another workspace names nothing.
  • The step: "Ran {agent}" · "{status} · {N}% of the monthly AI limit" (a doneStep hook, the same as W3-02's).
  • It runs through the person's session (actions/chat-agent-calls.ts, assertWritable first). It is refused for anyone but the person the run acts as.

The call (lib/chat/agent-calls.ts)

  • Checks:
    • the caller is an agent's run, not one another agent started;
    • the agent is in its Can call and active;
    • fewer than 3 calls so far;
    • the called agent's scope covers the caller's brand for the caller's person.
  • The called agent runs as its own agent run: trigger_kind agent, called_by_run_id, on the caller's brand, as the caller's person, in a chat of its own (openAgentRun, so every check before a run applies).
  • Its mode is the stricter of the two agents' modes. It has no session, so its changes ask first.
  • Its cap is the smaller of its own Max per run and what is left of the caller's. On the server, chat-budget.js takes the called runs' spend out of the caller's cap, so what a called run doesn't use comes back.
  • The caller's step drives it and waits for it. The caller's Stop stops it, and the caller's heartbeat stays alive meanwhile. The wait is at most 4 minutes, not T3's 10: it runs inside the approve request, whose maxDuration is 300 s. A longer wait needs a longer maxDuration first.
  • Its answer comes back to the model as an <untrusted_data> block, along with its status, share and chat link.
  • The called run's message says which agent called it; the ask is in its scope only, as data. The caller's first message names the agents it may run in plain words ("It may run FAQ writer if the task needs it."), never the tool's name; their ids are in the run's scope, as the tool's description says.

The Can call setting and the view (W4-27)

  • New agent / Edit, last step: a Can call row under Max per run. It lists the agents on or paused that the person sees, never the agent itself, up to 5, as toggle pills. Below Growth it is locked ("Running other agents needs the Growth plan.").
  • The server checks the plan gate (plan_locked, also on Duplicate). It refuses an agent of another workspace, an archived one or the agent itself with agent_not_found (400). Can call is part of the version, so a change makes a new version.
  • Agent page:
    • Access lists Can call by name.
    • Run history shows "Called by {agent}" on a called run.
    • A run that called others shows "Ran N agents ▾", which opens a row for each with its result and its AI use against its cap.
  • Help: help/chat/agents.md gets "Let an agent run other agents" (approved article, approved-articles.json regenerated).

Not in this PR / decisions to note

  • No per-agent "Don't ask again" in Full auto. An agent's run has no session, so every change in it shows a card (askWithoutSession). Approving a call automatically would need a new kind of standing approval. It can come later if wanted.
  • The step has no Open link. Steps carry no link today, and result cards are action-only. The called run's chat link is in the tool's output (the answer can link it), in the person's Inbox and in the agent's Run history.
  • The called run starts at once. It doesn't wait in the workspace's run queue: it runs in its caller's place. A called agent already running on that brand is refused as busy (the one-held-run-per-agent-and-brand index).
  • run_subtasks (CHAT-27 phase 1) is not here. Per T3 it is separate later work, proposed as its own PR.
  • The real-model test ($3 ceiling) is not run yet. It runs after this lands, as planned.

Related issue

None. Chat Wave 4, lane G (W4-26, W4-27).

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, as an Admin on Growth, with two active agents A ("Weekly report") and B ("FAQ writer") on the same brand:

  1. Open A › Edit › last step. Can call lists B (not A). Pick it and save. A's page shows "Can call: FAQ writer" under Access, and a new version is saved.
  2. On Starter, the row shows the Growth lock. A PATCH with canCall gets plan_locked. A PATCH naming A itself or an archived agent gets agent_not_found.
  3. Run now on A. Its first message ends "It may run FAQ writer if the task needs it.". When the model calls run_agent, a card shows "Run another agent · FAQ writer", the ask and "AI use: Up to N% of the monthly AI limit". Approve it in the Inbox.
  4. B runs in its own chat. Its first message says another agent runs it, and its changes ask first. A's step reads "Ran FAQ writer · Done · x% of the monthly AI limit", and A goes on with B's answer.
  5. On A's page, the run shows "Ran 1 agent ▾": open it to see B's result and AI use. On B's page, the run shows "Called by Weekly report".
  6. Click Stop on A while B works: B stops too. A fourth call in one run, or a call from B's run, is refused.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (changed files: 0 errors, 0 warnings)
  • 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.
  • web tests: 45 test files / 928 tests (registry, engine*, events, undo, write, every agent* file, agents and run components, help, subscription-guard and replay-masking coverage), plus go-live and app/api/chat (14 files / 304 tests, before the last fix).
  • server: format and lint on the changed files; chat-budget (44 tests).
  • Full suites and the build run in the fork's CI.

Screens: shown to the owner in a local preview (1024px, light and dark, with preview data) and approved on 2026-11-03: the Can call row on the form's last step, the agent page (Access › Can call, "Ran 2 agents" opened), "Called by" on the called agent's page, the run_agent card, and the "Ran {agent}" steps. The card's label (Goal → AI use) and the first message's wording changed after the screenshots.

CI passed on this branch (804ccc4), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41591681373): 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 14 commits November 2, 2026 09:12
…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]>
…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.
# 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
CHAT-27 phase 2, items 14-18 and 25, on 00466 (can_call,
called_by_run_id, trigger agent):

- run_agent: a write row offered only in an agent's run whose Can call
  names an agent that is on; a card in every mode with what it asks and
  the most of the AI limit the called run may use (Growth and up,
  Admins and Managers, no MCP tool). Names and shares are read within
  the run's workspace.
- The called agent runs as its own agent run on the caller's brand, as
  the caller's person, in the stricter of the two modes, its changes
  asking first; its cap is the smaller of its own and what is left of
  the caller's, and the server takes its spend out of the caller's cap.
  No chains, at most 3 calls a run, the caller's Stop stops it, and the
  caller's step waits at most 10 minutes. Its answer comes back as
  untrusted data and taints the caller's run.
- Can call on the agent form's last step (up to 5, never itself, locked
  below Growth); Called by and the runs a run ran on the agent's page;
  Can call under Access. Help article updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The caller's step waits inside the request that approved its card, and
approve's maxDuration is 300 s: Technical T3's 10 minutes can't fit.
Four minutes leaves the caller a minute to finish its answer.

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

The first message of an agent's run showed the tool's name and an
instruction about ids ("You may run these agents with run_agent ... their
ids are in the scope"). It now reads "It may run {agents} if the task
needs it."; the tool's description says the ids are in the run's scope.
The card's share row is labelled AI use, as the agent's page says it,
through a new card target kind.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…person's access

- A called run's cap now also takes out what the caller's earlier calls
  used, in the web and on the server (agentRunCapUsd holds a called run
  within what its caller and sibling runs left).
- run_agent refuses an agent the acting person can't see or run, anyone
  but that person, and a role or plan that can't run agents.
- Can call takes only agents the person saving it sees (picks already on
  the agent stay); Duplicate drops the ones they can't see.
gkhngyk
gkhngyk previously approved these changes Nov 3, 2026
# Conflicts:
#	help/chat/chat.md
#	server/src/lib/chat-budget.test.js
#	web/messages/en.json
#	web/src/lib/chat/budget.test.ts
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
@gkhngyk

gkhngyk commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

This PR now conflicts with main: #2003 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.

…chat-run-agent

# Conflicts:
#	web/messages/en.json
#	web/src/lib/chat/engine.ts
# Conflicts:
#	web/messages/en.json
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
#	web/src/lib/chat/events.ts
#	web/src/lib/chat/registry/define-tool.ts
#	web/src/lib/chat/registry/tools.test.ts
#	web/src/lib/chat/registry/tools.ts
@gkhngyk
gkhngyk merged commit d6aaf09 into ansvisor:main Nov 4, 2026
7 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]>
cihan-gyk pushed a commit to cihan-gyk/ansvisor that referenced this pull request Nov 4, 2026
…n_agent

Main's run_agent (ansvisor#2052) read an agent's Can call without leaving out the
demo brand's sample agents (00475), so a saved list naming one let another
agent run it. Saving a Can call that names one is now refused (demo_agent,
with its own words), and callableAgentsOf leaves them out, as Run agent's
picker does, so a run never offers or runs one, even one stored before.
Help: the agents article says other agents can't call them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMenyNyxsr2Doq4CaQ3
gkhngyk pushed a commit that referenced this pull request Nov 5, 2026
…agents never count (#2102)

* feat(demo): show sample chats in the demo brand's Chat

The demo brand showed the real Chat, locked and empty (#1999). A new demo
module (lib/demo/chat.js, DEMO_VERSION 4) now gives each person of the
organization five chats on the demo brand, as if they had asked them: the
questions, the reads Chat made as steps, the "Data used" chips, next moves
under the latest answer, and answers whose figures are counted from the
demo's own answers (stats.js) and link to its Action Center actions and
Content Editor drafts. A chat is its author's, so each person gets their
own copy; someone who joins later gets theirs at the next rebuild.

Sending in one, or starting a chat on the demo brand, is refused with the
server's demo_brand 402 before anything is kept or run (POST
/api/chat/runs), and the page opens the plans, as for a read-only
workspace: an answer on the demo brand would still use the workspace's AI.

Hiding the demo brand (the brand menu, or the purchase) deletes its chats,
since Chat's menu lists a person's chats of every brand; showing it again
marks it stale, so the next visit rebuilds it with them.

chat_conversations is now built by the demo; agent_conversations (the old
Agent chat) is skipped with its reason.

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

* feat(demo): show sample agents at work in the demo brand's Agent Center

Stacked on the demo's sample chats. The demo brand's Agent Center now has
four agents made from the ready-to-use ones (visibility watch, citation
win-back, competitor watch and a paused weekly report), with their
versions, triggers and run history, each run with its chat (Open run).
Schedules run at their own slots, worded from the demo's own answers; one
win-back run waits on its owner's OK to save a draft, so the Inbox has
something under Needs you.

An agent belongs to the workspace, not to a brand, so 00475 marks the
demo's agents with the demo brand they show (chat_agents.demo_brand_id,
on delete cascade, a partial index, and a trigger that only takes a demo
brand of the agent's own workspace). Nothing runs, counts or pauses them:

- agentForAct refuses every act on one with demo_brand (402: the plans);
- the triggers' active agents, the sweep's failures, the own key's
  resume, the plan's active-agent counts and limit, and what may run
  (Run agent, an action's agents) leave them out;
- settleAgentRun leaves a demo brand's runs as built (the waiting run has
  no Chat run state, so the engine's sweep never sees it either);
- Approve, Skip and an answer on a demo brand's card answer the
  server's demo_brand 402 before anything resumes.

Hiding the demo brand deletes its agents with its chats; showing it again
rebuilds them (DEMO_VERSION 5). chat_agent_runs is now built by the demo.

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

* fix(demo): mark the demo's sample chats read, so they list as chats, not Inbox news

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

* fix(demo): name the sites Perplexity cites for the prompts it misses, from the demo's data

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

* fix(demo): give the demo agent's waiting run its run state, so its card shows, never expired

The events route reads whose run it is from chat_run_state: without it the
waiting run's card never showed (404). Its state has no waiting_since, so
the engine's sweep, which stops a card a week after it was shown, never
picks it up; Approve, Skip and an answer stay refused with demo_brand.

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

* fix(demo): hide Agent Center's active count on the demo brand, whose agents never count

Beside the demo brand's four sample agents the count of active agents (the
plan's, 00475 leaves them out) read 0. On the demo brand there is none; the
plan's count and limit still leave the demo's agents out.

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

* fix(demo): open the plans when a skill runs on the demo brand

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

* fix(demo): delete the sample agents' runs when the demo is hidden, and keep them out of the sweep's settle pass

Review on #2102: a deleted agent's runs stay (agent_id set null), so the
demo's waiting run outlived a hide as a permanent needs_you row, and the
settle pass, reading the 500 oldest open runs, could fill up with them.

- Both hide paths (server hideDemoAgents, web hideDemoBrandAfterPurchase)
  delete the demo brand's chat_agent_runs before its agents.
- The settle pass reads open runs a page at a time and leaves out those
  on a demo brand, so a real run is settled however many demos wait.

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

* fix(demo): keep the demo brand's sample agents out of Can call and run_agent

Main's run_agent (#2052) read an agent's Can call without leaving out the
demo brand's sample agents (00475), so a saved list naming one let another
agent run it. Saving a Can call that names one is now refused (demo_agent,
with its own words), and callableAgentsOf leaves them out, as Run agent's
picker does, so a run never offers or runs one, even one stored before.
Help: the agents article says other agents can't call them.

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

---------

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants