Skip to content

60 track user sessions with langfuse - #62

Open
RFOxbury wants to merge 2 commits into
devfrom
60-track-user-sessions-with-langfuse
Open

60 track user sessions with langfuse#62
RFOxbury wants to merge 2 commits into
devfrom
60-track-user-sessions-with-langfuse

Conversation

@RFOxbury

@RFOxbury RFOxbury commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

What / why

  • Implement Langfuse User tracking. Traces > Sessions > Users
  • Add the Langfuse skill
  • Reinstate dead code for tracking the inputs and outputs of traces starting "run:". This was the case because task 23 got rid of the skeleton(?) and replaced it with runner.py. NB we should check if the changes from task 23 killed off any other code

NB currently, the Planning conversation is tracked as a separate session from the rest of the run. From conversation with @shabrf :

I think makes sense to have them grouped under one ID but it should ideally be linked to the task id rather than the planning chat ID. But the issue is that currently the task database rows aren't created until the plan is created and the user runs it. I think maybe leave it for now and I can take a look with the vocab change PR, since this likely has repercussions with the vocab change from plan->agent.

Proof it works

  • make verify: pass
  • Manual / end-to-end:

To test, I suggest:

  • Add a new Langfuse environment (call it whatever you like, or simply "test") via the LANGFUSE_TRACING_ENVIRONMENT variable in .env.
  • Mint a token with a novel username via
cd backend
uv run python -m policy_atlas.api.dev_issuer init --dir .dev-issuer
uv run python -m policy_atlas.api.dev_issuer mint --dir .dev-issuer \
  --sub <YOUR-CHOSEN-USERNAME> --client-id policy-atlas-dev  # prints a bearer token — copy it
  • Then spin up the backend server and frontend as usual following the instructions in the README.md
  • Run a rapid search and verify that your username appears in our Langfuse instance under the environment you have created (or "test" if that's what you used).
  • Repeat the process with a different made up username.

Risk tier

Tier Nwhy.

Tier Review
0–1 tests + AI review or human skim
2 contract verifier + tests + human review
3 + security + adversarial review + human deep review
4 + human-approved plan + ADR + rollback plan

AI role

Basically all the code was written by Claude Code, guided by @RFOxbury

Reviews run

  • Contract verifier
  • /code-review
  • /security-review
  • Adversarial review (Tier 2+)
  • /simplify

Known gaps & deferred seams

Public safety

  • No secrets, credentials, or real/acquired source text in the diff or evidence.
  • Logs / traces / screenshots are public-safe.
  • No approval-gated change (schema · auth · runtime egress · deps · CI · prod config · public interface · scaffold) snuck in unapproved. (Runtime egress = the running product reaching search/model providers with project data; agent/dev-time lookups, MCP and installs are fine.)

* Add langfuse user ID tracking
* Group traces -> sessions -> users
* Reinstate dead code for tracking traces starting with "run:"
@RFOxbury RFOxbury linked an issue Sep 3, 2026 that may be closed by this pull request
@RFOxbury
RFOxbury requested a review from shabrf September 3, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track user sessions with Langfuse

1 participant