From 64efb569c336f7b005756e520af732b60476d5eb Mon Sep 17 00:00:00 2001 From: Aska Date: Mon, 7 Sep 2026 19:57:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(flow):=20=E5=8F=91=E5=B8=83=20backthink=20?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E7=9A=84=20graph=5Fupdate=E2=80=94=E2=80=94?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=80=9D=E8=80=83=E9=A1=B5=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=E5=AF=BC=E5=9B=BE=E4=B8=8D=E5=86=8D=E6=98=AF'=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E4=BA=8B=E4=BB=B6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FlowPublisher allow 谓词只允许 web/web:*,sess-backthink 被排除→backthink 的 输入→思考→输出图从不发布,后台思考页'查看链路导图'恒为'等待 graph_update 事件'。 - backthink.go: 导出 DefaultSessionID="sess-backthink" - wire.go: 谓词追加 sessionID==backthink.DefaultSessionID(web + backthink 都发;sess-xxx 隔离仍过滤) go build/vet/test 全绿; 已重建部署. 下次 backthink(5min心跳)运行时即发布该会话图. --- cmd/cyrene/wire.go | 7 ++++++- internal/services/backthink/backthink.go | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/cyrene/wire.go b/cmd/cyrene/wire.go index 6878d3c..60f934f 100644 --- a/cmd/cyrene/wire.go +++ b/cmd/cyrene/wire.go @@ -323,7 +323,12 @@ func (a *app) wireRuntime() error { flowPub := loop.NewFlowPublisher( func(subject string, payload any) { _ = a.bus.Publish(context.Background(), subject, payload) }, func(sessionID string) bool { - return sessionID == history.MainSessionID || strings.HasPrefix(sessionID, history.MainSessionID+":") + // Publish the web/main flow graph (web chat + IM owner-private mirror) AND the + // autonomous-backthink session, so the backthink page's flow link graph renders + // too (design/20 §2). Other isolated channel sessions (sess-xxx) stay filtered. + return sessionID == history.MainSessionID || + strings.HasPrefix(sessionID, history.MainSessionID+":") || + sessionID == backthink.DefaultSessionID }, ) checkpoint, perr := persist.New(context.Background(), a.db, a.log) diff --git a/internal/services/backthink/backthink.go b/internal/services/backthink/backthink.go index 705018b..a2b1185 100644 --- a/internal/services/backthink/backthink.go +++ b/internal/services/backthink/backthink.go @@ -64,6 +64,11 @@ const ( defaultSessionID = "sess-backthink" ) +// DefaultSessionID is the exported loop.Run session key for an autonomous think. It is +// exposed so the flow-viz publisher (cmd/cyrene) can also publish the backthink flow +// graph, which the backthink page and the web-chat flow page both render. +const DefaultSessionID = "sess-backthink" + // Sentinel errors returned by this package. Use errors.Is to test for them; they // are returned directly or wrapped with %w so the underlying cause stays intact. var (