credentialFile {{.Scopes}}: capture and persist the token response scope #225
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#225
Reference in new issue
Block a user
{{.Scopes}} has no source anywhere in archie, so egkf.14 is blocked on this.
The published Claude Code Kit renders scopes: "{{.Scopes}}" (credentialFile.structure),
and the renderer refuses an unsourceable placeholder by design.
Every link in the chain is missing (verified at commit
7d34b57f):only access_token / refresh_token / token_type / expires_in. RFC 6749 section 5.1 puts the
granted scopes in a space-delimited
scopestring, which nothing here looks at.(Org, Service, AccessToken, RefreshToken, TokenType, ExpiresAt, UpdatedAt).
(harnessSecretPayload). It is JSON inside the encrypted envelope, so no SQL migration is
needed; the envelope is the whole token set.
This is mandatory, not optional: the daemon reads the set through a gRPC client
(internal/app/archied/bootstrap.go:424, b.stateStore = client), so a field that is only
added to the local struct is lost in production.
to/from proto.
Change shape: parse
scopein capture into []string (split on space, drop empties, keep theprevious set when the field is absent -- providers may omit it), add Scopes to
harnesssecret.Secret and harnessSecretPayload, add
repeated string scopesto the proto andregenerate, map it in values.go, then have kitrun.oauthExpiries pass it alongside the expiry
and the renderer substitute an array for {{.Scopes}}.
Acceptance: a Kit whose credentialFile references {{.Scopes}} launches, the rendered file holds
a JSON/TOML array of the granted scopes, and no real access or refresh token appears in it.
Notes
Merged and gated. Capture parses the token response's scope with strings.Fields and keeps the previous set when the field is absent (mirroring the refresh-token rule); harnesssecret.Secret.Scopes; harnessSecretPayload.Scopes (JSON in the encrypted envelope, so no migration); proto HarnessSecret repeated string scopes = 8; staterpc values.go maps both ways with slices.Clone on the wire->domain direction. Proved by a real proxy-path test (present scope replaces, absent scope preserves) and the local+grpc conformance round trip on real Postgres.
Close reason
Closed
Imported from beads
archie-core-egkf.15· GitHub #1422 · type task · priority P1 · created 2026-09-29 · closed 2026-09-29