deer-flow/backend/packages/harness/deerflow/runtime
d33kayyy 84bbdf6e00
fix(langfuse): resolve trace user from runtime context (#3794)
* fix(langfuse): resolve trace user from runtime context

The worker built langfuse_user_id from get_effective_user_id(), which reads
the request-scoped _current_user ContextVar. For runs invoked over an
internal token on behalf of an end user, that ContextVar is never the end
user, so traces recorded langfuse_user_id="default".

Switch to resolve_runtime_user_id(runtime), matching the sandbox
middleware/tools sites: it reads runtime.context["user_id"] (the owner
carried in the run request's context, which survives background-task
boundaries) and falls back to get_effective_user_id() for no-auth / browser
paths. Caller-supplied metadata still wins via inject_langfuse_metadata's
setdefault.

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-05 00:07:27 +08:00
..
checkpointer fix(runtime): protect sync singleton init and reset (#3413) 2026-06-08 08:38:36 +08:00
events feat(subagents): persist and display subagent step history (#3779) (#3845) 2026-07-02 07:43:09 +08:00
runs fix(langfuse): resolve trace user from runtime context (#3794) 2026-07-05 00:07:27 +08:00
store fix(store): honor unified database configuration (#3904) 2026-07-03 07:46:04 +08:00
stream_bridge fix(redis): stream retention recovery (#3933) 2026-07-04 16:07:42 +08:00
__init__.py feat(gateway): add redis stream bridge (#3191) 2026-07-04 09:21:19 +08:00
converters.py Fix the issues when reviewing 2566 persistant part (#2604) 2026-04-28 11:44:40 +08:00
goal.py feat(runtime): implement goal continuations (#3858) 2026-07-03 08:49:33 +08:00
journal.py feat(gateway): cache-aware cost accounting (#3920) 2026-07-04 23:14:46 +08:00
secret_context.py feat(skills): bind request-scoped secrets for autonomously-invoked skills (A+) (#3938) 2026-07-04 23:34:32 +08:00
serialization.py fix(serialization): strip base64 image data from streamed values events (#3631) 2026-06-19 11:23:07 +08:00
user_context.py fix(agents): make update_agent honor runtime.context user_id like setup_agent (#2867) 2026-05-12 23:18:54 +08:00