d4e254b3494de7ce47477b9421e8c8d3e035e104
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
416df69b00 |
feat(egress): credential resolver backed by declared-and-granted run credentials
docs/prds/external-agent-harness.md (Credentials) and orgs-and-access.md: egress.Resolver had no production implementation, and no run carried a credential naming the org secrets its identity is granted, so a Kit's required credential@1 was refused at the proxy and no harness run authenticated (archie-core-egkf.11). Two things, as scoped (this does not attempt #1026's full run-credential consolidation replacing WorktreeGrantIssuer/StateStoreGrantIssuer -- that PRD item is real, separate, and still open; this is deliberately narrower): 1. A run credential naming granted secrets: config.CredentialBinding maps a Kit credential@1 service to a secret; config.Config/IdentityConfig gain Org and GrantedCredentials (a per-identity allowlist of service names, reusing the existing per-identity config-override pattern DiffCapLines already uses, not a new Cedar/Authorizer integration -- KindSecret policy objects exist in internal/domain/access but assembling a full Principal is #1026's job, not a two-line addition here). config.ContainerConfig. BoundCredentials computes the declared (Kit) ∩ granted (identity) ∩ org-matched intersection Sam's own rule requires: neither side widens the other, proven by a mutation-checked test flipping each of the three independently. 2. egress.GrantResolver: the production Resolver, holding only what a caller explicitly Grant-ed one run, replaced wholesale (not merged) on a repeated Grant, gone entirely on RevokeGrant. kitrun.Launcher.Launch computes the intersection per launch and resolves real values through the existing secret registry (SecretResolver), Grants it before the proxy session opens, and Release/error-path rollback (a new shared Launcher.release) always revokes it. Course-corrected mid-implementation (flagged by Sam): credential bindings first landed as a boot-time config.ContainerConfig.Credentials field captured once into Launcher.Bindings -- exactly the "parses but is not a resource" trap CLAUDE.md warns about, and inconsistent with agent-profiles (#1207) making a Kit profile apply without a restart. Rebuilt as its own live control-plane resource, CredentialBindingsKind ("credential-bindings"), following the agent-profiles/container-runtime-policies split precisely: config.ContainerConfig.Credentials is json:"-", [containers].credentials is only its seed, and kitrun.Launcher now holds *config.Holder (not a captured slice) and reads Containers.Credentials fresh on every Launch. Org/GrantedCredentials were already read fresh per dispatch (d.configFor inside runKitTask, never cached), so no equivalent fix was needed there. Deliberately not built: identities and grants as their own State Store resource (orgs-and-access.md's "Org owns ... identities and their grants"). Identities are entirely config.toml-defined today with no control-plane resource at all; moving GrantedCredentials alone into one would put half an identity in two places. That migration is identities' own scope, not credential bindings'. |
||
|
|
cc6d606de4 |
feat(controlplane): agent profiles as their own live control-plane resource
docs/prds/external-agent-harness.md ("Selection"): a Kit profile is an org
resource that applies without a restart. Profiles were bundled inside
container-runtime-policies (ApplyMode: restart-required), which is correct
for Image/MaxConcurrency/Network but not for Profiles, which nothing
startup-builds: daemon.configFor reads config.Holder fresh per dispatch
(pinTaskProfile -> Containers.Profile).
Split Profiles into its own resource, AgentProfileKind ("agent-profiles"),
ApplyMode: live, seeded from [containers.profiles] and validated with the
same rules the file document uses (config.ValidateAgentProfiles, factored
out of ContainerConfig.ValidateProfiles so the two cannot disagree).
config.ContainerConfig.Profiles is now json:"-" so container-runtime-policies
never carries it (one authoritative resource per field, not two), and
runtime_config.go layers the new resource in by wholesale map replacement
(matching ModelRoleAssignmentsKind's precedent) rather than merging into the
file's map. Added Profiles to reload.go's Containers reloadable-subfield set
to match this.
Deliberately NOT built here: true per-org multi-tenant storage for this
resource (docs/prds/orgs-and-access.md places agent profiles under org
ownership, granted to workspaces). No existing control-plane resource kind
in this registry does real per-org storage yet either -- schedules,
workflow settings, etc. are all single instance-wide documents -- so
agent-profiles follows that same established, tested pattern rather than
inventing org-scoped storage unilaterally for this one resource. Org/
workspace grants over agent-profiles are a follow-on, not a redo: nothing
about this resource's shape needs to change to add that scoping later.
|
||
|
|
d1cba5c1ab |
fix(control-plane): give the container document its own shape
container-runtime-policies seeded and validated config.ContainerConfig directly,
the last resource in the registry whose document was the internal config struct
(archie-core-1171). encoding/json fell back to that struct's Go field names --
Image, MaxConcurrency, LegacyEnabled, Profiles -- the only Go-cased keys the Web
UI still rendered, and case-insensitive matching let a lowercase misspelling
("maxconcurrency") decode as the field while "max_concurrency" was read back
half-applied.
Define the document here instead: containerRuntimePolicies with explicit
snake_case tags and agentProfile at the profile nesting level, the same shape
|
||
|
|
21e4d47907 |
docs(development): checklists for every kind of change
docs/development/ holds one page per kind of change (settings, State Store and persistence, task lifecycle, workflows and steps, event automation, dashboard, agent execution and containers, processes and wiring, merging work), each naming every layer the change must reach and pointing at the document that owns the design. The docs build puts them in the development set; docs/index.md and CLAUDE.md link them. Also adds the container-profile case to the validator agreement test, the check the profiles work skipped. |
||
|
|
2eba3487a8 |
fix(controlplane): make the scheduling policy carry the label its trigger pairs with
The scheduling-policy resource carried the dispatch trigger but not the trigger-matching label, so validateScheduling could judge only half of the pairing the file layer's validateDispatch enforces on the effective document (a label-requiring trigger with no label matches every open issue -- the GH#445 guard). The write path therefore stored trigger label/either with no label whenever the file's own label was unset, and boot then refused the layered document: a value the store blessed, archied unstartable, the operator left with the offline rollback as the only remedy (archie-core-7pyj). The resource now carries the label: the seed copies the file document's label, RuntimeConfig layers it with the trigger (a policy stored before the field existed decodes nil and leaves the file's label in force, the same absence-means-inherited shape a kind with no stored value has), and validateScheduling refuses a label-requiring trigger with no label, the pairing judged on the data the store actually holds. Once the store carries a label it owns it, so a file that later loses the label can no longer break a stored policy that depends on one. The parity test gains both directions, and a legacy policy without the field is pinned as an absence, not an erasure. |
||
|
|
da7021c674 |
fix(controlplane): a kind with no stored value leaves the file's value in force
The fix-closure review found the previous pass moved the failure instead of ending it. A seed the resource validator refuses leaves the kind ABSENT, and RuntimeConfig treated an absent kind as fatal, so archied and the Gateway refused to start with "control-plane resource not found" -- a database-named error that editing config.toml cannot clear. Reproduced before the fix: every kind in the new table failed that way. Two changes, one on each side of the seam: - Client.RuntimeConfig (and RuntimeChatConfig) now treat a kind with no stored value as "the file document's value stays in effect", which is what the skip-and-report comment already claimed. The version map records no version for such a kind, so nothing is reported as applied. A value the file layer also refuses still fails closed, at configuration.Validate, with a message naming the file's own field -- and the file is the fix. - Which repository lists are valid can no longer differ between the layers. configuration.ValidateRepositories is now the single rule set (owner and name present, no duplicates, compilable test glob) and the repository-policies resource validator delegates to it. The file layer had no duplicate rule while the resource layer did, so a duplicate [[repos]] entry passed the loader and then vanished into a skipped seed. Also, from the same review: the scheduling validator's "0s" carve-out is gone, so a zero poll interval is refused at write time as configuration.Validate refuses it (there is no defaulting behind a stored value); applyOverlayFile's doc now says which overlay forms fold (a conf.d extra does not, and nothing reads cfg.Extra); and plugin-settings' no-op validator is a named function with the reason it accepts everything. |
||
|
|
3ed0a7982d |
fix(config): judge a database-owned setting at the layer that owns it
Review of the two previous commits found the split was incomplete in both directions: the checks moved off the file load path were still enforced anywhere the value could enter the system, and the fold reached only one of the three overlay paths. A stale database-owned TOML value could still stop archie-state-store. The process seeds every control-plane resource from the same file config on a fresh database, and the seed runs the resource's own validator; three of the five values the loader now accepts aborted the boot there (verified by booting RunStateStore before the fix). A seed that does not validate is now SKIPPED and reported instead of fatal: the resource stays absent, so the file's value is the one in effect and editing config.toml is still the fix -- the daemon and the Gateway are where it fails closed, at boot.runtimeConfig. The resource validators were weaker than configuration.Validate for exactly the fields the split reclassified, so a value the file path used to refuse at load became storable in the database, and then un-fixable by editing config.toml. The trigger enum and the test-glob rule now come from the configuration package rather than being restated, the container image is required there as it is in the file, and a table test ties the two layers together value by value. The directory form of -config-overlay kept the archie-core-e2e2 failure: it decoded each overlay file straight into the populated config, so a map-valued entry it only partly addressed still cleared the fields it did not name. Both the overlay layer's main file and its feature files now fold, which is what Loader.Dir's documented parity with Loader.Overlay has always claimed. The overlay file's key report is derived from the apply's own view of the file as well as the file decode's, because TOML matches keys case-insensitively and the fold's yaml decode does not: a key only the file decode matched was consumed by the report and dropped by the apply, a silent no-op that worked in the base file. Tests: the state-store boot is asserted against the real process, the directory overlay and the case-mismatched key each have one, and ImportConfig pins that a refused seed is not stored. |