Repository navigation
feat(server): read a draft's Content Quality for an agent's go-live gate, on the run's budget - #1978
Merged
gkhngyk merged 7 commits intoNov 2, 2026
Conversation
…permission AUTONOMOUS-GO-LIVE PR 1 (migration 00443), with nothing reading it yet: chat_settings gains the workspace switch (auto_go_live_groups, who turned it on, when, under which terms); chat_agent_go_live keeps an agent's permission for the version it was given on, with its daily limit (1-20, 5 unless set); chat_agent_go_live_events keeps each step an agent takes live on its own, read by brand access. reserve_agent_go_live and finish_agent_go_live (service role) hold the daily limit under a lock per agent, once per (draft, target); a failed step frees its slot. Types, schema.sql, and the brand-access and demo coverage lists follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er session AUTONOMOUS-GO-LIVE PR 4 (migration 00444). POST /api/internal/chat/go-live/send (CRON_SECRET) is how the web's engine will send an agent's page on its own: it checks everything again from the database (Chat on, Full auto's plan, the Admins' switch, the run running as the person, the agent's permission for the run's version, the person's role and the Managers' publishing switch, brand access, not the demo brand, and the step's own reservation), then sends as a person's Send to CMS does, with the agent run kept on the delivery (content_draft_deliveries.agent_run_id). The step is finished done, or failed with why, which frees its slot; a refusal frees only this step's own slot. Never retried. v1 takes CMS drafts only. Nothing calls it yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ate, on the run's budget AUTONOMOUS-GO-LIVE PR 2b-1 (the owner's 2026-11-02 decision). POST /api/internal/chat/go-live/quality-reads (CRON_SECRET) reads the draft as saved for the web's gate: its links, and with Quality's phase 2 its claims, its page read and the kinds of the sites the gate's rules can't place. A kept read costs nothing; a new one is the agent run's own step (chat-budget agentRunReserve: feature agent, within the run's cap and the month's budget), not the workspace's Quality budget. Each read answers on its own (run_cap, ai_budget, off, failed), so the gate can hold the page on the one it lacks. The three reads take an optional meter; the page read's brand context moves to content-page-context.js for both callers. Nothing calls the endpoint yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…trust with the draft's reads Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mo guard leaves Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-reads Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 13 tasks
# Conflicts: # server/src/lib/brand-access-policies.test.js # server/src/routes/internal-chat-go-live.js # server/src/routes/internal-chat-go-live.test.js # supabase/schema.sql
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
AUTONOMOUS-GO-LIVE PR 2b-1: the server reads a draft's Content Quality for an agent's go-live gate, on the agent run's budget (§6.2; the owner's 2026-11-02 decision). Stacked on #1970. No migration. Nothing calls it yet; PR 2b-2's web gate will.
What changes
POST /api/internal/chat/go-live/quality-reads(CRON_SECRET, inroutes/internal-chat-go-live.js),{ orgId, agentRunId, runId, actingUserId, draftId, sites }.link-check.js, the person's hourly reads);readBrandFacts) and its site's trust (readSiteTrust), as the editor reads them through the API.{ ok: true, value }or{ ok: false, code }(run_cap,ai_budget,off,failed). The gate can then hold the page on just the read it lacks.chat-budget.js:agentRunReserve(orgId, { runId, agentRunId })is a meter with plan-guard'sreserveAiBudgetinterface (charge,release,keep). It holds each read as the run's own step: featureagent, within the run's cap and the month's budget. Write errors are logged, asreserveAiBudget's are.reserveChatSteptakesholdUsdfor such small calls.readDraftClaims,readPage,readSourceClassestake an optionalreserve. Without it, nothing changes (the workspace's Quality budget).content-page-context.js, used by the editor's route and the gate. The route reads the same.Costs: a new read holds
CLAIMS_HOLD_USD,PAGE_HOLD_USDorSOURCE_CLASS_HOLD_USDand is charged at its real cost. A kept read costs nothing.Related issue
None. AUTONOMOUS-GO-LIVE spec, PR 2 (2b, server part).
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 unit tests:
chat-budget: the meter's hold, charge, second call, release, keep, run cap;content-pages: unchanged;internal-chat-go-live: reads on the run's meter, each failure on its own, phase 1, refusals.No visible change, no Help article, no AI call in tests.
Checklist
yarn lintpassesyarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)CI passed on this branch (3ae561b), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41362898951): schema is up to date; web
format:check, lint, typecheck, all tests andyarn buildpass; server lint,format:checkand all tests pass.🤖 Generated with Claude Code