Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions content/integrations/other/claude-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ STATE_FILE = STATE_DIR / "langfuse_state.json"
LOCK_FILE = STATE_DIR / "langfuse_state.lock"

DEBUG = os.environ.get("CC_LANGFUSE_DEBUG", "").lower() == "true"
BACKGROUND = os.environ.get("CC_LANGFUSE_BACKGROUND", "true").lower() == "true"
MAX_CHARS = int(os.environ.get("CC_LANGFUSE_MAX_CHARS", "20000"))

# ----------------- Logging -----------------
Expand Down Expand Up @@ -554,6 +555,17 @@ def main() -> int:
debug(f"Transcript path does not exist: {transcript_path}")
return 0

# Fork to run in background - parent exits immediately, child does the work
if BACKGROUND and hasattr(os, "fork"):
pid = os.fork()
if pid > 0:
# Parent: exit immediately so Claude Code isn't blocked
debug(f"Forked child {pid}, parent exiting")
return 0
# Child: detach from parent session
os.setsid()
debug("Child process running in background")
Comment thread
markjm marked this conversation as resolved.

try:
langfuse = Langfuse(public_key=public_key, secret_key=secret_key, host=host)
except Exception:
Expand Down Expand Up @@ -668,6 +680,7 @@ Tracing is opt-in per project. The hook runs globally but immediately exits if `
| `LANGFUSE_SECRET_KEY` | Your Langfuse secret key | Yes |
| `LANGFUSE_BASE_URL` | Langfuse base URL (`https://cloud.langfuse.com` for EU, `https://us.cloud.langfuse.com` for US) | No (defaults to EU) |
| `CC_LANGFUSE_DEBUG` | Set to `"true"` for verbose debug logging | No |
| `CC_LANGFUSE_BACKGROUND` | Set to `"false"` to run synchronously (default: `"true"` for background execution) | No |

### Start Using Claude Code

Expand Down