Skip to content

[codex] Fix Langfuse hook cwd handling#7

Merged
jannikmaierhoefer merged 1 commit into
mainfrom
codex/fix-langfuse-hook-cwd
Jun 3, 2026
Merged

[codex] Fix Langfuse hook cwd handling#7
jannikmaierhoefer merged 1 commit into
mainfrom
codex/fix-langfuse-hook-cwd

Conversation

@jannikmaierhoefer
Copy link
Copy Markdown
Member

Summary

Fixes unreliable automatic Codex Stop hook uploads by making the bundled hook command independent of the session working directory. Codex command hooks run with the session cwd, so the previous node ./plugins/tracing/dist/index.mjs command could resolve under arbitrary directories such as /private/tmp instead of the plugin install location.

What changed

  • Resolve the hook entrypoint through ${CODEX_HOME:-$HOME/.codex}/plugins/cache/codex-observability-plugin/tracing/0.1.0/dist/index.mjs.
  • Add LANGFUSE_CODEX_FAIL_ON_ERROR / fail_on_error so debugging runs can make upload and flush errors fail the hook instead of failing open.
  • Add debug logging when an in-progress turn is uploaded but not sidecar-marked yet.
  • Add regression tests for running the real hook command from an arbitrary cwd and for keeping the cache path aligned with the plugin version.
  • Document debug, fail-on-error, sidecar, Langfuse CLI, and sandbox/network troubleshooting.
  • Ignore local .claude worktree artifacts in Prettier checks.

Validation

  • pnpm test passes: 32 tests.
  • pnpm run lint:tsc passes.
  • pnpm run format:check passes.

@jannikmaierhoefer jannikmaierhoefer marked this pull request as ready for review June 3, 2026 16:52
@jannikmaierhoefer jannikmaierhoefer merged commit f7b6f9f into main Jun 3, 2026
2 checks passed
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.

1 participant