Bill a turn to the node that asked, not the node that generated
Every turn runs on the AI owner now, so the ledger's per-host column had collapsed to a single name and the fleet breakdown said nothing. The asking node travels with the request and is validated before it is written, which also retires ai_token_sync.sh — a partner ledger is empty by construction.
This commit is contained in:
@@ -525,7 +525,11 @@ function vv_ai_dispatch(string $action, array $p, bool $isPost, int &$httpStatus
|
||||
. escapeshellarg($scope) . ' '
|
||||
// Asked for per turn. Only meaningful on a profile holding web_search — the worker
|
||||
// checks that, so a crafted web=1 against any other profile changes nothing.
|
||||
. escapeshellarg(($p['web'] ?? '') === '1' ? '1' : '0')
|
||||
. escapeshellarg(($p['web'] ?? '') === '1' ? '1' : '0') . ' '
|
||||
// Who asked. Set by the RPC layer for a forwarded turn and absent for a local one,
|
||||
// where the worker's own default is already correct. This is what keeps the token
|
||||
// ledger's per-host column meaningful once every turn generates on the owner.
|
||||
. escapeshellarg((string)($p['_vv_node'] ?? ''))
|
||||
. ' >/dev/null 2>&1 </dev/null &';
|
||||
$out = []; $rc = 0;
|
||||
exec($cmd, $out, $rc);
|
||||
|
||||
Reference in New Issue
Block a user