Skip to content

Add Langfuse tracing for Codex and Claude Code runs#16

Merged
armand0e merged 2 commits into
mainfrom
langfuse-tracing-patched
Jun 23, 2026
Merged

Add Langfuse tracing for Codex and Claude Code runs#16
armand0e merged 2 commits into
mainfrom
langfuse-tracing-patched

Conversation

@armand0e

Copy link
Copy Markdown
Collaborator

Supersedes #15 with the same Langfuse tracing feature set, rebased on the merged Codex host-auth changes from #14.

Changes in this patched version:

  • Resolves the overlap with agent.codex host-auth/config additions.
  • Keeps Langfuse tracing opt-in at runtime.
  • Splits Docker runtime images so normal runs keep using teich-runtime:v3, while Codex/Claude runs with agent.langfuse.enabled use teich-runtime:v3-langfuse built with TEICH_INSTALL_LANGFUSE=1.
  • Avoids making default Docker rebuilds depend on Langfuse plugin, pip, or git clone availability.

Validation:

  • env UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev python -m compileall -q src/teich
  • env UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev pytest -s -q tests/test_codex_langfuse.py tests/test_langfuse_agents.py tests/test_config.py tests/test_runner.py tests/test_converter.py tests/test_codex_auth_broker.py tests/test_cli.py
  • env UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev ruff check

Quantumlyy and others added 2 commits June 23, 2026 07:53
Opt-in via a shared `agent.langfuse` block ({enabled, public_key,
secret_key, base_url}; all three credentials required when enabled).
Tracing is side-channel only: each agent uses its own native integration,
reads transcripts, fails open, and doesn't change agent behavior or
Teich's output files.

- Codex: the codex-observability plugin is baked into the runtime image at
  a staging CODEX_HOME and seeded into each session's CODEX_HOME offline;
  the generated config enables plugin_hooks, and `codex exec` runs with
  --dangerously-bypass-hook-trust (it silently skips plugin hooks otherwise).
- Claude Code: the Langfuse Stop/SessionEnd hook is registered per session.
  The langfuse SDK is installed into /opt/venv and the hook calls that
  interpreter by absolute path, since Claude strips /opt/venv from a hook's
  PATH. The plugin is pinned to a known-good commit.

A localhost/127.0.0.1 base_url is rewritten to host.docker.internal for the
in-container env value and the --add-host gate.
@armand0e
armand0e merged commit 0e3f699 into main Jun 23, 2026
3 checks passed
@armand0e
armand0e deleted the langfuse-tracing-patched branch June 23, 2026 20:04
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.

2 participants