Name: [FIX] viin_ai: per-company automation seed (#88) + BYOK cost-cap governance (#93)

State: Killed

PR State: merged

PR Author: David Tran

PR Author Email:

PR: #95

Committer: David Tran

Committer Email: davidtran.hp@gmail.com

Commit: 302bb69aaca3b259688856f76bbb8bf2a83e99cf

Description:

                                            [FIX] viin_ai_workflow: drain all due routines per heartbeat tick

_cron_run_routines fetched a single hard-capped batch (limit=50) then
post-filtered by _is_due(), so once #88 seeds 8 routines per company the
window was exhausted past ~6 companies and due routines drifted to later
ticks (cadence drift / partial starvation). limit is now a per-iteration
BATCH size and the method loops until every due routine is drained,
excluding already-seen ids so a not-due routine cannot spin the loop.
Batch size and an optional wall-clock time budget are configurable via
ir.config_parameter (cron_batch_size default 50, cron_time_budget_seconds
default 0 = unlimited). Every existing safety property is preserved -
per-routine cr.savepoint() isolation, with_user/with_company, failure
tracking outside the savepoint - and no cr.commit is added.

Adds a scale regression test: N due routines beyond one batch drain in a
single tick.

Follow-up to #88.

Signed-off-by: David Tran <davidtran.hp@gmail.com>
                                            

Branch: 17.0

Instance ID: 0

Age:

Up-time: Not finished