Problem
defaultScopeDoltDatabase() in beads_provider_lifecycle.go:276 hardcodes the city-level database name to hq:
func defaultScopeDoltDatabase(cityPath, dir, prefix string) string {
if samePath(cityPath, dir) {
return "hq"
}
return prefix
}
This means every city that connects to the same remote Dolt server will use the same hq database, causing collisions. Rig databases are correctly scoped by prefix, but the city's own beads store is not.
Context
The hq hardcoding was introduced in #147 / #184 to give the city HQ store a stable, conventional name instead of deriving it from the city name (which produced confusing prefixes like ga for gascity). That made sense for single-city-per-server deployments.
With #790 (merged 2026-04-17) now correctly propagating [dolt] host/port from city.toml to .beads/config.yaml for remote Dolt servers, multi-city remote Dolt becomes a realistic topology — but the hardcoded hq database name blocks it.
Reproduction
- Deploy a single remote Dolt server (e.g. via Helm chart to k3s)
- Create two cities pointing at the same server:
# city-a.toml
[workspace]
name = "city-a"
[dolt]
host = "dolt.k3s.lan"
port = 3307
# city-b.toml
[workspace]
name = "city-b"
[dolt]
host = "dolt.k3s.lan"
port = 3307
gc init city-a --file city-a.toml → creates database hq on remote Dolt
gc init city-b --file city-b.toml → collides on the same hq database
Both cities read/write each other's beads.
Additional observation
Separately, when gc init hits a transient network error during CREATE DATABASE IF NOT EXISTS hq, the error recovery path in gc-beads-bd.sh detects the existing hq database (from a previous city) and aborts with "This workspace is already initialized" — even though it's a different city. The IF NOT EXISTS clause never gets a chance to work because the SQL call itself failed; the "already initialized" comes from bd init seeing on-disk .beads/ state plus the existing remote database.
Suggested direction
Could the database name be scoped per-city? For example:
- Use
EffectiveHQPrefix as the database name (instead of just the bead ID prefix)
- Or derive from city name:
city-a → database city_a_hq
- Or allow
[dolt] database = "my-city-hq" in city.toml
The [workspace] prefix field from #184 already gives each city a unique prefix — it seems like a natural candidate for also scoping the database name.
Question
Is multi-city on a single remote Dolt server an intended topology? If so, the hq hardcoding needs to become city-scoped. If not, it would be helpful to document that each city requires its own Dolt server instance.
Problem
defaultScopeDoltDatabase()inbeads_provider_lifecycle.go:276hardcodes the city-level database name tohq:This means every city that connects to the same remote Dolt server will use the same
hqdatabase, causing collisions. Rig databases are correctly scoped by prefix, but the city's own beads store is not.Context
The
hqhardcoding was introduced in #147 / #184 to give the city HQ store a stable, conventional name instead of deriving it from the city name (which produced confusing prefixes likegaforgascity). That made sense for single-city-per-server deployments.With #790 (merged 2026-04-17) now correctly propagating
[dolt] host/portfromcity.tomlto.beads/config.yamlfor remote Dolt servers, multi-city remote Dolt becomes a realistic topology — but the hardcodedhqdatabase name blocks it.Reproduction
gc init city-a --file city-a.toml→ creates databasehqon remote Doltgc init city-b --file city-b.toml→ collides on the samehqdatabaseBoth cities read/write each other's beads.
Additional observation
Separately, when
gc inithits a transient network error duringCREATE DATABASE IF NOT EXISTS hq, the error recovery path ingc-beads-bd.shdetects the existinghqdatabase (from a previous city) and aborts with "This workspace is already initialized" — even though it's a different city. TheIF NOT EXISTSclause never gets a chance to work because the SQL call itself failed; the "already initialized" comes frombd initseeing on-disk.beads/state plus the existing remote database.Suggested direction
Could the database name be scoped per-city? For example:
EffectiveHQPrefixas the database name (instead of just the bead ID prefix)city-a→ databasecity_a_hq[dolt] database = "my-city-hq"in city.tomlThe
[workspace] prefixfield from #184 already gives each city a unique prefix — it seems like a natural candidate for also scoping the database name.Question
Is multi-city on a single remote Dolt server an intended topology? If so, the
hqhardcoding needs to become city-scoped. If not, it would be helpful to document that each city requires its own Dolt server instance.