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:
@@ -23,17 +23,15 @@ type TopicStore struct {
|
||||
func NewTopicStore(db *sqlx.DB) *TopicStore { return &TopicStore{db: db} }
|
||||
|
||||
type CreateTopicInput struct {
|
||||
Title string
|
||||
Summary string
|
||||
Visibility models.Visibility
|
||||
VerdictSchemaID string
|
||||
SignupOpenAt time.Time
|
||||
SignupCloseAt time.Time
|
||||
DebateStartAt time.Time
|
||||
DebateEndAt time.Time
|
||||
CreatorUserID string
|
||||
AnnounceGuildBaseURL *string // optional; null = no broadcasts for this topic
|
||||
AnnounceChannelID *string
|
||||
Title string
|
||||
Summary string
|
||||
Visibility models.Visibility
|
||||
VerdictSchemaID string
|
||||
SignupOpenAt time.Time
|
||||
SignupCloseAt time.Time
|
||||
DebateStartAt time.Time
|
||||
DebateEndAt time.Time
|
||||
CreatorUserID string
|
||||
}
|
||||
|
||||
func (s *TopicStore) Create(ctx context.Context, in CreateTopicInput) (*models.Topic, error) {
|
||||
@@ -41,11 +39,11 @@ func (s *TopicStore) Create(ctx context.Context, in CreateTopicInput) (*models.T
|
||||
_, err := s.db.ExecContext(ctx, `
|
||||
INSERT INTO topics (id, title, summary, visibility, verdict_schema_id,
|
||||
signup_open_at, signup_close_at, debate_start_at, debate_end_at,
|
||||
creator_user_id, announce_guild_base_url, announce_channel_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
creator_user_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
id, in.Title, in.Summary, in.Visibility, in.VerdictSchemaID,
|
||||
in.SignupOpenAt, in.SignupCloseAt, in.DebateStartAt, in.DebateEndAt,
|
||||
in.CreatorUserID, in.AnnounceGuildBaseURL, in.AnnounceChannelID)
|
||||
in.CreatorUserID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("insert topic: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user