Merge branch 'run/pg-w1' into worktree-giggly-marinating-lamport

This commit is contained in:
sam committed 2026-09-24 02:30:47 +10:00
commit cb1cd62eea
25 files changed
+294 -62

No files matched your search

+22
View File
@@ -387,6 +387,25 @@ tasks:
Ctrl-C stops all five.
deps: [dev:daemon, dev:gateway, dev:state-store, dev:dashboard, dev:ui]
dev:postgres:
desc: "Start the dev PostgreSQL 18 service and wait until it accepts connections (prefer `task dev`)"
cmds:
- docker compose up -d postgres
# `up -d` returns before the container is ready; wait for its
# healthcheck so the State Store (which fails closed on a bad URL) does
# not race the boot.
- |
set -eu
for _ in $(seq 1 60); do
status=$(docker inspect --format '{{.State.Health.Status}}' "$(docker compose ps -q postgres)" 2>/dev/null || true)
if [ "$status" = "healthy" ]; then
exit 0
fi
sleep 1
done
echo "postgres did not become healthy within 60s" >&2
exit 1
dev:daemon:
desc: archied only, live-reloading via air (prefer `task dev`)
cmds:
@@ -399,6 +418,9 @@ tasks:
dev:state-store:
desc: archie-state-store only, no live-reload (prefer `task dev`)
# The State Store fails closed without a PostgreSQL URL (Postgres-only
# epic), so bring the Compose service up and wait for it before booting.
deps: [dev:postgres]
cmds:
- go run ./cmd/archie-state-store -config-overlay deployments/dev.toml
+6
View File
@@ -15,6 +15,12 @@
# work_dir = "~/.local/share/archie/work" # default
# db_path = "~/.local/share/archie/archie.db" # prefix for independent task and conversation SQLite files
# The standalone State Store's PostgreSQL connection. Required: the store
# fails closed rather than fall back to SQLite, so leave this unset only if
# you do not run archie-state-store. `docker compose up -d postgres` starts
# a matching local postgres:18 with this default URL.
# database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
# skills_dir = "~/.local/share/archie/skills" # SKILL.md search path; defaults under work_dir when unset
# plugin_dir = "~/.local/share/archie/plugins" # daemon plugin manifests; unset means no plugins are loaded
# module_dir = "~/.local/share/archie/modules" # EDA playbook Module action kinds (log.go etc.); unset means no modules loaded
+6
View File
@@ -8,6 +8,12 @@
# [web], [services.*] and [capture] land in archie-ui; the daemon ignores
# [web] entirely.
# `task dev` runs archie-state-store against this overlay, and the State Store
# fails closed without a PostgreSQL URL. This must reach the `postgres`
# service in docker-compose.yml, which `task dev` brings up first via
# dev:postgres -- keep the URL and that service in agreement.
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
[web]
listen = "127.0.0.1:8484"
+4
View File
@@ -16,6 +16,10 @@ bot_user = "archie"
diff_cap_lines = 0
work_dir = "~/.local/share/archie/work"
db_path = "~/.local/share/archie/archie.db"
# The State Store's PostgreSQL connection (required; Postgres-only epic).
# `docker compose up -d postgres` provides this local default; point it at
# your own Postgres 18 server otherwise.
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
[services.gateway]
target = "127.0.0.1:8585"
+4
View File
@@ -7,6 +7,10 @@
work_dir = "~/.local/share/archie/work"
db_path = "~/.local/share/archie/archie.db"
# The State Store's PostgreSQL connection (required; Postgres-only epic).
# `docker compose up -d postgres` provides this local default; point it at
# your own Postgres 18 server otherwise.
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
[services.gateway]
target = "127.0.0.1:8585"
@@ -8,6 +8,10 @@
work_dir = "~/.local/share/archie/work"
db_path = "~/.local/share/archie/archie.db"
# The State Store's PostgreSQL connection (required; Postgres-only epic).
# `docker compose up -d postgres` provides this local default; point it at
# your own Postgres 18 server otherwise.
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
[services.gateway]
target = "127.0.0.1:8585"
+4
View File
@@ -7,6 +7,10 @@
work_dir = "~/.local/share/archie/work"
db_path = "~/.local/share/archie/archie.db"
# The State Store's PostgreSQL connection (required; Postgres-only epic).
# `docker compose up -d postgres` provides this local default; point it at
# your own Postgres 18 server otherwise.
database_url = "postgres://archie:archie@127.0.0.1:5432/archie?sslmode=disable"
poll_interval = "60s"
label = "archie"
bot_user = "archie-bot"
+27
View File
@@ -12,6 +12,32 @@
# docker compose logs -f nats (the bus)
services:
# ── PostgreSQL (State Store) ───────────────────────────────────
# The standalone archie-state-store process's database. PostgreSQL 18 is
# the required minimum and target; `postgres.Open` refuses anything older.
# `task dev` brings this up before the State Store via dev:postgres. The
# credentials and database name below are the dev default mirrored by
# deployments/dev.toml's database_url -- change both together.
postgres:
image: postgres:18
environment:
POSTGRES_USER: archie
POSTGRES_PASSWORD: archie
POSTGRES_DB: archie
# postgres:18 moved its default PGDATA under a versioned path; pin the
# classic location so the named volume keeps working across image updates.
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
- pg_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U archie -d archie"]
interval: 10s
timeout: 5s
retries: 5
# ── NATS JetStream ────────────────────────────────────────────────
nats:
image: nats:2.14-alpine3.22
@@ -56,6 +82,7 @@ services:
volumes:
nats_data:
pg_data:
# The subnet is pinned for the optional external-broker profile because its
# configured URL must be reachable from both the native daemon and workers.
+8
View File
@@ -21,6 +21,7 @@ import (
"syscall"
"time"
"github.com/jackc/pgx/v5/pgxpool"
natsio "github.com/nats-io/nats.go"
"github.com/samcharles93/ai-sdk/runtime"
@@ -108,6 +109,13 @@ type boot struct {
st storecontract.TaskStore
eda *edastore.Store
// pg is the State Store process's process-scoped PostgreSQL pool, opened
// and migrated by openStateStorePool. It is the one connection the
// standalone archie-state-store binary holds: do not open a second pool
// per subsystem. Nil for every process that is not the State Store (the
// daemon and gateway dial the State Store over gRPC and never open
// Postgres themselves).
pg *pgxpool.Pool
// stateStore is the State Store contract adapter every daemon and gateway
// store consumer depends on. It is ALWAYS the remote *staterpc.Client
// dialed to the standalone archie-state-store gRPC service at
@@ -14,6 +14,7 @@ import (
"github.com/samcharles93/archie-core/internal/app/controlplane"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgtest"
)
// staleDatabaseOwnedSettings are TOML fragments, each carrying one value a
@@ -70,9 +71,12 @@ func TestLoadConfigAcceptsStaleDatabaseOwnedValues(t *testing.T) {
// staleBootGrace is how long one boot in
// TestStateStoreBootsWithStaleDatabaseOwnedValues may run before the test cancels
// it: short, because the assertion does not depend on it -- a refusal arrives as
// an error either before the cancel (first select) or after it (second select,
// where a non-Canceled error fails the test).
// it. A refusal arrives as an error before the cancel (first select); a boot
// that serves returns only after the cancel (second select). The bound must be
// long enough for a full boot -- now Postgres pool + migration, then SQLite and
// the control-plane seed -- to finish, because cancelling mid-seed surfaces a
// transaction error that reads as a refusal rather than as the interrupt it is.
// 2s matches startupGrace, the sibling single-boot bound.
//
// staleShutdownGrace bounds the shutdown, and is deliberately not the 5s the
// single-boot regression test uses: this table runs five boots back to back on a
@@ -80,7 +84,7 @@ func TestLoadConfigAcceptsStaleDatabaseOwnedValues(t *testing.T) {
// the bound costs nothing when shutdown is quick and only decides how long a
// failure takes to report.
const (
staleBootGrace = 250 * time.Millisecond
staleBootGrace = 2 * time.Second
staleShutdownGrace = 30 * time.Second
)
@@ -99,8 +103,8 @@ func TestStateStoreBootsWithStaleDatabaseOwnedValues(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "config.toml")
body := fmt.Sprintf(
"bot_user = 'archie'\ndb_path = %q\n%s[forge]\ntype = 'github'\nhost = 'https://github.example.com'\n",
filepath.Join(dir, "state.db"), tt.body,
"bot_user = 'archie'\ndb_path = %q\ndatabase_url = %q\n%s[forge]\ntype = 'github'\nhost = 'https://github.example.com'\n",
filepath.Join(dir, "state.db"), pgtest.URL(t), tt.body,
)
if err := os.WriteFile(path, []byte(body), 0o600); err != nil {
t.Fatal(err)
+14
View File
@@ -0,0 +1,14 @@
package archied
import (
"os"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgtest"
)
// TestMain runs the archied test binary against a throwaway PostgreSQL 18
// container, mirroring internal/infrastructure/postgres. The State Store's
// openStateStore fails closed without a working database_url, so the tests
// that exercise it (e.g. TestStateStoreDataSurvivesRestart) need a real pool.
func TestMain(m *testing.M) { os.Exit(pgtest.Main(m)) }
+10 -46
View File
@@ -15,7 +15,6 @@ import (
"fmt"
"net"
"net/http"
"path/filepath"
"time"
"google.golang.org/grpc"
@@ -25,10 +24,8 @@ import (
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/identity"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/infrastructure/edastore"
"github.com/samcharles93/archie-core/internal/infrastructure/readiness"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/store"
)
func configuredIdentityNames(cfg config.Config) []string {
@@ -187,10 +184,11 @@ func openStateStoreControlPlane(resources controlplane.ResourceStore) (*controlp
return server, nil
}
// openStateStore opens the single task-store SQLite file exactly once for
// service ownership. It resolves secrets (for the binding cipher) but does
// NOT open gateway chat sessions -- those live in the separate archie-gateway
// process on their own SQLite file and are out of state-store scope.
// openStateStore composes the State Store process's persistence: it resolves
// secrets (for the binding cipher), opens and migrates the process-scoped
// PostgreSQL pool (fail closed), and opens the task and event-capture stores.
// It does NOT open gateway chat sessions -- those live in the separate
// archie-gateway process on their own store and are out of state-store scope.
func (b *boot) openStateStore(ctx context.Context) error {
cfg, log := b.cfg, b.log
secrets, err := configuredSecretRegistry(&cfg, log)
@@ -204,51 +202,17 @@ func (b *boot) openStateStore(ctx context.Context) error {
log.Error("configure bindings cipher", "err", err)
return err
}
// Claim the database before opening it. This process is the file's owner
// for as long as it lives, and the claim is what an offline recovery
// command checks before it rewrites the file: without it, "the State Store
// is stopped" is a rule the operator is trusted to have followed rather
// than a fact the command can verify. A second State Store on the same
// database fails here, which is the single-owner invariant stated instead
// of merely documented.
path := taskDBPath(cfg.DBPath)
ownership, err := store.AcquireOwnership(path)
if err != nil {
log.Error("claim state store ownership", "err", err)
// Open the PostgreSQL pool and apply the schema before anything else: the
// State Store fails closed without a working database_url.
if err := b.openStateStorePool(ctx); err != nil {
return err
}
b.addCleanup(func() {
if err := ownership.Release(); err != nil {
log.Error("release state store ownership", "err", err)
}
})
eda, err := edastore.Open(edastore.Config{
DBPath: edaDBPath(cfg.DBPath),
DataDir: filepath.Join(filepath.Dir(path), "eda"),
Cipher: bindingCipher,
})
if err != nil {
log.Error("open event-capture store", "err", err)
if err := b.openTaskStore(ctx, taskDBPath(cfg.DBPath)); err != nil {
return err
}
b.eda = eda
b.addCleanup(func() {
if err := eda.Close(); err != nil {
log.Error("close event-capture store", "err", err)
}
})
st, err := openProductionTaskStore(ctx, path)
if err != nil {
log.Error("open state store", "err", err)
if err := b.openEDAStore(cfg, bindingCipher); err != nil {
return err
}
b.st = st
b.addCleanup(func() {
if err := st.Close(); err != nil {
log.Error("close state store", "err", err)
}
})
return nil
}
+33
View File
@@ -0,0 +1,33 @@
package archied
import (
"path/filepath"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/edastore"
)
// openEDAStore opens the event-capture store (PocketBase today, Postgres when
// L2 ports it) beside the task database. It is a separate composition file
// from openTaskStore so L2 can replace edastore.Open here without colliding
// with L1's replacement of openProductionTaskStore -- the two lanes write
// different files.
func (b *boot) openEDAStore(cfg config.Config, cipher edastore.BindingCipher) error {
path := taskDBPath(cfg.DBPath)
eda, err := edastore.Open(edastore.Config{
DBPath: edaDBPath(cfg.DBPath),
DataDir: filepath.Join(filepath.Dir(path), "eda"),
Cipher: cipher,
})
if err != nil {
b.log.Error("open event-capture store", "err", err)
return err
}
b.eda = eda
b.addCleanup(func() {
if err := eda.Close(); err != nil {
b.log.Error("close event-capture store", "err", err)
}
})
return nil
}
+38
View File
@@ -0,0 +1,38 @@
package archied
import (
"context"
"errors"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres"
)
// openStateStorePool opens the State Store process's one process-scoped
// PostgreSQL pool and applies the schema. It is the fail-closed seam for the
// Postgres-only epic: a missing or invalid database_url stops the State Store
// from starting rather than falling back to SQLite, and a migration failure is
// a startup failure, not a warning.
//
// The pool is stored on boot.pg and closed at shutdown; nothing opens a second
// pool per subsystem.
func (b *boot) openStateStorePool(ctx context.Context) error {
url := b.cfg.DatabaseURL
if url == "" {
err := errors.New("database_url is required: the State Store is Postgres-only and refuses to fall back to SQLite")
b.log.Error("open state store postgres pool", "err", err)
return err
}
pool, err := postgres.Open(ctx, url)
if err != nil {
b.log.Error("open state store postgres pool", "err", err)
return err
}
if err := postgres.Migrate(ctx, pool, postgres.Migrations()); err != nil {
pool.Close()
b.log.Error("migrate state store postgres schema", "err", err)
return err
}
b.pg = pool
b.addCleanup(pool.Close)
return nil
}
@@ -0,0 +1,32 @@
package archied
import (
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/config"
)
// TestOpenStateStorePoolFailsClosedWithoutURL pins D1.2: the State Store is
// Postgres-only, so a missing database_url must stop it from starting rather
// than fall back to SQLite.
func TestOpenStateStorePoolFailsClosedWithoutURL(t *testing.T) {
b := newBootstrap()
b.cfg = config.Config{}
if err := b.openStateStorePool(t.Context()); err == nil {
t.Fatal("openStateStorePool without database_url succeeded; want fail closed")
} else if !strings.Contains(err.Error(), "database_url is required") {
t.Fatalf("openStateStorePool error = %v, want it to name the missing database_url", err)
}
}
// TestOpenStateStorePoolFailsClosedOnInvalidURL pins the invalid half of D1.2:
// a URL that will not connect (here, one that does not parse) is the same
// failure as an absent one, surfaced at boot rather than at first query.
func TestOpenStateStorePoolFailsClosedOnInvalidURL(t *testing.T) {
b := newBootstrap()
b.cfg = config.Config{DatabaseURL: "://not-a-url"}
if err := b.openStateStorePool(t.Context()); err == nil {
t.Fatal("openStateStorePool with an unparseable database_url succeeded; want fail closed")
}
}
@@ -14,6 +14,7 @@ import (
"time"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgtest"
)
// startupGrace is how long RunStateStore is given to either refuse the config
@@ -56,7 +57,7 @@ func TestRunStateStoreAcceptsEnvironmentToken(t *testing.T) {
t.Setenv("STATE_STORE_TOKEN", "environment-token")
dir := t.TempDir()
path := filepath.Join(dir, "config.toml")
data := fmt.Sprintf("bot_user = 'archie'\ndb_path = %q\n[forge]\ntype = 'github'\nhost = 'https://github.example.com'\n[[repos]]\nowner = 'acme'\nname = 'widget'\n", filepath.Join(dir, "state.db"))
data := fmt.Sprintf("bot_user = 'archie'\ndb_path = %q\ndatabase_url = %q\n[forge]\ntype = 'github'\nhost = 'https://github.example.com'\n[[repos]]\nowner = 'acme'\nname = 'widget'\n", filepath.Join(dir, "state.db"), pgtest.URL(t))
if err := os.WriteFile(path, []byte(data), 0o600); err != nil {
t.Fatal(err)
}
+39
View File
@@ -0,0 +1,39 @@
package archied
import (
"context"
"github.com/samcharles93/archie-core/internal/store"
)
// openTaskStore claims ownership of the task database and opens the production
// task store. The ownership claim is what makes "the State Store is stopped" a
// fact an offline recovery command can check, and a second State Store on the
// same database fails here. It is a separate composition file from openEDAStore
// so L1 can replace openProductionTaskStore (and the ownership claim, per the
// serve-ownership decision) here without colliding with L2's edastore port.
func (b *boot) openTaskStore(ctx context.Context, path string) error {
ownership, err := store.AcquireOwnership(path)
if err != nil {
b.log.Error("claim state store ownership", "err", err)
return err
}
b.addCleanup(func() {
if err := ownership.Release(); err != nil {
b.log.Error("release state store ownership", "err", err)
}
})
st, err := openProductionTaskStore(ctx, path)
if err != nil {
b.log.Error("open state store", "err", err)
return err
}
b.st = st
b.addCleanup(func() {
if err := st.Close(); err != nil {
b.log.Error("close state store", "err", err)
}
})
return nil
}
+5 -1
View File
@@ -13,6 +13,7 @@ import (
pb "github.com/samcharles93/archie-core/internal/contracts/state/v1"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/infrastructure/edastore"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgtest"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/logging"
"github.com/samcharles93/archie-core/internal/store"
@@ -170,7 +171,10 @@ func TestStateStoreDepsServePlaybookDispatcher(t *testing.T) {
// (RunStateStore's own opener, not a test-only shortcut) round-trips through
// the file rather than an in-memory or per-process store.
func TestStateStoreDataSurvivesRestart(t *testing.T) {
cfg := config.Config{DBPath: filepath.Join(t.TempDir(), "archie")}
cfg := config.Config{
DBPath: filepath.Join(t.TempDir(), "archie"),
DatabaseURL: pgtest.URL(t),
}
first := newBootstrap()
first.cfg = cfg
+10 -3
View File
@@ -485,9 +485,16 @@ type Config struct {
ModuleDir string `toml:"module_dir" yaml:"module_dir"`
// SecretEngineDir contains Yaegi secret-engine plugins. Built-in env and
// bws engines remain available when this is empty.
SecretEngineDir string `toml:"secret_engine_dir" yaml:"secret_engine_dir"`
DBPath string `toml:"db_path" yaml:"db_path"`
PollInterval Duration `toml:"poll_interval" yaml:"poll_interval"`
SecretEngineDir string `toml:"secret_engine_dir" yaml:"secret_engine_dir"`
DBPath string `toml:"db_path" yaml:"db_path"`
// DatabaseURL is the PostgreSQL connection URL the standalone State Store
// process opens at boot. It is bootstrap-only (the same class as db_path
// and work_dir): the pool is opened once, so a runtime change cannot take
// effect, and it is refused by the runtime overlay. It has no default --
// an empty value is a startup error for the State Store, which fails
// closed rather than fall back to SQLite (the epic is Postgres-only).
DatabaseURL string `toml:"database_url" yaml:"database_url"`
PollInterval Duration `toml:"poll_interval" yaml:"poll_interval"`
// Label marks issues archie should pick up.
Label string `toml:"label" yaml:"label"`
BotUser string `toml:"bot_user" yaml:"bot_user"`
@@ -226,6 +226,11 @@ func (l *Loader) applyGeneralDefaults(cfg *config.Config) {
cfg.WorkDir = expandHomePath(cfg.WorkDir)
cfg.DBPath = expandHomePath(cfg.DBPath)
cfg.Chat.Workspace = expandHomePath(cfg.Chat.Workspace)
// DatabaseURL has no default and is not path-expanded: it is a connection
// URL, not a file path. Empty means "not configured", which the State
// Store refuses at boot (fail closed) rather than a value this loader can
// invent -- a wrong default would point a production store at a database
// that does not exist.
if cfg.WorkDir == "" {
cfg.WorkDir = filepath.Join(l.dataHome(), "archie", "work")
}
@@ -9,6 +9,7 @@ package configuration
// config renderer can reference the policy without linking the overlay's
// SQLite store (archie-core-8cda.5.6).
var DeniedKeys = map[string]string{
"db_path": "required for bootstrap; cannot be changed at runtime",
"work_dir": "pins the daemon's working layout; cannot be changed at runtime",
"db_path": "required for bootstrap; cannot be changed at runtime",
"database_url": "required for bootstrap; cannot be changed at runtime",
"work_dir": "pins the daemon's working layout; cannot be changed at runtime",
}
+2
View File
@@ -243,6 +243,7 @@ type BudgetsView struct {
type StorageView struct {
WorkDir string `json:"work_dir"`
DBPath string `json:"db_path"`
DatabaseURL string `json:"database_url"`
SkillsDir string `json:"skills_dir,omitempty"`
PluginDir string `json:"plugin_dir,omitempty"`
SecretEngineDir string `json:"secret_engine_dir,omitempty"`
@@ -375,6 +376,7 @@ func BuildConfigView(in ConfigViewInput) ConfigView {
Storage: StorageView{
WorkDir: cfg.WorkDir,
DBPath: cfg.DBPath,
DatabaseURL: cfg.DatabaseURL,
SkillsDir: cfg.SkillsDir,
PluginDir: cfg.PluginDir,
SecretEngineDir: cfg.SecretEngineDir,
+1 -1
View File
@@ -345,7 +345,7 @@ func TestHandleConfigReportsLockedKeys(t *testing.T) {
if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil {
t.Fatalf("decode: %v", err)
}
for _, key := range []string{"db_path", "work_dir"} {
for _, key := range []string{"db_path", "database_url", "work_dir"} {
if got.Locked[key] == "" {
t.Errorf("Locked[%q] is empty, want a reason", key)
}
+2
View File
@@ -148,6 +148,7 @@ func configFieldDescriptors() []ConfigSection {
Fields: []ConfigField{
{Key: "work_dir", Label: "Work directory", Type: FieldString, Editable: false},
{Key: "db_path", Label: "State path prefix", Type: FieldString, Editable: false},
{Key: "database_url", Label: "PostgreSQL URL", Description: "The State Store's database connection; set at boot, restart required.", Type: FieldString, Editable: false},
{Key: "skills_dir", Label: "Shared skills directory", Description: "Empty uses the work directory.", Type: FieldString, Editable: true, RestartRequired: true},
{Key: "plugin_dir", Label: "Daemon plugin directory", Description: "Empty means no daemon plugins.", Type: FieldString, Editable: true, RestartRequired: true},
{Key: "secret_engine_dir", Label: "Secret engine plugin directory", Description: "Empty means built-in secret engines only.", Type: FieldString, Editable: true, RestartRequired: true},
@@ -192,6 +193,7 @@ func configFieldValues(view ConfigView) map[string]any {
"budgets.gate_max_failures": view.Budgets.GateMaxFailures,
"work_dir": view.Storage.WorkDir,
"db_path": view.Storage.DBPath,
"database_url": view.Storage.DatabaseURL,
"skills_dir": view.Storage.SkillsDir,
"plugin_dir": view.Storage.PluginDir,
"secret_engine_dir": view.Storage.SecretEngineDir,
+3 -2
View File
@@ -64,7 +64,7 @@ func TestConfigFieldDescriptorsAreComplete(t *testing.T) {
"bot_user", "bot_email", "label", "forge.type", "forge.host", "diff_cap_lines",
"repos", "models", "providers",
"budgets.max_steps", "budgets.wall_clock", "budgets.gate_max_failures",
"work_dir", "db_path", "skills_dir", "plugin_dir", "secret_engine_dir",
"work_dir", "db_path", "database_url", "skills_dir", "plugin_dir", "secret_engine_dir",
"containers.image", "containers.max_concurrency", "containers.max_uptime",
"containers.volume_ttl", "containers.pull_policy", "containers.network",
"web.listen",
@@ -101,6 +101,7 @@ func TestConfigFieldDescriptorsRestartRequiredIsDeliberate(t *testing.T) {
"budgets.gate_max_failures": false,
"work_dir": false, // locked, not merely restart-required
"db_path": false, // locked, not merely restart-required
"database_url": false, // locked, not merely restart-required
"skills_dir": true, // absent from reloadableFields
"plugin_dir": true,
"secret_engine_dir": true,
@@ -148,7 +149,7 @@ func TestConfigFieldDescriptorsStructuredFieldsAreNotEditable(t *testing.T) {
// renderer does not need runtime state to know not to offer an edit
// affordance for a key that can never succeed.
func TestConfigFieldDescriptorsLockedStorageFieldsAreNotEditable(t *testing.T) {
locked := map[string]bool{"work_dir": true, "db_path": true}
locked := map[string]bool{"work_dir": true, "db_path": true, "database_url": true}
for _, section := range configFieldDescriptors() {
for _, f := range section.Fields {
if locked[f.Key] && f.Editable {