refactor(backend): drop backend-driven Fabric broadcast — agent-driven model

The backend no longer broadcasts topic lifecycle events to Fabric. The
new model (per design discussion 2026-05-23 evening):

  - Proposing agent posts a single recruitment fabric-send-message
    immediately after creating a topic (carries topic_id + signup
    window + debate window + title).
  - Downstream agents that decide to participate book a HF on_call
    slot covering the debate window via `hf calendar schedule on_call
    <time> <duration> --job DEBATE-<topic_id>`.
  - HF wakes the agent naturally at slot start; the wake payload
    carries event_data with the DEBATE-<topic_id> code so the agent
    knows why it was woken.
  - The backend stays a pure data + state-machine service and doesn't
    know about Fabric.

Code removed:

  - internal/fabric/announce.go (entire file + empty dir)
  - ticker.go: broadcastLifecycle + broadcastAnnouncement + topicTarget
    helpers; announcer field on Ticker; announce field/arg on NewTicker
  - models/topic.go: AnnounceGuildBaseURL + AnnounceChannelID fields
  - store/topic_store.go: same fields on CreateTopicInput + INSERT
  - handlers/topics.go: same fields on createTopicBody + validation +
    parameter passing to store
  - handlers/verdict.go: announcer field + lifecycle broadcast on
    verdict submit
  - config/config.go: FabricSystemAPIKey field + DIALECTIC_FABRIC_SYSTEM_API_KEY
    env read
  - main.go + routes.go: announcer wiring

Database:

  - migrations/003_drop_topic_announce_target.sql drops the two columns
    added by migration 002. Counterpart commit on the deployment side
    needs DIALECTIC_FABRIC_SYSTEM_API_KEY env removed from
    docker-compose.yml; harmless if left as the backend no longer
    reads it.

Pairs with:
  - Dialectic.OpenclawPlugin: rip announce_* params from
    dialectic_propose_topic (next commit)
  - Fabric.Backend.Center: rip serviceEndpoint field + cli
  - Fabric.Backend.Guild: rip system-key bypass on ApiKeyGuard and
    announce-only-system limit on messaging.controller
  - ClawSkills: rewrite participate-debate + analyze-intel step 4 +
    delete rotate-fabric-system-key workflow
This commit is contained in:
h z
2026-05-23 23:45:22 +01:00
parent 22d9fb7ed5
commit 5cf4302d50
10 changed files with 76 additions and 343 deletions

View File

@@ -66,24 +66,14 @@ type Config struct {
OIDCIssuer string
OIDCClientID string
// Fabric announce coupling.
//
// As of Phase 3.5: only the system api key stays in env. Guild base
// URL + announce channel ID are PER-TOPIC, supplied by the proposing
// agent at create time and stored on the topic row. Different topics
// can broadcast to different guilds/channels from the same backend.
//
// FabricSystemAPIKey: header value for x-fabric-system-key when
// POSTing to announce channels. Must match Fabric.Backend.Guild's
// FABRIC_BACKEND_GUILD_SYSTEM_API_KEY env. Empty → announcer becomes
// a no-op (logs intent, skips post — useful for dev / opted-out
// environments).
FabricSystemAPIKey string
// (removed Phase 3.5: FabricGuildBaseURL, FabricAnnounceChannelID,
// FabricBotBearerToken — guild/channel moved to per-topic config;
// bot bearer obsolete since Guild's ApiKeyGuard now accepts system
// key alone for announce posts.)
// (Removed Aug 2026: all Fabric coupling — FabricSystemAPIKey,
// FabricGuildBaseURL, FabricAnnounceChannelID, FabricBotBearerToken.
// Backend no longer broadcasts lifecycle events to Fabric. The
// proposing agent posts a single recruitment fabric-send-message
// after creating a topic; downstream agents book HF on_call slots
// covering the debate window via `hf calendar schedule` and HF
// wakes them naturally. The backend stays a pure data + state-
// machine service and doesn't know about Fabric.)
// Orchestrator tick interval. 0 / unset → default 15s.
OrchestratorTickInterval time.Duration
@@ -105,7 +95,6 @@ func LoadFromEnv() (*Config, error) {
DialecticAdminAPIKey: os.Getenv("DIALECTIC_ADMIN_API_KEY"),
OIDCIssuer: os.Getenv("OIDC_ISSUER"),
OIDCClientID: os.Getenv("OIDC_CLIENT_ID"),
FabricSystemAPIKey: os.Getenv("DIALECTIC_FABRIC_SYSTEM_API_KEY"),
}
if d := os.Getenv("ORCHESTRATOR_TICK_INTERVAL"); d != "" {
if parsed, err := time.ParseDuration(d); err == nil {