MCPcopy Create free account
hub / github.com/Facets-cloud/flow / lookupBoundTask

Function lookupBoundTask

internal/app/hook.go:124–143  ·  view source on GitHub ↗

lookupBoundTask returns the task whose session_id matches $CLAUDE_CODE_SESSION_ID, or nil if no such task exists, the env var is unset, or the DB lookup fails. Hook code must never fail loud — a hook error blocks the user's session — so all errors are swallowed and treated as "unbound".

()

Source from the content-addressed store, hash-verified

122// hook error blocks the user's session — so all errors are swallowed
123// and treated as "unbound".
124func lookupBoundTask() *flowdb.Task {
125 sid := currentSessionID()
126 if sid == "" {
127 return nil
128 }
129 dbPath, err := flowDBPath()
130 if err != nil {
131 return nil
132 }
133 db, err := flowdb.OpenDB(dbPath)
134 if err != nil {
135 return nil
136 }
137 defer db.Close()
138 t, err := flowdb.TaskBySessionID(db, sid)
139 if err != nil {
140 return nil
141 }
142 return t
143}
144
145// lookupBoundTaskSlug returns the slug of the bound task, or "" if the
146// session is unbound. Thin wrapper over lookupBoundTask.

Callers 2

lookupBoundTaskSlugFunction · 0.85
cmdHookUserPromptSubmitFunction · 0.85

Calls 3

OpenDBFunction · 0.92
TaskBySessionIDFunction · 0.92
flowDBPathFunction · 0.85

Tested by

no test coverage detected