feat(pilot): add thin Central proxy + JWKS-based bench↔Central auth#164
Conversation
- CentralClient billing methods (summary, plans, gateways, profile, payment setup/confirm/remove, top-up, reconcile) - sites/<site>/billing/* admin routes; usage meters composed from host stats - tests cover the client endpoint/verb/body contract Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Confidence Score: 5/5This looks safe to merge.
Reviews (8): Last reviewed commit: "fix(admin): drop dead latest_system_metr..." | Re-trigger Greptile |
Return the billing-error shape (not 500) when Central's summary isn't a dict, and measure disk usage on the bench's own mount instead of root. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@tanmoysrt @Aradhya-Tripathi Are we showing any billing settings in Pilot? (AFAICT, the first iteration had the billing in the sidebar. Otherwise, most of this is just a passthrough Will it make anything simpler? Just thinking out loud. |
|
We ideally dont want to show any billing information in Pilot and passthrough directly to central from site. Cc: @Prathamesh correct me if thats not in your plan. |
We can't do this right? We decided on this because Central cannot directly authenticate requests from site. Site to Pilot has JWT authentication and Pilot to Central has the X-Pilot-Auth token via bench.toml. |
The in app billing lives but its centrals responsibility iirc. |
|
Just a thought. Maybe use pilot as proxy only ? Pilot can attach some context like site name and its auth token to the request. |
Pilot as proxy can work I suppose. Giving it a try. |
|
you have added wrong prathamesh
…On Mon, 13 Jul 2026 at 2:54 PM, Prathamesh Kurunkar < ***@***.***> wrote:
*prathameshkurunkar7* left a comment (frappe/pilot#164)
<#164 (comment)>
Just a thought.
Maybe use pilot as proxy only ? No need to implement the methods for api
calls, it can be /central/<site_name>/<central's_api_route> or
/central/<central's_api_route>
Pilot can attach some context like site name and its auth token to the
request.
Pilot as proxy can work I suppose. Giving it a try.
—
Reply to this email directly, view it on GitHub
<#164?email_source=notifications&email_token=AAEJJ3564UBESJWJELX7NDL5ESTFDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJVGY2DENZQGI2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4956427024>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEJJ37ASMYGZ3VJ5EDUXO35ESTFDAVCNFSNUABGKJSXA33TNF2G64TZHMYTENBVGMYDENJXGY5US43TOVSTWNBYGA4DSNJWG44DDILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAEJJ3ZKMPVWJDX3X67J7335ESTFDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJVGY2DENZQGI2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AAEJJ353DHINXDVBT3HNPDD5ESTFDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJVGY2DENZQGI2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Replace the ~15 hand-mirrored billing methods (CentralClient) and their Flask routes with one allowlisted proxy route: `sites/<site>/central/<method>` forwards a pilot-facing Central call with the bench's X-Pilot-Token. Central resolves team + asset from the credential, so no ids travel from the site. CentralClient is now a thin transport (credentials + heartbeat + forward). Adding a Central method needs no Pilot change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`bench enroll` exchanges a single-use bootstrap token for this bench's long-lived Central credential + JWKS trust config, writing both into bench.toml (idempotent). Seed resolution: explicit args → --seed-file → a canonical metadata path, so a bare `bench enroll` on first boot picks up whatever VM metadata dropped there. CentralConfig gains a transient `bootstrap_token`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Condense the module/comment blocks and docstrings added for the Central proxy and enrollment to at most two lines each, per the repo's low-verbosity guideline. Comments only — no behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Linked issue : #185 |
Integrate the backend refactor (api/v1, providers, pilot/integrations). Conflicts resolved: app.py taken from main; the Central proxy kept as-is. Adapting the Central integration to the new layout is a follow-up.
…yout Adapt the Central work to the structure merged from main: - pilot/integrations/central/ package — client.py (CentralClient) + bootstrap.py (enrollment), public surface re-exported (matches git/ and s3/). - admin/backend/api/v1/sites/central.py — proxy registered on sites_bp, using middleware.require_scope + api.responses.error_response. - enroll command → pilot/commands/admin/enroll.py; central tests → tests/pilot/integrations/. - Update the command-discovery and route-inventory baselines for the new enroll command and sites.central_proxy route.
Did the requested change.
tanmoysrt
left a comment
There was a problem hiding this comment.
LGTM for now. Will refactor later if needed
Bring in the config-module refactor (pilot/config/*_config.py -> *.py). Re-add the Central integration's `bootstrap_token` on the new CentralConfig (field + from_dict) after the modify/delete conflict, and point the proxy test at the relocated admin_auth session helpers.
…Reader) The function had no callers (it once backed the removed billing usage meters) and referenced MonitorHistoryReader, which no longer exists — a merge artifact that failed the mypy CI check. main has no such function. Removing it.
…g-client feat(pilot): add thin Central proxy + JWKS-based Pilot↔Central auth
feat(pilot): Central billing client + site-billing admin routes
The pilot side of the tab: a Central billing client and the sites//billing/* admin routes the site calls.
Adds
CentralClient billing methods (summary, plans, gateways, profile, payment-method setup/confirm/remove, top-up + checkout status, reconcile) — POST support + {"message": …} unwrap.
sites//billing/* routes (@require_scope) that proxy them. Usage meters are composed here — percentages from the bench host (psutil) merged with Central's plan labels.
Tests: client endpoint/verb/body/unwrap contract.
Depends on the Central PR - frappe/central#119.
Edit:
feat(pilot): thin Central proxy + JWKS-based bench↔Central auth
Stops mirroring Central's API inside Pilot and wires up the bench's two-way trust with Central.
Thin proxy: one allowlisted route (sites//central/) forwards pilot-facing Central calls with the bench's token — deletes ~15 hand-mirrored billing methods/routes. Adding a Central method now needs no Pilot change.
bench enroll: exchanges a bootstrap token for the bench's credential + JWKS config and writes them to bench.toml (idempotent; also reads a create-time metadata seed so first-boot enrollment needs no arguments).
Verifying Central-minted SIDs (downward auth) already existed on this branch and lines up with the new token shape.