Skip to content

feat: Make Langfuse environment configurable - #39

Merged
danny-avila merged 1 commit into
LibreChat-AI:mainfrom
SergeShaw:patch-1
Dec 2, 2025
Merged

feat: Make Langfuse environment configurable#39
danny-avila merged 1 commit into
LibreChat-AI:mainfrom
SergeShaw:patch-1

Conversation

@SergeShaw

Copy link
Copy Markdown
Contributor

Make Langfuse environment configurable with default Langfuse env var - LANGFUSE_TRACING_ENVIRONMENT

@danny-avila danny-avila changed the title Make Langfuse environment configurable feat: Make Langfuse environment configurable Dec 2, 2025
@danny-avila
danny-avila merged commit 67b14c2 into LibreChat-AI:main Dec 2, 2025
danny-avila added a commit that referenced this pull request May 5, 2026
Audit verified: all 5 valid (real bypass shapes / API contract
violations / OOM risks).

P1 #37 — destructive path normalization. Patterns like \`rm -rf
\$HOME/\`, \`rm -rf ~/\`, \`rm -rf "\$HOME/"\` slipped past the bare
+ quoted destructive guards because the trailing slash broke the
end-anchor / quote-pair shapes. Extracted a shared
\`DESTRUCTIVE_TARGET\` (\`(?:\\/|~|\\\$\\{?HOME\\}?|\\.)\\/?\`) used
by both pattern lists so spelling equivalences are kept consistent.
9 tests pinned (all the spelling variants + a benign no-regression).

P2 #38 — \`resolveWorkspacePathSafe\` used host \`fs/promises.realpath\`
instead of the configured \`WorkspaceFS.realpath\`. On a custom or
remote engine the host realpath would fail and silently fall back
to lexical containment, leaving the symlink-escape clamp
ineffective. \`realpathOrSelf\` and \`realpathOfPathOrAncestor\`
now take the realpath impl as a parameter; \`resolveWorkspacePathSafe\`
threads \`getWorkspaceFS(config).realpath\` through both.

P2 #39 — direct-path \`additionalContexts\` were silently swallowed.
Hosts that returned \`additionalContext\` from PreToolUse /
PostToolUse / PostToolUseFailure for direct tools (which is every
local-engine tool) had their context discarded — broken hook API
contract. Added \`RunToolBatchContext.additionalContextsSink\`;
\`runDirectToolWithLifecycleHooks\` pushes hook contexts into it;
\`run()\` materializes the accumulated strings as a single
\`HumanMessage\` appended to outputs, matching the event-driven
path's \`injected[]\` shape. PostToolUseFailure was also changed
from fire-and-forget to await so its contexts are captured (the
hook is still observational w.r.t. the tool result).

P2 #40 — syntax-check probe cache was keyed only on spawn backend.
Same shape as P1 #34 (rg cache). Now nested
\`WeakMap<spawn, Map<envHash, ProbeCache>>\`. Stable JSON over
sorted env entries.

P2 #41 — fallback grep read each candidate file fully via
\`readFile\` then \`split('\\n')\`. The wall-clock budget only
checked between files, so a single multi-GB log could OOM the
process even with the regex DoS guards in place. Added a per-file
\`FALLBACK_GREP_MAX_FILE_BYTES = 5 MiB\` cap (stat first, skip with
sentinel if oversize) plus a deadline re-check after each read.
Hosts needing larger files should install ripgrep.

830 tests passing across all suites (was 817), lint baseline unchanged.
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