mirror of
https://github.com/bitbaum/openclaw.git
synced 2026-12-04 14:29:45 +01:00
* feat(approvals): standing-grant ledger, revocation, and configurable terms Completes the operator half of cron standing grants (#129526): - Grants are listable and revocable. New gateway methods exec.approval.grants.list/revoke (operator.approvals scope), CLI 'openclaw approvals grants list|revoke', and a Standing grants section on the Control UI approvals page with per-row revoke. Revocation is idempotent, records the acting client, and takes effect at the next occurrence's spawn boundary. - Grant terms are frozen at mint and configurable. Default stays until-revoked (matching what shipped Always allow has always meant); tools.exec.grantExpiryDays sets a day-bounded default for future grants (enterprise fleet policy), and resolve surfaces may override per grant via grantExpiresInDays / --expires-in-days. Existing grants keep their minted terms; config changes are never retroactive. - expires_at_ms goes nullable (NULL = until revoked). The mandatory- expiry shape never reached a release tag, so the lazy ensure rebuilds it in place; grants are re-derivable authority, so the fail-closed cost is one re-prompt. - Approval cards say what Always allow does. Automation approvals carry a standing-grant ApprovalScope (new union member) built server-side from the cron run registry (now carrying the job display name); the Control UI inbox card and modal render it via i18n, e.g. 'Always allow runs this exact command for "grant-demo" without asking, for 10 days (revocable)'. - Aux method registries stay in lockstep: new parity test fails when a GATEWAY_AUX_METHODS entry lacks a lazy handler (this gap produced live unknown-method errors during bring-up). Live-proven on a hermetic gateway: until-revoked grant ran 62 promptless occurrences; UI and CLI revocation each returned the prompt on the next occurrence; config default stamped exactly 10.0 days via a UI resolve; --expires-in-days 99 override stamped 99.0 days; ledger and card screenshots captured from the running Control UI. * chore(ui): annotate the scope narrowing assertion for the safety ratchet * test(gateway): move aux-method parity check to its own suite * fix(ci): boundary-parse UI approval scope; register grants schemas for native codegen - The Swift/Kotlin generators discover named schemas through the protocol schema fragments; the standing-grant scope member and the grants list/revoke shapes were missing there, which made the Swift generator silently drop the ApprovalScope union and broke ios-build. Registered, regenerated, union and new struct emitted again. - The chained-assertion lane rejects 'as unknown as' in the UI scope parser; replaced with a real per-kind boundary parser, which is what the rule asks for. - The sqlite-allow-raw marker must share the line of a mid-statement prepare() call for the Kysely guardrail; split the pragma read so the SAFETY comment and the allow marker each sit on their own guarded line. * chore(ui): record startup-budget growth for the approvals scope line The standing-grant scope renderer and grants-ledger strings ride the boot path (~700 B gzip). Recorded via the check's --update-baseline flow with the reason inline; well under the committed 350 KiB hard cap. * fix(gateway): restore the channel-restart helper export dropped on main #118157 made startGatewayChannelFromActiveRegistry module-local while its colocated test still imports it, breaking check-test-types and the compact shard on every merge ref. Smallest correct main heal per the broken-CI doctrine; the test passes again. * fix(gateway): drive channel-restart reload coverage through its exported owner Replaces the prior export restore: #118157 made the restart helper module-local (the dead-export scan is right that tests are not production consumers), but left its colocated test importing it, so main failed check-test-types either way. The test now exercises the same preserveManualStop semantics through rollbackStoppedGatewayChannels, the exported reload owner, and the helper stays private. * test(ui): answer the grants ledger request in approvals-page history tests The approvals page now loads the standing-grant ledger next to history; a method-aware stub answers it out of band so the ordered history mocks keep their call counts. Adds coverage for the ledger render and the revoke round-trip. * chore(ui): record CI-observed startup-JS baseline for the grants surface The e2e-real-gateway lane builds the same tree ~600 B larger than checks-ui and local builds, past the 64 B variance allowance; record the CI-observed value so the enforcement limit stops straddling cross-lane build variance. * fix(cli): escape standing-grant ledger fields visibly; register grants methods in inventory tests The grant ledger's revokedBy (client display name), automation label, and agent-authored command now go through escapeApprovalTextForTerminal like the pending-approvals table, so hostile control characters render as visible \u{...} escapes instead of being silently stripped by the table renderer. Regression test fails pre-fix. Also lists exec.approval.grants.list/revoke in the 2026.8 release-train roster, classifies the approvals grants command group for JSON output, and fixes the stubGrants mock typing.