refactor: strip doc and issue narration from code comments
Remove PRD/doc paths, bead IDs, phase notes and deleted-test references from comments; drop test-only hooks left by the test deletion. Includes in-progress archied bootstrap, gateway and query changes.
This commit is contained in:
269 files changed
+1201
-2609
No files matched your search
@@ -42,12 +42,12 @@ type hybridTrees struct {
|
||||
localDir string
|
||||
branch string
|
||||
// worktreeUID and worktreeGID are the daemon's own host UID/GID
|
||||
// (WORKTREE_UID/WORKTREE_GID, set by containerEnv), or -1 when unset.
|
||||
// The agent runs as root inside the container, so a commit it writes
|
||||
// to the bind-mounted worktree lands owned by UID 0 on the host; Push
|
||||
// reconciles ownership back to the daemon's UID before handing off,
|
||||
// since the daemon -- running as its own non-root host user -- is the
|
||||
// one that reads those objects to actually push (archie-core#520).
|
||||
// (WORKTREE_UID/WORKTREE_GID, set by containerEnv), or -1 when unset. The
|
||||
// agent runs as root inside the container, so a commit it writes to the
|
||||
// bind-mounted worktree lands owned by UID 0 on the host; Push reconciles
|
||||
// ownership back to the daemon's UID before handing off, since the daemon
|
||||
// -- running as its own non-root host user -- is the one that reads those
|
||||
// objects to actually push.
|
||||
worktreeUID, worktreeGID int
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ type taskDependencies struct {
|
||||
// steps is the workflow step vocabulary pinned definitions are compiled
|
||||
// against, registered at the composition root and injected: this is the
|
||||
// executing half of the contract whose validating half is the control
|
||||
// plane's (archie-core-fwmp).
|
||||
// plane's.
|
||||
steps *workflow.Manager
|
||||
// guardrails is the guardrail engine agent stages record tool outcomes
|
||||
// against. It is built by this process's composition root (the workflow
|
||||
@@ -270,13 +270,12 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
}
|
||||
// The agent process runs as root inside the container, so everything this
|
||||
// run writes into the bind-mounted worktree is owned by UID 0 on the host;
|
||||
// CommitAll and Push hand it back on the success path (archie-core#520).
|
||||
// Doing the same here covers every OTHER way a run can end -- a gate
|
||||
// failure that parks the task, a stage error, an early return -- because
|
||||
// the daemon is the one that later cleans and resets this directory, as its
|
||||
// own non-root host user, and it cannot even unlink a root-owned directory.
|
||||
// Without this, a parked attempt left a worktree the next attempt could not
|
||||
// start from.
|
||||
// CommitAll and Push hand it back on the success path. Doing the same here
|
||||
// covers every OTHER way a run can end -- a gate failure that parks the
|
||||
// task, a stage error, an early return -- because the daemon is the one
|
||||
// that later cleans and resets this directory, as its own non-root host
|
||||
// user, and it cannot even unlink a root-owned directory. Without this, a
|
||||
// parked attempt left a worktree the next attempt could not start from.
|
||||
defer restoreWorktreeOwnership(trees, workDir, log)()
|
||||
|
||||
// The MCP providers a task hosts share the same model runtime its agent
|
||||
@@ -305,7 +304,7 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
// processes connected only by NATS. Without this bridge, tc.Emit is a
|
||||
// silent no-op for every stage/outcome/park event this run produces,
|
||||
// which is why the dashboard timeline showed nothing for any task
|
||||
// executed through the container/NATS path (archie-core-518). Nil
|
||||
// executed through the container/NATS path. Nil
|
||||
// dependencies.events (a caller with no NATS connection, e.g. tests
|
||||
// that construct taskDependencies directly) leaves bus nil, and
|
||||
// TaskContext.Emit is already nil-safe.
|
||||
@@ -335,7 +334,6 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
// prefetchPRReview, writing under workDir/.archie-pr-review -- the same
|
||||
// host directory Docker bind-mounts at storage.WorktreeMountDir) -- never
|
||||
// over the network, and never with a forge credential in this process.
|
||||
// See docs/development/agent.md, "Giving the agent something new".
|
||||
if req.Task.Workflow == "pr-review" {
|
||||
tc.PRSource = prsource.NewFromMount(filepath.Join(workDir, prsource.PrefetchDirName))
|
||||
}
|
||||
@@ -362,9 +360,7 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
|
||||
|
||||
// CompilePinnedWorkflow resolves and compiles the immutable definition the task
|
||||
// request carries, against this process's step vocabulary. Production execution
|
||||
// and the workflow step-vocabulary contract test
|
||||
// (internal/app/controlplane/step_vocabulary_agreement_test.go) both enter
|
||||
// through it.
|
||||
// and the workflow step-vocabulary contract test both enter through it.
|
||||
//
|
||||
// A request that carries no definition is routed and pinned from the shipped
|
||||
// definitions, which writes the resolved workflow name, YAML, and digest back
|
||||
|
||||
@@ -36,11 +36,9 @@ type Settings struct {
|
||||
NATSToken string
|
||||
WorkDir string
|
||||
|
||||
// StateStoreTarget and StateStoreToken are the daemon-injected State
|
||||
// Store gRPC endpoint and bearer token (docs/prds/state-store-contract.md
|
||||
// §6: STATE_STORE_URL/STATE_STORE_TOKEN, mirroring the NATS_URL/NATS_TOKEN
|
||||
// handoff). StateStoreTarget is required: the legacy NATS storerpc path
|
||||
// is deleted (docs/prds/state-store-contract.md §12 step 4).
|
||||
// StateStoreTarget and StateStoreToken are the daemon-injected State Store
|
||||
// gRPC endpoint and bearer token. StateStoreTarget is required: the legacy
|
||||
// NATS storerpc path is deleted.
|
||||
StateStoreTarget string
|
||||
StateStoreToken string
|
||||
}
|
||||
@@ -72,12 +70,7 @@ type workerDependencies struct {
|
||||
guardrails *tools.GuardrailEngine
|
||||
}
|
||||
|
||||
// productionWorkerDependencies builds the worker's process dependencies. The
|
||||
// workflow step vocabulary is registered here, at the executing side's
|
||||
// composition root, before the first task is served:
|
||||
// internal/app/agentworker's step_vocabulary_test.go calls this function and
|
||||
// fails if it stops using the shared provider set
|
||||
// (internal/infrastructure/workflowsteps).
|
||||
// productionWorkerDependencies builds the worker's process dependencies.
|
||||
func productionWorkerDependencies() (workerDependencies, error) {
|
||||
steps, err := workflowsteps.NewManager()
|
||||
if err != nil {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// The `archied access reset` command: the locked-out-org and broken-instance
|
||||
// recovery surface (docs/prds/orgs-and-access.md, "Recovering from a
|
||||
// locked-out org"). It restores the shipped role policies for one org and
|
||||
// recovery surface. It restores the shipped role policies for one org and
|
||||
// removes its other org-level policies, or removes the stored instance
|
||||
// policies; the cross-org forbid is engine-enforced and survives any reset.
|
||||
//
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
)
|
||||
|
||||
// bindingCipherFromConfig resolves the binding at-rest encryption key from
|
||||
// config through the secret registry and returns the EDA store's cipher. An unset
|
||||
// encryption_key returns a nil cipher, keeping the legacy plaintext path (the
|
||||
// store's default). See docs/prds/binding-secret-encryption.md.
|
||||
// config through the secret registry and returns the EDA store's cipher. An
|
||||
// unset encryption_key returns a nil cipher, keeping the legacy plaintext path
|
||||
// (the store's default).
|
||||
func bindingCipherFromConfig(cfg config.Config, secrets *secret.Registry) (bindingcipher.BindingCipher, error) {
|
||||
if cfg.Bindings.EncryptionKey == (secret.SecretRef{}) {
|
||||
return nil, nil
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -5,10 +5,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/messaging"
|
||||
)
|
||||
|
||||
// carriesPersonIdentity reports whether a platform's SenderID names a person,
|
||||
// per docs/prds/memory-engine-unification.md §3: resolution is supplied per
|
||||
// channel by the composition, never inferred by the engine or guessed from a
|
||||
// channel-neutral "channel:SenderID" concatenation.
|
||||
// carriesPersonIdentity reports whether a platform's SenderID names a person.
|
||||
//
|
||||
// Telegram and email carry a native per-person sender id (a Telegram numeric
|
||||
// user id, an SMTP from address). The dashboard ("web") has one bearer token,
|
||||
@@ -37,7 +34,7 @@ func carriesPersonIdentity(platform string) bool {
|
||||
// It was closed over a single channel name, and one Gateway Router serves every
|
||||
// channel, so that name was "web" even for a Telegram turn: the allowlist above
|
||||
// was real code no production call site reached with a real channel name, and
|
||||
// Subject.UserID was always empty (archie-core-c1qx). Reading the platform off
|
||||
// Subject.UserID was always empty. Reading the platform off
|
||||
// the inbound is what makes the policy reachable.
|
||||
func userIdentityResolver() func(messaging.Inbound) (memory.IdentityID, bool) {
|
||||
return func(in messaging.Inbound) (memory.IdentityID, bool) {
|
||||
|
||||
@@ -48,7 +48,7 @@ type chatSetup struct {
|
||||
ChatTaskLogs gateway.ChatTaskLogReader
|
||||
ChatTaskActor gateway.ChatTaskActor
|
||||
DefaultChatIdentity string
|
||||
// Bus carries primary-input events (archie-core-035): a completed
|
||||
// Bus carries primary-input events: a completed
|
||||
// chat turn is published here so input-driven curators can wake. Nil
|
||||
// disables turn events (tests, minimal setups).
|
||||
Bus *events.Bus
|
||||
@@ -61,9 +61,8 @@ type chatSetup struct {
|
||||
// engine, resolved by cfg.Memory.Engine). Nil disables the chat <memory>
|
||||
// block for every turn runner built from this setup.
|
||||
MemoryEngine gateway.MemoryStore
|
||||
// MemoryWriter is the same active engine's write surface, used to build
|
||||
// the per-turn memory_create/update/delete/list tools (docs/prds/
|
||||
// memory-engine-unification.md §5). Nil omits those tools.
|
||||
// MemoryWriter is the same active engine's write surface, used to build the
|
||||
// per-turn memory_create/update/delete/list tools. Nil omits those tools.
|
||||
MemoryWriter gateway.MemoryWriteStore
|
||||
// ProviderOutcomes records the outcome of every chat-model call this
|
||||
// process makes, which the /status health source reads back. Nil disables
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
// validates the result. Boot and the SIGHUP reload both go through it: the
|
||||
// reload re-resolves the file document alone, so republishing that document
|
||||
// as it stands reverts each of these layers to its file value until the
|
||||
// process restarts (archie-core-ju85).
|
||||
// process restarts.
|
||||
func (b *boot) runtimeConfig(ctx context.Context, base config.Config) (config.Config, map[string]int64, error) {
|
||||
cfg, versions, err := b.controlPlane.RuntimeConfig(ctx, base)
|
||||
if err != nil {
|
||||
@@ -178,9 +178,7 @@ type executionSettingsCandidate struct {
|
||||
// be published as and runs this process's own runnability check on it -- the
|
||||
// same configuration.Validate that runtimeConfig applies before publishing a
|
||||
// layered config, and that the readiness probe applies to the published one. A
|
||||
// snapshot this process cannot run is refused before it becomes the live one
|
||||
// (docs/prds/runtime-control-plane.md, "API": Archie starts and checks the new
|
||||
// one before switching).
|
||||
// snapshot this process cannot run is refused before it becomes the live one.
|
||||
//
|
||||
// The kind's schema is deliberately not re-checked here. The store validates
|
||||
// every document before it is written (Definition.Decode) and
|
||||
@@ -332,7 +330,6 @@ func (b *boot) startRuntimeResourceWatches(ctx context.Context, versions map[str
|
||||
// reported through apply status, which keeps the version still live on the
|
||||
// record. A refused update therefore reaches the settings page the way a
|
||||
// refused workflow-execution-settings update does
|
||||
// (docs/prds/control-plane-apply-status.md).
|
||||
func (b *boot) applyRuntimeResourceUpdate(ctx context.Context, kind string, update controlplane.AppliedResource) {
|
||||
if update.Err != nil {
|
||||
// A stream failure carries no version at all (versions start at 1,
|
||||
@@ -443,9 +440,7 @@ func (b *boot) reconcileRuntimePlugins(ctx context.Context) {
|
||||
// refuseSkillsDirChange refuses a stored plugin-settings document whose
|
||||
// skills_dir differs from the value in force. skills_dir is the one directory
|
||||
// with no live consumer, so a change to it stays a restart-scoped edit rather
|
||||
// than a value the daemon reports as applied. The check reads the running
|
||||
// config, so it cannot live in validatePluginSettings, which is value-agnostic
|
||||
// by the archie-core-1143 decision.
|
||||
// than a value the daemon reports as applied.
|
||||
func (b *boot) refuseSkillsDirChange(ctx context.Context) error {
|
||||
var stored struct {
|
||||
SkillsDir string `json:"skills_dir"`
|
||||
|
||||
@@ -16,11 +16,7 @@ import (
|
||||
// ENDS can take: a store that errors at once is charged, and so is one that
|
||||
// stalls for less than the window the attempt is judged against, because that
|
||||
// window is derived from the delay the attempt would otherwise be charged and
|
||||
// widens with the ladder instead of sitting at its floor (attemptHealthy). The
|
||||
// reach stops at the window: a stall still going when the window closes is read
|
||||
// as a store that answered, so an outage whose every attempt takes at least
|
||||
// that long leaves the ladder at the minimum -- deliberately, and pinned by
|
||||
// TestKeepWatchTreatsAStallPastTheWindowAsAStoreThatAnswered.
|
||||
// widens with the ladder instead of sitting at its floor (attemptHealthy).
|
||||
//
|
||||
// This loop charges only attempts that end, and imposes no timeout of its own:
|
||||
// nextUpdate waits on the stream and on the loop's own context, never on a
|
||||
@@ -55,7 +51,7 @@ const controlPlaneWatchHealthyMultiple = 2
|
||||
// connection drops, or the server closes the stream. keepWatch reopens it in
|
||||
// place; workflow-execution-settings also reports the gap so apply status does
|
||||
// not keep re-stamping the previous successful version as current while no
|
||||
// live updates can arrive (archie-core-1050).
|
||||
// live updates can arrive.
|
||||
//
|
||||
// One goroutine per kind, reconnecting in place: a long outage does not stack
|
||||
// watchers. Reopening resumes after the last version an update carried, so a
|
||||
@@ -95,13 +91,12 @@ const controlPlaneWatchHealthyMultiple = 2
|
||||
// controlPlaneWatchRetry for what ends an attempt against a peer that never
|
||||
// answers), so the reach of the rule stops at the window itself: a stall still
|
||||
// going when the window closes is read as a store that answered, and the delay
|
||||
// stays at the minimum for as long as every attempt takes that long. That
|
||||
// is deliberate rather than a gap to close with another rule. The stalled
|
||||
// attempt lasts the window, so the reopens it leaves behind are bounded by the
|
||||
// attempt and not by the delay -- about 0.8 a second at the minimum rung,
|
||||
// against the four a second this rule exists to charge -- and a shape that slow
|
||||
// is not the request loop it exists for. It is pinned by
|
||||
// TestKeepWatchTreatsAStallPastTheWindowAsAStoreThatAnswered.
|
||||
// stays at the minimum for as long as every attempt takes that long. That is
|
||||
// deliberate rather than a gap to close with another rule. The stalled attempt
|
||||
// lasts the window, so the reopens it leaves behind are bounded by the attempt
|
||||
// and not by the delay -- about 0.8 a second at the minimum rung, against the
|
||||
// four a second this rule exists to charge -- and a shape that slow is not the
|
||||
// request loop it exists for.
|
||||
//
|
||||
// open, versionOf and deliver are the kind's halves. open re-establishes the
|
||||
// stream -- the caller opens the first one itself, so that a control plane
|
||||
@@ -113,10 +108,10 @@ const controlPlaneWatchHealthyMultiple = 2
|
||||
// wait is the delay between a stream ending and the reopen that follows it, and
|
||||
// production passes waitFor. It is injected so that the delay the loop hands it
|
||||
// is observable as a value: the retry_in log line states the delay the loop
|
||||
// charged, and a loop that charged one delay and waited another would leave that
|
||||
// attribute agreeing with itself. What the injected wait cannot show is a
|
||||
// multiple taken inside waitFor itself, which is a timer for exactly the d it is
|
||||
// given (TestKeepWatchWaitsTheDelayItCharged reads the argument, not the wait).
|
||||
// charged, and a loop that charged one delay and waited another would leave
|
||||
// that attribute agreeing with itself. What the injected wait cannot show is a
|
||||
// multiple taken inside waitFor itself, which is a timer for exactly the d it
|
||||
// is given.
|
||||
func keepWatch[T any](
|
||||
ctx context.Context,
|
||||
log *slog.Logger,
|
||||
@@ -187,12 +182,7 @@ func attemptHealthy(progressed bool, openFor, backoff time.Duration) bool {
|
||||
// delay the attempt would otherwise be charged, multiplied by
|
||||
// controlPlaneWatchHealthyMultiple. The window moves with the ladder, so the
|
||||
// charge reaches a store that fails slowly at every rung of it, which a window
|
||||
// fixed at the minimum does not. The multiple is strictly more than one, so the
|
||||
// window is always wider than that charge -- a store that fails as slowly as
|
||||
// the charge it would be paid is still charged, which is the shape of
|
||||
// TestWatchRetryGrowsWhileTheStateStoreIsDown that says so -- and an attempt is
|
||||
// healthy at the window as well as past it (TestAttemptHealthyAtTheWindowBoundary
|
||||
// pins that edge).
|
||||
// fixed at the minimum does not.
|
||||
func controlPlaneWatchHealthyWindow(backoff time.Duration) time.Duration {
|
||||
return controlPlaneWatchHealthyMultiple * retryDelay(backoff, false)
|
||||
}
|
||||
@@ -216,8 +206,7 @@ func retryDelay(current time.Duration, healthy bool) time.Duration {
|
||||
// cancellation that asked it to stop. The coupling that is load-bearing runs
|
||||
// the other way: this watch returns on cancellation without draining what the
|
||||
// producer has left for it, so controlplane.Client's producer must stop on the
|
||||
// same context instead of parking on a send no reader will ever take (its send
|
||||
// guard is pinned by TestKeepWatchLeavesNoProducerParkedOnAnUndeliveredUpdate).
|
||||
// same context instead of parking on a send no reader will ever take.
|
||||
func nextUpdate[T any](ctx context.Context, stream <-chan T) (T, bool) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
||||
@@ -67,7 +67,7 @@ func RunGateway(ctx context.Context, options GatewayOptions) error {
|
||||
}
|
||||
// The Gateway also no longer opens archie.db directly: it consumes the
|
||||
// same remote State Store contract the daemon does via
|
||||
// [services.state].target (docs/prds/state-store-contract.md §12 step 7).
|
||||
// [services.state].target.
|
||||
if err := b.openGatewayState(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func (b *boot) serveGatewayListener(ctx context.Context, listener net.Listener,
|
||||
b.log.Info("archie-gateway running", "addr", listener.Addr().String(), "token_required", !loopback)
|
||||
// Boot is over and this listener is about to accept: the same fact
|
||||
// systemd's READY=1 asserts, so the announcement goes out here rather than
|
||||
// from a second notion of "started" (archie-core-1174). Not later: Serve
|
||||
// from a second notion of "started". Not later: Serve
|
||||
// begins accepting the moment it is called, and a unit whose
|
||||
// TimeoutStartSec expires first would restart a healthy process.
|
||||
b.announceReady()
|
||||
@@ -159,13 +159,10 @@ func (b *boot) startGatewayRuntime(ctx context.Context, actor gateway.ChatTaskAc
|
||||
b.capabilityHost = plugin.NewHost()
|
||||
b.startRateLimiter(ctx, b.cfg.Chat.RateLimit)
|
||||
// The Gateway composes the process-wide worktree manager before
|
||||
// setupGatewayChat; nothing in this process reads it today (the old
|
||||
// synchronous operator-review path that did was removed with the
|
||||
// adversarial self-review system, archie-core-afbk.7 -- see that bead's
|
||||
// continuation for the operator trigger's replacement). Kept for the
|
||||
// setupGatewayChat; nothing in this process reads it today. Kept for the
|
||||
// manager's other consumers; it is the only part of the daemon's tree
|
||||
// composition the Gateway takes -- it must not own identity runners, so
|
||||
// it does not call buildTreesAndIdentities.
|
||||
// composition the Gateway takes -- it must not own identity runners, so it
|
||||
// does not call buildTreesAndIdentities.
|
||||
b.buildWorktreeManager()
|
||||
// setupMemoryEngine must run before setupGatewayChat: setupGatewayChat
|
||||
// constructs the turn runner, which captures b.memEngines at
|
||||
@@ -177,7 +174,7 @@ func (b *boot) startGatewayRuntime(ctx context.Context, actor gateway.ChatTaskAc
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := b.registerTools(ctx); err != nil {
|
||||
if err := b.registerTools(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.registerStandaloneTools()
|
||||
|
||||
@@ -75,7 +75,6 @@ func (b *boot) setupChatRuntime(ctx context.Context, cfg config.Config) error {
|
||||
// Chat's /approve reaches the daemon's one task-action service rather
|
||||
// than its own requeue, so a chat approval and a dashboard approval
|
||||
// cannot record different decisions for one operator intent
|
||||
// (docs/prds/pr-review-operator-response.md, Decision 1).
|
||||
approve: func(ctx context.Context, scope *string, actor taskactions.Actor, taskID int64, res taskactions.ActionPayload) error {
|
||||
return b.taskActions().Apply(ctx, scope, actor, taskID, taskstate.ActionApprove, res)
|
||||
},
|
||||
@@ -90,9 +89,6 @@ func (b *boot) setupChatRuntime(ctx context.Context, cfg config.Config) error {
|
||||
// cannot be watched at all fails the boot that asked for it rather than
|
||||
// leaving the process running personas it can no longer update; after that the
|
||||
// watch reconnects instead of ending (see keepWatch).
|
||||
//
|
||||
// Persona updates are not reported through apply status -- the personas kind
|
||||
// has no apply-status wiring, which is archie-core-aj35, not this watch.
|
||||
func (b *boot) watchPersonas(ctx context.Context, version int64) error {
|
||||
updates, err := b.controlPlane.WatchPersonas(ctx, version)
|
||||
if err != nil {
|
||||
|
||||
@@ -15,12 +15,9 @@ import (
|
||||
// healthSurface is archied's own liveness endpoint, served on
|
||||
// [health].listen for the lifetime of the process.
|
||||
//
|
||||
// The dashboard also answers /healthz, but on the dashboard's listener: that
|
||||
// can be switched off, and in Phase 3 it belongs to a separate process
|
||||
// entirely. Either way it is the wrong thing to ask "did archied come back
|
||||
// up?" -- which is exactly what the update watchdog asks after restarting
|
||||
// the daemon, and answers with a rollback when nothing replies
|
||||
// (archie-core-1r4g, archie-core-exbz).
|
||||
// Either way it is the wrong thing to ask "did archied come back up?" -- which
|
||||
// is exactly what the update watchdog asks after restarting the daemon, and
|
||||
// answers with a rollback when nothing replies
|
||||
//
|
||||
// serving gates the liveness answer: the listener binds early in boot, so
|
||||
// the port is answering before the daemon is, and a 200 before the daemon
|
||||
|
||||
@@ -61,7 +61,6 @@ func (b *boot) setupKitLauncher(ctx context.Context) {
|
||||
}
|
||||
// grants is the production Resolver: Launch/Release Grant/RevokeGrant it
|
||||
// per run with exactly the declared-and-granted intersection
|
||||
// (docs/prds/external-agent-harness.md, Credentials; archie-core-egkf.11).
|
||||
grants := egress.NewGrantResolver()
|
||||
// Without a harness secret store, Register refuses a Kit with a
|
||||
// required OAuth credential.
|
||||
|
||||
@@ -359,10 +359,6 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
||||
return 1
|
||||
}
|
||||
|
||||
// The state-store adapter, its daemon-side surfaces and the policy chain
|
||||
// dispatch evaluates: one ordered stage of the composition sequence
|
||||
// (openStateStage; docs/prds/state-store-contract.md §12 step 7 and
|
||||
// docs/prds/orgs-and-access.md).
|
||||
if err := b.openStateStage(ctx); err != nil {
|
||||
return 1
|
||||
}
|
||||
@@ -406,7 +402,7 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
||||
return 1
|
||||
}
|
||||
|
||||
if err := b.loadWorkflows(ctx); err != nil {
|
||||
if err := b.loadWorkflows(); err != nil {
|
||||
return 1
|
||||
}
|
||||
if err := b.loadPlugins(); err != nil {
|
||||
@@ -425,7 +421,7 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
||||
return 1
|
||||
}
|
||||
|
||||
if err := b.registerTools(ctx); err != nil {
|
||||
if err := b.registerTools(); err != nil {
|
||||
return 1
|
||||
}
|
||||
b.registerStandaloneTools()
|
||||
@@ -441,7 +437,7 @@ func Run() int { //nolint:cyclop,funlen // the composition root's setup sequence
|
||||
// wireConfigSurfaces attaches the dashboard's configuration read path and
|
||||
// the reload plumbing behind it. The write handlers (PATCH /api/config, the
|
||||
// per-repository field update, per-row reset) are descoped for the UI
|
||||
// process (archie-core-ymut): the daemon still owns the validate-persist-
|
||||
// process: the daemon still owns the validate-persist-
|
||||
// publish policy, but no HTTP route reaches it -- editing is config.toml
|
||||
// plus reload -- so only the snapshot publication and the override list the
|
||||
// renderer needs stay wired.
|
||||
@@ -453,11 +449,10 @@ func (b *boot) wireConfigSurfaces(ctx context.Context, cfgPath, overlayPath stri
|
||||
b.publishConfigSnapshot(ctx)
|
||||
}
|
||||
|
||||
// persistEvents drains the bus until it closes, giving each event an ID
|
||||
// from the store. The store is the only fan-out point (docs/architecture/
|
||||
// migration-decisions.md, "Dashboard live event delivery"): the UI process
|
||||
// reads the same table through its event pump, so the daemon's job is
|
||||
// persistence, not delivery.
|
||||
// persistEvents drains the bus until it closes, giving each event an ID from
|
||||
// the store. The store is the only fan-out point: the UI process reads the same
|
||||
// table through its event pump, so the daemon's job is persistence, not
|
||||
// delivery.
|
||||
//
|
||||
// The insert deliberately outlives ctx: this loop ends when the bus closes,
|
||||
// which is part of shutdown, and the last events of a run are exactly the
|
||||
@@ -614,7 +609,7 @@ func (a chatTaskControllerAdapter) CancelChatTask(ctx context.Context, taskID in
|
||||
// An operator declining work lands in the same state whichever surface
|
||||
// they used, through the one cancel path: the store records the
|
||||
// cancellation -- every non-terminal step of the current attempt plus the
|
||||
// execution's own move (docs/prds/execution-tree-state-machine.md) -- and
|
||||
// execution's own move -- and
|
||||
// this write is what a late worker's next step write fails against. This
|
||||
// used to record StatusRejected while the dashboard recorded
|
||||
// StatusClosedWontDo, so the same decision showed up as two different
|
||||
@@ -653,7 +648,7 @@ func (a chatTaskLogReaderAdapter) ReadChatTaskLogs(
|
||||
// tasks, and tasks with no identity (forge-sourced) are not
|
||||
// readable through a chat tool at all — they belong to the daemon,
|
||||
// not a particular identity. "The empty string MUST NOT retain
|
||||
// special meaning" (docs/architecture/identity.md).
|
||||
// special meaning".
|
||||
if task.Identity != identity {
|
||||
return gateway.ChatTaskLogResult{}, fmt.Errorf("task %d belongs to %q, not %q", taskID, task.Identity, identity)
|
||||
}
|
||||
@@ -856,12 +851,11 @@ func subscribeAgentEvents(nc *natsio.Conn, bus *events.Bus, log *slog.Logger) (u
|
||||
}, nil
|
||||
}
|
||||
|
||||
// registerTaskRPCServers subscribes the forgerpc/worktreerpc handlers on nc
|
||||
// so an archie-agent container (which holds no forge token, or push
|
||||
// credential) can proxy those operations back to archied. The returned func
|
||||
// unsubscribes all of them. The agent's store calls are NOT proxied here: they
|
||||
// go over gRPC to the State Store (docs/prds/state-store-contract.md §12 step
|
||||
// 4), so the legacy NATS storerpc registration is deleted.
|
||||
// registerTaskRPCServers subscribes the forgerpc/worktreerpc handlers on nc so
|
||||
// an archie-agent container (which holds no forge token, or push credential)
|
||||
// can proxy those operations back to archied. The returned func unsubscribes
|
||||
// all of them. The agent's store calls are NOT proxied here: they go over gRPC
|
||||
// to the State Store, so the legacy NATS storerpc registration is deleted.
|
||||
//
|
||||
// Forge and worktree are identity-scoped: the root servers answer the root
|
||||
// (identity-less) subjects for single-identity deployments and root-owned
|
||||
@@ -941,10 +935,9 @@ func configuredNATSToken(cfg config.NATSConfig, getenv func(string) string) (str
|
||||
return token, nil
|
||||
}
|
||||
|
||||
// updateReportPath is where the update watchdog leaves the phase-2 outcome
|
||||
// of an update for this identity to relay on its next launch. The identity is
|
||||
// hashed so multiple identities sharing one daemon (see
|
||||
// docs/architecture/identity.md) never collide.
|
||||
// updateReportPath is where the update watchdog leaves the phase-2 outcome of
|
||||
// an update for this identity to relay on its next launch. The identity is
|
||||
// hashed so multiple identities sharing one daemon never collide.
|
||||
func updateReportPath(workDir, identity string) string {
|
||||
identityHash := sha256.Sum256([]byte(identity))
|
||||
return filepath.Join(
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
// from: the configuration it was built with and the manifest id it registered
|
||||
// under. A live tool-settings change diffs the stored server set against this
|
||||
// record, so a server that did not change is left running and untouched
|
||||
// (archie-core-zfb0.3).
|
||||
type appliedMCPServer struct {
|
||||
server config.MCPServer
|
||||
id string
|
||||
|
||||
@@ -35,7 +35,7 @@ const (
|
||||
// drop a file beside a running daemon and have it take effect without a
|
||||
// restart. Yaegi cannot unload an interpreter, so a removed file's code keeps
|
||||
// running and the reconciler reports it through apply status until the process
|
||||
// restarts (docs/prds/plugin-settings-live.md).
|
||||
// restarts.
|
||||
//
|
||||
// Files are content-hashed, so a tick loads only what appeared or changed: the
|
||||
// boot load's files are seeded as already loaded. A file whose load fails is
|
||||
@@ -170,7 +170,6 @@ func (r *pluginReconciler) reconcile(ctx context.Context) error {
|
||||
// it re-resolves provider credentials, so a provider disabled at boot for
|
||||
// an unresolvable engine is re-resolved on the first tick that finds it,
|
||||
// and a changed directory retargets the next tick without a restart
|
||||
// (docs/prds/plugin-settings-live.md, "Triggers").
|
||||
if r.relayer != nil {
|
||||
if err := r.relayer(ctx); err != nil {
|
||||
problems = append(problems, fmt.Errorf("re-resolve provider credentials: %w", err))
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
//
|
||||
// The probes read the daemon's state directly rather than through a
|
||||
// webui.Server: the daemon serves /health/detailed on its own listener and
|
||||
// has served no dashboard since the UI process cutover (archie-core-ml30).
|
||||
// has served no dashboard since the UI process cutover.
|
||||
func (b *boot) setupReadinessProbes() {
|
||||
cfg := b.cfg
|
||||
probes := []health.Probe{
|
||||
@@ -38,8 +38,7 @@ func (b *boot) setupReadinessProbes() {
|
||||
// The daemon no longer runs a chat channel, so it cannot observe one's
|
||||
// lifecycle; channel health is the Messaging Service's own probe. What
|
||||
// this process depends on is the Gateway answering, so that is what it
|
||||
// reports (docs/prds/ui-service-boundary.md, "Listen, authentication,
|
||||
// and readiness").
|
||||
// reports.
|
||||
readiness.NewContractProbe("gateway", time.Duration(cfg.Health.DependencyTimeout), func(ctx context.Context) error {
|
||||
return pingChat(ctx, b.chat)
|
||||
}),
|
||||
|
||||
@@ -109,8 +109,7 @@ var reloadableFields = map[string]bool{
|
||||
"Repos": true,
|
||||
// Per-task snapshot: ForTask carries these into every dispatched
|
||||
// TaskContext (config.go ForTask), built fresh from d.Cfg.Get() at
|
||||
// dispatch. Pinned by TestReloadableFieldsCoverForTaskSnapshot so a
|
||||
// field added to ForTask cannot silently drift out of this list.
|
||||
// dispatch.
|
||||
"DiffCapLines": true,
|
||||
"Budgets": true,
|
||||
"Dispatch": true,
|
||||
@@ -131,17 +130,12 @@ var reloadableFields = map[string]bool{
|
||||
"BotEmail": true,
|
||||
// cfg.Label additionally feeds IssuesWithLabel per poll cycle
|
||||
// (daemon.go:359,390) and cfg.BotUser feeds AssignedIssues (:364,377).
|
||||
// Label is not carried by ForTask, so it is pinned by hand in
|
||||
// TestReloadableFieldsCoverForTaskSnapshot.
|
||||
"Label": true,
|
||||
"BotUser": true,
|
||||
// MaxRetries has two consumers, both re-reading it: the webui
|
||||
// maxRetriesFor handler (api_tasks.go:380,383) reads it per request, and
|
||||
// ForTask carries it into every dispatched TaskConfig, where the
|
||||
// container's remediation round cap reads it (StageRemediationRoundCap).
|
||||
// The per-task half of this list is pinned mechanically by
|
||||
// TestReloadableFieldsCoverForTaskSnapshot; the webui-only entry is pinned
|
||||
// by TestChangedNonReloadableFields.
|
||||
// MaxRetries has two consumers, both re-reading it: the webui maxRetriesFor
|
||||
// handler (api_tasks.go:380,383) reads it per request, and ForTask carries
|
||||
// it into every dispatched TaskConfig, where the container's remediation
|
||||
// round cap reads it (StageRemediationRoundCap).
|
||||
"MaxRetries": true,
|
||||
// Tools.Policy (MaxResultChars/SpillDir) is carried into TaskConfig by
|
||||
// ForTask (config.go) and applied fresh per dispatch via
|
||||
@@ -149,24 +143,6 @@ var reloadableFields = map[string]bool{
|
||||
"ToolPolicy": true,
|
||||
}
|
||||
|
||||
// reloadableSubFields are sub-fields of structs that are otherwise
|
||||
// startup-built. VolumeTTL is re-read per cycle in cleanupExpiredStorage;
|
||||
// Profiles is resolved fresh per dispatch (daemon.configFor ->
|
||||
// Containers.Profile, called from pinTaskProfile) and is also its own
|
||||
// live-applying control-plane resource (AgentProfileKind), never captured at
|
||||
// container-pool construction -- docs/prds/external-agent-harness.md
|
||||
// "Selection": a Kit profile applies without a restart. Credentials is the
|
||||
// same shape one layer down: kitrun.Launcher reads Config.Get().Containers.
|
||||
// Credentials fresh on every Launch (CredentialBindingsKind), never a slice
|
||||
// captured once when the launcher was built. Image, MaxConcurrency, MaxUptime,
|
||||
// PullPolicy and Network are re-read per acquire by the container pool and
|
||||
// MaxConcurrency also resizes the running dispatcher on publish
|
||||
// (archie-core-zfb0.2), so a reload applies them without a restart.
|
||||
// RegistryAuth stays frozen in the startup-built pool: it is file-owned and
|
||||
// never part of the container-runtime-policies document, so a changed value
|
||||
// must warn requires-restart. Forge.Host is carried into TaskContext by ForTask
|
||||
// (display/link building only); the forge client itself is startup-built, so
|
||||
// Type/Token/TokenEnv stay requires-restart.
|
||||
var reloadableSubFields = map[string]map[string]bool{
|
||||
"Containers": {
|
||||
"VolumeTTL": true, "Profiles": true, "Credentials": true,
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
//
|
||||
// The protocol client and the heartbeat sampler live in internal/sdnotify
|
||||
// because archie-messaging, a separate process that cannot import this
|
||||
// package, is the next process that must be able to announce itself
|
||||
// (archie-core-g5g8). What stays here is what is the daemon's own: which
|
||||
// package, is the next process that must be able to announce itself.
|
||||
// What stays here is what is the daemon's own: which
|
||||
// marker counts as progress (daemon.LastPollAt) and how long the loop may go
|
||||
// without beginning a poll pass.
|
||||
//
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
// announceReady tells systemd the daemon has finished starting. It is called at
|
||||
// the moment a process declares itself serving: the daemon's run loop (next to
|
||||
// healthSurface.markServing), and the serve steps of archie-gateway and
|
||||
// archie-state-store (archie-core-1174), which have health surfaces of their
|
||||
// archie-state-store, which have health surfaces of their
|
||||
// own and would otherwise hang a Type=notify unit until TimeoutStartSec while
|
||||
// perfectly healthy.
|
||||
func (b *boot) announceReady() {
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
// process inputs into RunStateStore, which serves the task and event-capture
|
||||
// stores from Postgres, registers every StateStore gRPC handler (the same service .4.2 serves
|
||||
// in-process on the daemon), and shuts down cleanly on ctx cancellation.
|
||||
//
|
||||
// See docs/prds/state-store-contract.md (rev. 2c) -- the single authoritative
|
||||
// design surface -- and in particular §5 (binary layout), §9 (transport
|
||||
// security boundary) and §11 (the store service owns its own DB lifecycle).
|
||||
package archied
|
||||
|
||||
import (
|
||||
@@ -57,7 +53,6 @@ type StateStoreOptions struct {
|
||||
// Listen is the gRPC listen address. Loopback binds (127.0.0.1, ::1,
|
||||
// localhost) serve insecure with no token; any non-loopback address
|
||||
// requires a non-empty token (or TLS), else the process fails closed
|
||||
// (state-store-contract.md §9).
|
||||
Listen string
|
||||
// Token is the bearer token the State Store server validates for a
|
||||
// non-loopback listener. Empty falls back to [services.state].target_token.
|
||||
@@ -99,8 +94,8 @@ func RunStateStore(ctx context.Context, options StateStoreOptions) error { //nol
|
||||
}
|
||||
// The resumable default org/workspace upgrade runs before this process
|
||||
// serves anything: the State Store refuses scoped calls until its upgrade
|
||||
// has finished, rather than serving records with no org
|
||||
// (docs/prds/orgs-and-access.md, "Upgrading existing installs"). A store
|
||||
// has finished, rather than serving records with no org.
|
||||
// A store
|
||||
// without the upgrader is one that owns no tenant boundary yet, so the
|
||||
// absence degrades to "no upgrade" rather than aborting boot.
|
||||
if upgrader, ok := b.st.(org.Upgrader); ok {
|
||||
@@ -150,8 +145,8 @@ func RunStateStore(ctx context.Context, options StateStoreOptions) error { //nol
|
||||
// Boot is over and every listener this process serves is bound: the gRPC
|
||||
// contract below and, when -ready-addr asked for one, the readiness HTTP
|
||||
// surface. systemd's READY=1 asserts the same fact, so the announcement
|
||||
// goes out here rather than from a second notion of "started"
|
||||
// (archie-core-1174). Not earlier: a readiness surface that fails to bind
|
||||
// goes out here rather than from a second notion of "started".
|
||||
// Not earlier: a readiness surface that fails to bind
|
||||
// fails the boot, and READY must not precede it. Not later: Serve begins
|
||||
// accepting the moment it is called.
|
||||
b.announceReady()
|
||||
@@ -161,14 +156,13 @@ func RunStateStore(ctx context.Context, options StateStoreOptions) error { //nol
|
||||
return serveStateStore(ctx, listener, deps, opts)
|
||||
}
|
||||
|
||||
// seedAndValidatePolicies seeds the shipped role policies for every org
|
||||
// that lacks them, grants the agent identities their org's shipped developer
|
||||
// role, and re-validates every stored policy this process serves
|
||||
// (docs/prds/orgs-and-access.md, "Storing and changing policies" and
|
||||
// "Roles"). An invalid org, workspace or object policy is logged here and
|
||||
// named as a problem by the engines the consumers build; an invalid instance
|
||||
// policy fails this boot -- the store stops serving until it is fixed. A
|
||||
// store without the access surfaces degrades: there is no chain to seed.
|
||||
// seedAndValidatePolicies seeds the shipped role policies for every org that
|
||||
// lacks them, grants the agent identities their org's shipped developer role,
|
||||
// and re-validates every stored policy this process serves. An invalid org,
|
||||
// workspace or object policy is logged here and named as a problem by the
|
||||
// engines the consumers build; an invalid instance policy fails this boot --
|
||||
// the store stops serving until it is fixed. A store without the access
|
||||
// surfaces degrades: there is no chain to seed.
|
||||
func (b *boot) seedAndValidatePolicies(ctx context.Context) error {
|
||||
policies, ok := b.st.(access.PolicyStore)
|
||||
if !ok {
|
||||
@@ -210,8 +204,7 @@ func (b *boot) seedAndValidatePolicies(ctx context.Context) error {
|
||||
// reportUnseededResources logs every kind ImportConfig could not seed.
|
||||
//
|
||||
// Reported, not fatal: a stale TOML value in a setting the database owns must
|
||||
// not stop this process from starting (docs/prds/runtime-control-plane.md,
|
||||
// "Bootstrap, migration, and recovery"). The kind stays ABSENT rather than
|
||||
// not stop this process from starting. The kind stays ABSENT rather than
|
||||
// half-written, so the file document's value is the one in effect for every
|
||||
// reader -- the layering leaves a kind with no stored value alone
|
||||
// (controlplane.resourceReader) -- and the operator's fix is still the file.
|
||||
@@ -237,10 +230,6 @@ func (b *boot) reportUnseededResources(skipped []controlplane.SeedSkip) {
|
||||
// registers before it compiles one, so within one build a definition this
|
||||
// server admits is compilable there; a skewed deploy is only fixed by a
|
||||
// matching deploy.
|
||||
//
|
||||
// It is separate from RunStateStore so that function stays within its
|
||||
// complexity budget, and step_vocabulary_test.go pins both the call to
|
||||
// stepVocabulary below and RunStateStore's call to this function.
|
||||
func openStateStoreControlPlane(resources controlplane.ResourceStore) (*controlplane.Server, error) {
|
||||
steps, err := stepVocabulary()
|
||||
if err != nil {
|
||||
@@ -317,7 +306,7 @@ func (b *boot) stateStoreDeps(grants *staterpc.TaskGrants) staterpc.Deps {
|
||||
}
|
||||
// Task logs live in the state directory, which this process owns, and the
|
||||
// dashboard process owns no such directory -- so this is where a task-log
|
||||
// read is served from (docs/prds/ui-service-boundary.md). The reader is
|
||||
// read is served from. The reader is
|
||||
// the daemon's own registry over the configured state_dir.
|
||||
//
|
||||
// The nil check is on the registry, not on the interface it is assigned
|
||||
@@ -342,7 +331,7 @@ func (b *boot) stateStoreDeps(grants *staterpc.TaskGrants) staterpc.Deps {
|
||||
deps.Sources = b.eda
|
||||
deps.MappingMatches = b.eda
|
||||
// HarnessSecrets rides the same encrypted-at-rest store as source
|
||||
// webhook secrets (docs/prds/binding-secret-encryption.md), under its
|
||||
// webhook secrets, under its
|
||||
// own domain separator (bindingcipher.HarnessSecretDomain).
|
||||
deps.HarnessSecrets = b.eda
|
||||
}
|
||||
@@ -391,7 +380,7 @@ func (b *boot) executionDeps(deps *staterpc.Deps) {
|
||||
}
|
||||
|
||||
// accessDeps wires the policy chain and its denial records from the same
|
||||
// store (docs/prds/orgs-and-access.md). A store without them -- one that owns
|
||||
// store. A store without them -- one that owns
|
||||
// no tenant boundary yet -- degrades the access RPCs rather than failing the
|
||||
// boot, the same pattern the other optional surfaces use.
|
||||
func (b *boot) accessDeps(deps *staterpc.Deps) {
|
||||
@@ -468,7 +457,7 @@ func (b *boot) startOptionalSurfaces(ctx context.Context, options StateStoreOpti
|
||||
return nil
|
||||
}
|
||||
|
||||
// stateStoreServerOpts applies the transport security boundary (§9): a
|
||||
// stateStoreServerOpts applies the transport security boundary: a
|
||||
// loopback listener is served insecure with no token; any non-loopback
|
||||
// address requires a bearer token, else the process fails closed. It cannot
|
||||
// enforce TLS/mTLS (an operator decision), so it narrows the non-loopback
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
// composeStateStoreClient dials the State Store gRPC service the daemon's own
|
||||
// capture/mapping/binding consumers call. Token resolution is the daemon's
|
||||
// (it owns the config keys and the secret registry); the dial itself and the
|
||||
// fail-closed non-loopback rule (§9) belong to the transport, so they come
|
||||
// fail-closed non-loopback rule belong to the transport, so they come
|
||||
// from staterpc.Dial.
|
||||
func composeStateStoreClient(services config.Services, secrets *secret.Registry) (*staterpc.Client, func(), error) {
|
||||
target, err := services.RequireTarget(config.ServiceNameState)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// fails closed: a stored setting that will not validate stops archied
|
||||
// starting, and the in-band remedy -- replaying an earlier revision while the
|
||||
// State Store is up -- is unavailable in exactly the case that needs it
|
||||
// (docs/architecture/safe-change-and-recovery.md).
|
||||
//
|
||||
// Every operation but import works on the PostgreSQL database database_url
|
||||
// names (state_store_recovery_postgres.go). The ones that write refuse while a
|
||||
|
||||
@@ -40,14 +40,6 @@ func newToolCallProjectingTaskStore(inner storecontract.TaskStore, toolCalls too
|
||||
return &toolCallProjectingTaskStore{TaskStore: inner, toolCalls: toolCalls, log: log}
|
||||
}
|
||||
|
||||
// toolCallProjectionFailures reports how many tool_call projections have been
|
||||
// dropped since this process started. Named and exported to the test surface
|
||||
// rather than buried in a log field alone: a silent swallow is the bug this
|
||||
// decorator exists not to have.
|
||||
func (s *toolCallProjectingTaskStore) toolCallProjectionFailures() int64 {
|
||||
return s.projectionFailures.Load()
|
||||
}
|
||||
|
||||
func (s *toolCallProjectingTaskStore) InsertEvent(ctx context.Context, e events.Event) (int64, error) {
|
||||
id, err := s.TaskStore.InsertEvent(ctx, e)
|
||||
if err != nil || e.Kind != events.KindToolCall {
|
||||
|
||||
@@ -19,11 +19,6 @@ import (
|
||||
// definition registers no vocabulary and cannot be failed by one, which is why
|
||||
// the gateway root and internal/app/archiemessaging are not here.
|
||||
//
|
||||
// It is a named function so that step_vocabulary_test.go can fail if a root
|
||||
// stops resolving the shipped stages, or hands a constructor a manager other
|
||||
// than the one this returns; the roots themselves open a database and dial
|
||||
// gRPC, so the test asserts their wiring by parsing their bodies.
|
||||
//
|
||||
// Agreement is within one build: the State Store and archie-agent are
|
||||
// separately deployed binaries, so a State Store built from newer source than
|
||||
// the agent it dispatches to can still disagree, and only a matching deploy
|
||||
@@ -66,7 +61,7 @@ func (b *boot) openDaemonWorkflowDefinitions() error {
|
||||
// two calls owe each other is a property of the pair, not of that sequence: the
|
||||
// definitions client wraps the control-plane transport the adapter dials, so it
|
||||
// cannot be built first, and buildDaemon captures the client, so it cannot be
|
||||
// built later. step_vocabulary_test.go pins exactly that order here.
|
||||
// built later.
|
||||
//
|
||||
// The gateway root calls openStateStoreAdapter directly and stops there; the
|
||||
// daemon-only half stays out of that function for the reason above it.
|
||||
|
||||
@@ -19,7 +19,7 @@ const updateReportPollInterval = 2 * time.Second
|
||||
// restarts archied and leaves its verdict in a file on archied's host, so
|
||||
// only archied can read it. It previously ran inside the dashboard's own
|
||||
// Run, which put a host-local file read in the process that is moving off
|
||||
// the host (archie-core-8cda.5.4). The report reaches an operator the same
|
||||
// the host. The report reaches an operator the same
|
||||
// way it always did, as an event -- persisted with every other event and
|
||||
// delivered to whichever dashboard is watching.
|
||||
//
|
||||
|
||||
@@ -33,7 +33,7 @@ func channelDescriptors(instances []*channelInstance) []status.Descriptor {
|
||||
// reloadable reports whether this channel can re-read its configuration. It is
|
||||
// the single source for both the capability a descriptor declares and the action
|
||||
// a reload performs; deriving them separately is how a dashboard ends up offering
|
||||
// a button that reports success and changes nothing (archie-core-np7l).
|
||||
// a button that reports success and changes nothing.
|
||||
func reloadable(instance *channelInstance) bool {
|
||||
gateway, ok := instance.current().(*telegram.Gateway)
|
||||
return ok && gateway.Reload != nil
|
||||
@@ -72,8 +72,8 @@ func (s *Service) ReloadChannel(_ context.Context, id string) error {
|
||||
//
|
||||
// Before this, Start handed every channel an empty channels.Lifecycle{}, so
|
||||
// nothing recorded starting, running or failed anywhere and
|
||||
// internal/channels/status.Manager had no production writer at all
|
||||
// (archie-core-8cda.6.8). The channels have always reported: all three call
|
||||
// internal/channels/status.Manager had no production writer at all.
|
||||
// The channels have always reported: all three call
|
||||
// ReportStarting and ReportRunning on whichever lifecycle they are handed.
|
||||
func (s *Service) lifecycleFor(id string) channels.Lifecycle {
|
||||
return channels.Lifecycle{
|
||||
|
||||
@@ -310,11 +310,7 @@ func (s *Service) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// Every configured channel has been handed its lifetime and the service
|
||||
// blocks here serving them. systemd's READY=1 asserts the same fact this
|
||||
// line has just established, so the announcement goes out here rather than
|
||||
// from a second notion of "started" (the convention archie-core-1174 set
|
||||
// for the daemon, the Gateway and the State Store; archie-core-g5g8 is this
|
||||
// process joining them). Not earlier: a channel whose configuration is
|
||||
// blocks here serving them. Not earlier: a channel whose configuration is
|
||||
// invalid fails composition, above, and READY must not precede it. Not
|
||||
// later: a unit whose TimeoutStartSec expires first would restart a healthy
|
||||
// process. Nothing is consumed until the unit says Type=notify, so this is
|
||||
|
||||
@@ -24,8 +24,7 @@ type ResolvedConfig struct {
|
||||
// WorkDir, BotUser and HealthURL are not channel transport settings. They
|
||||
// locate this identity's release-announcement and update-report state
|
||||
// files, and give the update installer the daemon health endpoint to poll
|
||||
// after it applies one (docs/architecture/migration-decisions.md, "Telegram
|
||||
// operator surface after extraction").
|
||||
// after it applies one.
|
||||
WorkDir string
|
||||
BotUser string
|
||||
HealthURL string
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
// channel connections (Telegram, email, webhook) served against a Gateway running
|
||||
// over its gRPC contract.
|
||||
//
|
||||
// docs/prds/messaging-service-boundary.md is the authority. The Messaging Service
|
||||
// owns channel persistent connections and dispatches turns directly to Gateway's
|
||||
// ChatContract over gRPC.
|
||||
// The Messaging Service owns channel persistent connections and dispatches
|
||||
// turns directly to Gateway's ChatContract over gRPC.
|
||||
package archiemessaging
|
||||
|
||||
import (
|
||||
|
||||
@@ -25,7 +25,7 @@ type chatSettingsSource interface {
|
||||
// interval is the cadence every process already reports at, the messaging
|
||||
// process has no other control-plane watch to share a reconnect ladder with,
|
||||
// and a stored document that cannot be read must leave the running channels
|
||||
// alone (docs/prds/plugin-settings-live.md).
|
||||
// alone.
|
||||
func (s *Service) reconcileLoop(ctx context.Context) {
|
||||
ticker := time.NewTicker(s.reconcileInterval)
|
||||
defer ticker.Stop()
|
||||
@@ -117,8 +117,7 @@ func resolveChatSecrets(base ResolvedConfig, layered config.ChatConfig) (Resolve
|
||||
// The composed set and the listen addresses are fixed for the life of the
|
||||
// process. Enabling or disabling a channel and rebinding a listen address are
|
||||
// process bindings; the change is refused and reported for a restart instead of
|
||||
// applied (docs/prds/runtime-control-plane.md, "Some changes require a
|
||||
// restart").
|
||||
// applied.
|
||||
func (s *Service) applyChannelSettings(next ResolvedConfig) (bool, error) {
|
||||
current := s.currentConfig()
|
||||
effective, outstanding := pinProcessBindings(current, next)
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
// The supervisor is per channel rather than one loop over every channel
|
||||
// because a channel-settings change must restart exactly the channel whose
|
||||
// settings changed: cancelling one run context stops one channel and leaves the
|
||||
// rest serving (archie-core-zfb0.4).
|
||||
// rest serving.
|
||||
func (s *Service) runChannel(ctx context.Context, c *channelInstance) {
|
||||
defer s.wg.Done()
|
||||
for {
|
||||
@@ -77,7 +77,6 @@ func (s *Service) runChannel(ctx context.Context, c *channelInstance) {
|
||||
// restartChannel stops the running channel id and starts a replacement built
|
||||
// from next. The replacement is built before the running channel is touched, so
|
||||
// a configuration this build cannot run leaves the running channel serving
|
||||
// (the validate-before-switch rule in docs/prds/runtime-control-plane.md).
|
||||
//
|
||||
// A channel that is not currently supervised is not restarted: it already
|
||||
// stopped on its own, and resurrecting it here would race that exit. The caller
|
||||
|
||||
@@ -16,12 +16,8 @@ import (
|
||||
)
|
||||
|
||||
// configureTelegram wires the operator seams telegram.Gateway leaves to its
|
||||
// composition root. Which process may satisfy each one is settled in
|
||||
// docs/architecture/migration-decisions.md ("Telegram operator surface after
|
||||
// extraction"); notably ReleaseAnnouncements and Dangerous stay nil, because
|
||||
// nothing this process can observe would make them true. RunningVersions is
|
||||
// supplied here from this process's own build stamp; see
|
||||
// messagingRunningVersions.
|
||||
// composition root. RunningVersions is supplied here from this process's own
|
||||
// build stamp; see messagingRunningVersions.
|
||||
func configureTelegram(ctx context.Context, g *telegram.Gateway, cfg ResolvedConfig, chat messaging.ChatContract, log *slog.Logger) {
|
||||
g.Version = gatewayVersionReporter(ctx, chat, cfg.Options.DependencyTimeout)
|
||||
g.SetShowToolCalls(cfg.ShowToolCalls)
|
||||
@@ -49,7 +45,6 @@ func configureTelegram(ctx context.Context, g *telegram.Gateway, cfg ResolvedCon
|
||||
// from, which Verify reads as drift rather than false success. Reading the
|
||||
// version from the Gateway instead would report a different process's stamp,
|
||||
// which is the failure mode the check exists to catch (see
|
||||
// docs/architecture/migration-decisions.md).
|
||||
//
|
||||
// The agent is deliberately absent: every archie-agent process is task-scoped
|
||||
// and observed only through daemon.AgentStatus, which this process does not
|
||||
@@ -131,10 +126,9 @@ func telegramReloader(o Options, log *slog.Logger) func(*telegram.Gateway) error
|
||||
}
|
||||
|
||||
// identityStatePath names a per-identity state file under workDir. The identity
|
||||
// is hashed so several identities sharing one work directory (see
|
||||
// docs/architecture/identity.md) never collide. The scheme is the daemon's,
|
||||
// unchanged: a different path would replay every release announcement the
|
||||
// operator has already been shown.
|
||||
// is hashed so several identities sharing one work directory never collide. The
|
||||
// scheme is the daemon's, unchanged: a different path would replay every
|
||||
// release announcement the operator has already been shown.
|
||||
func identityStatePath(workDir, kind, identity string) string {
|
||||
identityHash := sha256.Sum256([]byte(identity))
|
||||
return filepath.Join(workDir, fmt.Sprintf("%s-%x.json", kind, identityHash[:8]))
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// internal/domain/workflow (routing binding files) and
|
||||
// internal/domain/eda/playbook (EDA playbooks) -- this package only calls the
|
||||
// loaders the daemon runs and formats results; there is deliberately no
|
||||
// second validation path here (per docs/prds/eda-playbook-engine.md).
|
||||
// second validation path here.
|
||||
package archieplaybooks
|
||||
|
||||
import (
|
||||
|
||||
@@ -35,46 +35,18 @@ type deps struct {
|
||||
// configured for it.
|
||||
Login identity.LoginFlow
|
||||
// Access evaluates the policy chain; Principals assembles the request
|
||||
// principal; Denials records refusals
|
||||
// (docs/prds/orgs-and-access.md). Wired together or not at all.
|
||||
// principal; Denials records refusals.
|
||||
// Wired together or not at all.
|
||||
Access access.Authorizer
|
||||
Principals access.PrincipalSource
|
||||
Denials access.DenialStore
|
||||
}
|
||||
|
||||
// compose builds the dashboard server for the UI process. It sets exactly the
|
||||
// fields a contract already carries plus this process's own settings, and
|
||||
// leaves every remaining field at its zero value on purpose: each one is a
|
||||
// daemon-local runtime handle with no contract behind it, and the handlers
|
||||
// already degrade to a documented 501/503/empty response rather than panicking
|
||||
// (docs/prds/ui-service-boundary.md:130-131).
|
||||
//
|
||||
// What is deliberately absent, and which bead fills it:
|
||||
//
|
||||
// - Cfg, LastReload, UpdateConfig, ConfigOverrides, ResetConfig,
|
||||
// UpdateRepoField: the configuration owner stays the daemon. The read
|
||||
// crosses as the snapshot ConfigSource renders; the write routes answer
|
||||
// 503 and the page hides their controls (archie-core-ymut).
|
||||
// - LogFeed, Events, Channels, ReloadChannel, Curators, Memory,
|
||||
// Workflows, WorkRequests, RunningVersions, Chat.Updates,
|
||||
// UpdateReportPath: no contract exists for these yet.
|
||||
// Defining one amends the owning service's contract first
|
||||
// (docs/prds/ui-service-boundary.md:205-207); the route migration is
|
||||
// archie-core-8cda.5.3.
|
||||
// - TaskLogs: wired below from the store client's TaskLogStore contract.
|
||||
// Task log files live in the state directory the State Store owns, so this
|
||||
// process reads one attempt's log over that contract rather than opening
|
||||
// the file itself -- which would only work on a single host and is exactly
|
||||
// what the boundary forbids (archie-core-iaqx).
|
||||
// - Captures, CaptureIntake, CaptureMaxEvents: wired below. From the
|
||||
// cutover change (archie-core-8cda.5.4) this process is the only
|
||||
// listener serving POST /webhooks/capture/{source}: the receiver is a
|
||||
// persistence shim over the State Store contract, and the daemon's
|
||||
// binding-dispatch loop keeps consuming captures from the same store,
|
||||
// so the HTTP front door moved here without moving the owner of work
|
||||
// intake. Mounting it before the daemon's listener was gone would have
|
||||
// given two listeners the same intake authority, which the PRD forbids
|
||||
// (docs/prds/ui-service-boundary.md:30-33).
|
||||
// compose builds the dashboard server for the UI process from contract-backed
|
||||
// dependencies only. Fields left at zero are daemon-local handles; their
|
||||
// handlers answer 501/503 or empty. Config writes stay with the daemon. Task
|
||||
// logs are read through the State Store, and this process is the only listener
|
||||
// for POST /webhooks/capture/{source}.
|
||||
func compose(d deps) *webui.Server {
|
||||
srv := &webui.Server{
|
||||
Store: d.Store,
|
||||
@@ -96,7 +68,6 @@ func compose(d deps) *webui.Server {
|
||||
// Channel lifecycle follows the same split as the config view: the process
|
||||
// hosting the channels publishes, this one reads. Withholding it left
|
||||
// /api/channels answering with nothing while channels were running
|
||||
// (archie-core-8cda.6.8).
|
||||
if channels, ok := d.Store.(storecontract.ChannelStatusStore); ok {
|
||||
srv.Channels = webui.RemoteChannelStatus(channels)
|
||||
}
|
||||
@@ -115,8 +86,8 @@ func compose(d deps) *webui.Server {
|
||||
}
|
||||
// Harness OAuth token sets are a ratified State Store contract, and the
|
||||
// same client already carries them. Withholding it would leave the
|
||||
// harness page answering 503 on a deployment that has the store
|
||||
// (archie-core-egkf.7). The setup terminal itself is not wired here: its
|
||||
// harness page answering 503 on a deployment that has the store.
|
||||
// The setup terminal itself is not wired here: its
|
||||
// implementation owns a container, which this process must not link, so
|
||||
// the route stays a documented 503 until a daemon-side contract exists.
|
||||
if secrets, ok := d.Store.(storecontract.HarnessSecretStore); ok {
|
||||
@@ -130,11 +101,10 @@ func compose(d deps) *webui.Server {
|
||||
}
|
||||
// The task-log read crosses the State Store contract: the files live in
|
||||
// the state directory that process owns, so this one asks for the log
|
||||
// rather than opening a path (docs/prds/ui-service-boundary.md). Withholding
|
||||
// rather than opening a path. Withholding
|
||||
// it would degrade a page that has an owner, and would leave the dashboard
|
||||
// claiming task logging was not enabled -- see wireTaskLogs.
|
||||
// The policy chain: wired together or not at all
|
||||
// (docs/prds/orgs-and-access.md, "Where it lives").
|
||||
srv.Access = d.Access
|
||||
srv.Principals = d.Principals
|
||||
srv.Denials = d.Denials
|
||||
|
||||
@@ -19,13 +19,11 @@ import (
|
||||
//
|
||||
// The projection is an allowlist of the values this process needs --
|
||||
// [services.gateway].{target,target_token}, [services.state].{target,
|
||||
// target_token}, [web].{listen,trust_forwarded_headers} and [capture] (the
|
||||
// receiver this process mounts; archie-core-8cda.5.4). The UI reads the
|
||||
// same file the daemon does because operators already keep the service
|
||||
// endpoints there, but Options has no field for anything else in it: the
|
||||
// daemon's forge credentials, model catalog, workflow routing, NATS settings,
|
||||
// filesystem jail and agent/container settings have nowhere to land
|
||||
// (docs/prds/ui-service-boundary.md:87-89).
|
||||
// target_token}, [web].{listen,trust_forwarded_headers} and [capture]. The UI
|
||||
// reads the same file the daemon does because operators already keep the
|
||||
// service endpoints there, but Options has no field for anything else in it:
|
||||
// the daemon's forge credentials, model catalog, workflow routing, NATS
|
||||
// settings, filesystem jail and agent/container settings have nowhere to land
|
||||
func Resolve(o Options, log *slog.Logger) (Options, error) {
|
||||
if o.Config != "" {
|
||||
cfg, found, err := readProjection(o.Config, o.Overlay, log)
|
||||
@@ -194,11 +192,9 @@ func resolveToken(o Options) (string, error) {
|
||||
return webui.LoadOrCreateToken(o.TokenFile)
|
||||
}
|
||||
|
||||
// validate holds the PRD's security posture (lines 116-118): a loopback
|
||||
// listener may omit the dashboard token, a non-loopback listener requires one
|
||||
// and fails closed without it. Unlike the daemon, which mints a token
|
||||
// silently, this process refuses to start -- an operator who exposed the
|
||||
// dashboard by accident learns about it here rather than from the log.
|
||||
// Unlike the daemon, which mints a token silently, this process refuses to
|
||||
// start -- an operator who exposed the dashboard by accident learns about it
|
||||
// here rather than from the log.
|
||||
func (o Options) validate() error {
|
||||
if o.Gateway.Target == "" {
|
||||
return fmt.Errorf("gateway target is required (-gateway-target or [services.gateway].target)")
|
||||
|
||||
@@ -2,17 +2,13 @@
|
||||
// HTTP surface and the compiled SPA, served against a Gateway and a State
|
||||
// Store running in other processes.
|
||||
//
|
||||
// docs/prds/ui-service-boundary.md is the authority. The two rules that shape
|
||||
// this package are that the UI owns only process-local settings ("HTTP listen
|
||||
// address and read/header/shutdown timeouts; UI asset source or build mode;
|
||||
// UI authentication mode and token reference; Gateway endpoint and credential
|
||||
// reference; State Store endpoint and credential reference; readiness
|
||||
// endpoint and dependency timeout policy"), and that it "must never implement
|
||||
// [configuration] policy by holding or mutating a shared config.Holder".
|
||||
//
|
||||
// It deliberately lives outside internal/app/archied: that package's
|
||||
// dependency graph carries the daemon, forge, container and workflow runtimes
|
||||
// that the PRD's deletion gate forbids the UI process from linking.
|
||||
// The two rules that shape this package are that the UI owns only process-local
|
||||
// settings ("HTTP listen address and read/header/shutdown timeouts; UI asset
|
||||
// source or build mode; UI authentication mode and token reference; Gateway
|
||||
// endpoint and credential reference; State Store endpoint and credential
|
||||
// reference; readiness endpoint and dependency timeout policy"), and that it
|
||||
// "must never implement [configuration] policy by holding or mutating a shared
|
||||
// config.Holder".
|
||||
package archieui
|
||||
|
||||
import (
|
||||
@@ -82,8 +78,8 @@ type Options struct {
|
||||
TrustForwardedHeaders *bool
|
||||
|
||||
// Capture configures the unbound webhook capture receiver this process
|
||||
// mounts on its bypass mux (docs/prds/event-capture-storage.md). At the
|
||||
// cutover (archie-core-8cda.5.4) this process is the only listener
|
||||
// mounts on its bypass mux. At the
|
||||
// cutover this process is the only listener
|
||||
// serving POST /webhooks/capture/{source}: the receiver persists what
|
||||
// arrives through the State Store contract, and the daemon's
|
||||
// binding-dispatch loop consumes captures from the same store, so the
|
||||
@@ -98,11 +94,8 @@ type Options struct {
|
||||
|
||||
// DependencyTimeout bounds each readiness probe's call to a dependency.
|
||||
DependencyTimeout time.Duration
|
||||
// EventPollInterval bounds how stale the dashboard's activity feed can
|
||||
// be. This process owns no event bus, so live activity is a poll of the
|
||||
// State Store's event cursor; see webui.DefaultEventPollInterval and
|
||||
// docs/architecture/migration-decisions.md, "Dashboard live event
|
||||
// delivery".
|
||||
// EventPollInterval bounds how stale the dashboard's activity feed can be.
|
||||
// Live activity is a poll of the State Store's event cursor.
|
||||
EventPollInterval time.Duration
|
||||
// ReadHeaderTimeout and ShutdownTimeout bound the HTTP lifecycle.
|
||||
ReadHeaderTimeout time.Duration
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
// UI is ready when both of its mandatory remote contracts answer within the
|
||||
// dependency timeout; each probe consumes the dependency's own result over
|
||||
// the wire and never inspects its manager, registry or database
|
||||
// (docs/prds/ui-service-boundary.md:126-132).
|
||||
//
|
||||
// The component names match the daemon dashboard's, so the readiness view
|
||||
// reads the same whichever process serves it.
|
||||
|
||||
@@ -111,9 +111,8 @@ func Run(ctx context.Context, options Options) error {
|
||||
|
||||
// Live activity has no in-process bus in this process: the pump reads
|
||||
// events back out of the State Store over the same cursor SSE catch-up
|
||||
// uses. Backgrounded so priming past a large events table cannot delay
|
||||
// the listener (docs/architecture/migration-decisions.md, "Dashboard
|
||||
// live event delivery").
|
||||
// uses. Backgrounded so priming past a large events table cannot delay the
|
||||
// listener.
|
||||
go func() {
|
||||
if err := srv.PumpEvents(ctx, opts.EventPollInterval); err != nil {
|
||||
log.Error("event pump stopped; the activity feed will only show history", "err", err)
|
||||
@@ -156,7 +155,7 @@ func serve(ctx context.Context, listener net.Listener, handler http.Handler, opt
|
||||
// Shutdown returned once the drain deadline elapsed with a request
|
||||
// still in flight. Force-close what is left so shutdown finishes
|
||||
// and the process exits cleanly rather than carrying a deadline
|
||||
// error to the operator as a fatal exit (archie-core-u4xu).
|
||||
// error to the operator as a fatal exit.
|
||||
_ = server.Close()
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -2,18 +2,9 @@ package controlplane
|
||||
|
||||
import "github.com/samcharles93/archie-core/internal/config"
|
||||
|
||||
// AgentProfileKind is the control-plane resource for Kit and image agent
|
||||
// profiles. It exists so a Kit profile applies without a restart
|
||||
// (docs/prds/external-agent-harness.md, "Selection"): [containers].profiles
|
||||
// in config.toml is only its seed, ContainerRuntimePoliciesKind carries every
|
||||
// other container setting and none of this one (config.ContainerConfig.
|
||||
// Profiles is json:"-"), and this resource's own ApplyMode is "live".
|
||||
//
|
||||
// Its document is agentProfile (container_settings.go's snake_case wire
|
||||
// type), not config.AgentProfile directly: that internal type carries no
|
||||
// json tags, so encoding/json would fall back to its Go field names --
|
||||
// "Tools", "Image" -- exactly the defect archie-core-1171 fixed for the rest
|
||||
// of this document family.
|
||||
// AgentProfileKind is the control-plane resource holding agent profiles. Its
|
||||
// document is the snake_case agentProfile wire type, not config.AgentProfile,
|
||||
// which has no json tags.
|
||||
const AgentProfileKind = "agent-profiles"
|
||||
|
||||
func agentProfileDefinition() Definition {
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
// The channel-settings DOCUMENT lives in internal/infrastructure/controlplanerpc,
|
||||
// beside the client that projects it, so a process that only reads stored
|
||||
// settings does not link this package's store-backed server and workflow engine
|
||||
// (archie-core-1ng1). These aliases keep the store-backed side reading the same
|
||||
// settings does not link this package's store-backed server and workflow engine.
|
||||
// These aliases keep the store-backed side reading the same
|
||||
// types by the same names it always used, so there is one definition of the
|
||||
// document rather than a copy on each side of the boundary.
|
||||
type (
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
// embeds the Messaging Service's client -- the generic resource read path and
|
||||
// the channel-settings projection -- and adds the resource-specific reads and
|
||||
// watches, which need the workflow and scheduling engines that such a process
|
||||
// already links (archie-core-1ng1).
|
||||
// already links.
|
||||
type Client struct {
|
||||
*controlplanerpc.Client
|
||||
rpc pb.ControlPlaneServiceClient
|
||||
@@ -146,8 +146,8 @@ type AppliedResource struct {
|
||||
}
|
||||
|
||||
// WatchResource streams version updates for any resource kind without
|
||||
// decoding the document. It is the shape the runtime-resource watches read
|
||||
// (archie-core-zfb0.1): keepWatch reconnects on it exactly as it does on a
|
||||
// decoding the document. It is the shape the runtime-resource watches read:
|
||||
// keepWatch reconnects on it exactly as it does on a
|
||||
// typed stream, and the resume point still moves past a document the client
|
||||
// refused to decode -- the store answered with that version, and resuming
|
||||
// before it would re-offer it on every reconnect.
|
||||
|
||||
@@ -15,13 +15,11 @@ import (
|
||||
// directly: that struct's tags belong to the TOML file format, and when it was
|
||||
// the document, encoding/json fell back to its Go field names -- "Image",
|
||||
// "MaxConcurrency", "LegacyEnabled" -- the only Go-cased resource left in the
|
||||
// registry (archie-core-1171). The two durations are config.Duration, which
|
||||
// registry. The two durations are config.Duration, which
|
||||
// already writes the string the file accepts; the leak was the keys only.
|
||||
//
|
||||
// Profiles is deliberately not a field here: config.ContainerConfig.Profiles
|
||||
// is json:"-" (its own resource, AgentProfileKind, applies live where the
|
||||
// rest of this one is restart-required -- docs/prds/external-agent-harness.md
|
||||
// "Selection"), so this document never carries it either.
|
||||
// Profiles is deliberately not a field here: config.ContainerConfig.Profiles is
|
||||
// json:"-", so this document never carries it either.
|
||||
type containerRuntimePolicies struct {
|
||||
Image string `json:"image"`
|
||||
MaxConcurrency int `json:"max_concurrency"`
|
||||
|
||||
@@ -4,7 +4,6 @@ import "github.com/samcharles93/archie-core/internal/config"
|
||||
|
||||
// CredentialBindingsKind is the control-plane resource mapping a Kit
|
||||
// credential@1 service name to an org secret
|
||||
// (docs/prds/external-agent-harness.md, Credentials; docs/prds/orgs-and-access.md).
|
||||
// It exists so a binding applies without a restart, the same reason
|
||||
// AgentProfileKind is its own resource: [containers].credentials in
|
||||
// config.toml is only its seed, and kitrun.Launcher reads the live
|
||||
|
||||
@@ -48,8 +48,8 @@ func operationalDefinitions() []Definition {
|
||||
// ApplyMode is live: the daemon diffs the stored MCP server set against
|
||||
// the running providers -- connecting added servers, disconnecting
|
||||
// removed ones and reconnecting changed ones while leaving unchanged
|
||||
// servers untouched -- and rebuilds the web_fetch and minimax entries
|
||||
// (archie-core-zfb0.3). A changed server whose new engine fails to start
|
||||
// servers untouched -- and rebuilds the web_fetch and minimax entries.
|
||||
// A changed server whose new engine fails to start
|
||||
// is rolled back to the old one, so the refusal is reported rather than
|
||||
// leaving the server down.
|
||||
{Kind: ToolSettingsKind, Title: "Tool and MCP settings", ApplyMode: "live", Document: toolSettings{}, Seed: seedTools, Validate: validateTools},
|
||||
@@ -57,23 +57,20 @@ func operationalDefinitions() []Definition {
|
||||
// and the daemon's reconciliation loads new and changed files without a
|
||||
// restart. A removal cannot unload Yaegi's interpreter, so it stays an
|
||||
// outstanding apply-status problem rather than a restart of the whole kind
|
||||
// (docs/prds/plugin-settings-live.md).
|
||||
{Kind: PluginSettingsKind, Title: "Plugin settings", ApplyMode: "live", Document: pluginSettings{}, Seed: func(cfg config.Config) any {
|
||||
return pluginSettings{cfg.PluginDir, cfg.ModuleDir, cfg.SecretEngineDir, cfg.SkillsDir}
|
||||
}, Validate: validatePluginSettings},
|
||||
// ApplyMode is live: the container pool reads the published config on
|
||||
// every acquire (image, pull policy, network, max uptime, concurrency
|
||||
// cap) and the daemon resizes its running dispatcher after the publish,
|
||||
// so neither a deferred container nor a queued task needs a restart
|
||||
// (archie-core-zfb0.2). RegistryAuth is file-owned and never part of
|
||||
// so neither a deferred container nor a queued task needs a restart.
|
||||
// RegistryAuth is file-owned and never part of
|
||||
// this document, so it stays a boot-resolved value.
|
||||
{Kind: ContainerRuntimePoliciesKind, Title: "Container runtime policies", ApplyMode: "live", Document: containerRuntimePolicies{}, Seed: seedContainerPolicies, Validate: validateContainers, Normalize: normalizeContainerPolicies},
|
||||
}
|
||||
}
|
||||
|
||||
// validatePluginSettings accepts every value, deliberately. The four directories
|
||||
// are free-form operator paths, and that is the decision recorded for
|
||||
// archie-core #1143 rather than a validator nobody has written yet.
|
||||
// validatePluginSettings accepts every value, deliberately.
|
||||
//
|
||||
// Two candidate rules were considered and are refused:
|
||||
//
|
||||
@@ -134,7 +131,7 @@ func validateScheduling(input []byte) error {
|
||||
// leaves the file's label in force, which is what legacy policies
|
||||
// decode with), so a stored label-requiring trigger with no label was
|
||||
// a value the store blessed and boot refused -- the two-layer
|
||||
// disagreement the parity test refuses to allow (archie-core-7pyj).
|
||||
// disagreement the parity test refuses to allow.
|
||||
if workintake.RequiresLabel(policy.Dispatch.Trigger) && (policy.Label == nil || *policy.Label == "") {
|
||||
return fmt.Errorf("label is required when dispatch.trigger is %q (an empty label matches every open issue)", policy.Dispatch.Trigger)
|
||||
}
|
||||
|
||||
@@ -115,13 +115,10 @@ const (
|
||||
// the file document's value stays the one in effect (Client.RuntimeConfig
|
||||
// leaves an absent kind alone), with the fix still in the file. The seed is
|
||||
// retried on the next start of this process, so correcting config.toml re-seeds
|
||||
// it.
|
||||
// docs/prds/runtime-control-plane.md, "Bootstrap, migration, and recovery":
|
||||
// after migration, settings in TOML are ignored and cannot block State Store
|
||||
// startup -- and this import runs on the State Store's startup path. Fail closed
|
||||
// belongs to the process that uses the value: boot.runtimeConfig validates the
|
||||
// effective document and refuses to start archied with a value it cannot run
|
||||
// with, which is what keeps an invalid value from taking effect silently.
|
||||
// it. Fail closed belongs to the process that uses the value:
|
||||
// boot.runtimeConfig validates the effective document and refuses to start
|
||||
// archied with a value it cannot run with, which is what keeps an invalid value
|
||||
// from taking effect silently.
|
||||
func (s *Server) ImportConfig(ctx context.Context, cfg config.Config) (map[string]int64, []SeedSkip, error) {
|
||||
versions := make(map[string]int64, len(s.ordered))
|
||||
var skipped []SeedSkip
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
// workflow's two dials: whether a post-worthiness pass runs before findings are
|
||||
// posted, and whether a human approves the draft before it posts. The file's
|
||||
// [review] section seeds it; the stored document outranks the file from then on
|
||||
// (docs/prds/review-settings-resource.md).
|
||||
const ReviewSettingsKind = "review-settings"
|
||||
|
||||
type reviewSettings struct {
|
||||
|
||||
@@ -34,7 +34,6 @@ import (
|
||||
//
|
||||
// It also returns the version of each kind it read, so the process that
|
||||
// layers them in can report which version it is running
|
||||
// (docs/prds/control-plane-apply-status.md).
|
||||
func (c *Client) RuntimeConfig(ctx context.Context, base config.Config) (config.Config, map[string]int64, error) {
|
||||
return runtimeConfigFrom(ctx, c, base)
|
||||
}
|
||||
@@ -116,8 +115,8 @@ func runtimeConfigFrom(ctx context.Context, reader controlplanerpc.ResourceReade
|
||||
// The stored role assignments own cfg.Models once the store carries a
|
||||
// value, the way the provider layer above owns cfg.Providers: a role
|
||||
// removed from the store is gone from the layered document too. The
|
||||
// runtime-resource watches re-layer over an already-layered base
|
||||
// (archie-core-zfb0.1), so json.Unmarshal's map merge here would
|
||||
// runtime-resource watches re-layer over an already-layered base,
|
||||
// so json.Unmarshal's map merge here would
|
||||
// resurrect a role the store deleted every time any watched kind changed.
|
||||
if err := layerResource(ctx, reader, versions, ModelRoleAssignmentsKind, func(value []byte) error {
|
||||
var roles map[string]string
|
||||
@@ -163,7 +162,7 @@ func runtimeConfigFrom(ctx context.Context, reader controlplanerpc.ResourceReade
|
||||
// review-settings owns the pr-review dials once the store carries a value.
|
||||
// The two fields are assigned individually, not `out.Review = ...`: a field
|
||||
// added to config.Review later keeps the file's value until the stored
|
||||
// document carries it (docs/prds/review-settings-resource.md).
|
||||
// document carries it.
|
||||
if err := layerResource(ctx, reader, versions, ReviewSettingsKind, func(value []byte) error {
|
||||
var settings reviewSettings
|
||||
if err := json.Unmarshal(value, &settings); err != nil {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
// bareObjectSchema is what a descriptor advertises when its definition names no
|
||||
// document. It is the fallback, not the norm: a descriptor with no properties is
|
||||
// what left the Web UI with nothing to label, describe or format a field with
|
||||
// (archie-core-2xs6).
|
||||
const bareObjectSchema = `{"type":"object"}`
|
||||
|
||||
var timeType = reflect.TypeFor[time.Time]()
|
||||
|
||||
@@ -24,7 +24,7 @@ const projectWriteAttempts = 3
|
||||
|
||||
// WorkflowProjector carries an installed package's workflow contributions
|
||||
// into the org's workflow-definitions resource, the same document an operator
|
||||
// edits on the dashboard (docs/prds/store.md, "Packages"). The readers the
|
||||
// edits on the dashboard. The readers the
|
||||
// daemon holds read that resource per dispatch, so a projected workflow is
|
||||
// usable at the next dispatch and a withdrawn one stops dispatching, without
|
||||
// restarting processes.
|
||||
|
||||
Reference in new issue
Block a user