-
Notifications
You must be signed in to change notification settings - Fork 76
Fix/native tracing #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ import { ToolRegistry, ConfigurableAgentTool } from '../../agent_framework/Confi | |
| import { AgentService } from '../../core/AgentService.js'; | ||
| import { AIChatPanel } from '../../ui/AIChatPanel.js'; | ||
| import { createLogger } from '../../core/Logger.js'; | ||
| import { createTracingProvider, withTracingContext, isTracingEnabled, getTracingConfig } from '../../tracing/TracingConfig.js'; | ||
| import { createTracingProvider, withTracingContext, isTracingEnabled, getTracingConfig, setTracingConfig, refreshTracingProvider } from '../../tracing/TracingConfig.js'; | ||
| import { AgentDescriptorRegistry, type AgentDescriptor } from '../../core/AgentDescriptorRegistry.js'; | ||
| import '../../core/BaseOrchestratorAgent.js'; | ||
| import type { TracingProvider, TracingContext } from '../../tracing/TracingProvider.js'; | ||
|
|
@@ -433,9 +433,37 @@ export class EvaluationAgent { | |
| hasTracing: !!params.tracing, | ||
| tracingKeys: Object.keys(requestTracing), | ||
| sessionId: requestTracing.session_id, | ||
| traceId: requestTracing.trace_id | ||
| traceId: requestTracing.trace_id, | ||
| hasLangfuseCredentials: !!(requestTracing.langfuse_endpoint && requestTracing.langfuse_public_key && requestTracing.langfuse_secret_key) | ||
| }); | ||
|
|
||
| // Auto-configure Langfuse tracing from request if credentials provided and not already enabled | ||
| if (requestTracing.langfuse_endpoint && | ||
| requestTracing.langfuse_public_key && | ||
| requestTracing.langfuse_secret_key && | ||
| !isTracingEnabled()) { | ||
| logger.info('Auto-configuring DevTools Langfuse tracing from request', { | ||
| endpoint: requestTracing.langfuse_endpoint, | ||
| hasPublicKey: true, | ||
| hasSecretKey: true | ||
| }); | ||
|
|
||
| setTracingConfig({ | ||
| provider: 'langfuse', | ||
| endpoint: requestTracing.langfuse_endpoint, | ||
| publicKey: requestTracing.langfuse_public_key, | ||
| secretKey: requestTracing.langfuse_secret_key | ||
| }); | ||
|
|
||
| // Refresh the tracing provider to pick up new configuration | ||
| await refreshTracingProvider(); | ||
|
|
||
| // Update this instance's tracing provider | ||
| this.tracingProvider = createTracingProvider(); | ||
|
|
||
| logger.info('DevTools Langfuse tracing configured successfully from request'); | ||
| } | ||
|
Comment on lines
+440
to
+465
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if there are any validation or allowlist mechanisms for Langfuse endpoints
rg -n "langfuse" --type ts -C 3 | head -100Repository: BrowserOperator/browser-operator-core Length of output: 9141 🏁 Script executed: #!/bin/bash
# Check where requestTracing comes from and any validation before this point
rg -n "requestTracing" --type ts -B 5 -A 2 | head -150Repository: BrowserOperator/browser-operator-core Length of output: 7338 🏁 Script executed: #!/bin/bash
# Check the context of the EvaluationAgent file and function signature
rg -n "setTracingConfig|refreshTracingProvider|createTracingProvider" --type ts -B 2 -A 5Repository: BrowserOperator/browser-operator-core Length of output: 33776 🏁 Script executed: #!/bin/bash
# Check the evaluate method signature and params type definition
rg -n "evaluate.*params" --type ts -B 5 -A 10 front_end/panels/ai_chat/evaluation/remote/EvaluationAgent.ts | head -80Repository: BrowserOperator/browser-operator-core Length of output: 63 🏁 Script executed: #!/bin/bash
# Look for any interface/type definition of params containing tracing
rg -n "interface.*Params|type.*Params" --type ts -A 15 front_end/panels/ai_chat/evaluation/remote/ | head -100Repository: BrowserOperator/browser-operator-core Length of output: 3111 🏁 Script executed: #!/bin/bash
# Search for any validation or security-related comments in the file
rg -n "security|validate|allowlist|trusted|endpoint" --type ts front_end/panels/ai_chat/evaluation/remote/EvaluationAgent.tsRepository: BrowserOperator/browser-operator-core Length of output: 1093 🏁 Script executed: #!/bin/bash
# Get the complete EvaluationParams interface including the tracing field
sed -n '87,130p' front_end/panels/ai_chat/evaluation/remote/EvaluationProtocol.tsRepository: BrowserOperator/browser-operator-core Length of output: 1281 🏁 Script executed: #!/bin/bash
# Look for the tracing field definition in EvaluationParams
rg -n "tracing" --type ts front_end/panels/ai_chat/evaluation/remote/EvaluationProtocol.ts -A 5Repository: BrowserOperator/browser-operator-core Length of output: 460 🏁 Script executed: #!/bin/bash
# Check if there's any server-side validation of the request before it reaches EvaluationAgent
rg -n "BrowserAgentServer\|executeRequest" --type ts -A 10 | head -100Repository: BrowserOperator/browser-operator-core Length of output: 63 🏁 Script executed: #!/bin/bash
# Check for any documentation or comments about the security model
rg -n "trusted|evaluation.*server|eval.*framework" --type ts front_end/panels/ai_chat/evaluation/remote/ -B 2 -A 2 | head -50Repository: BrowserOperator/browser-operator-core Length of output: 2570 🏁 Script executed: #!/bin/bash
# Check if there are any configuration files or server-side setup for this remote evaluation feature
find front_end/panels/ai_chat/evaluation/remote -type f -name "*.ts" -o -name "*.md" | xargs ls -laRepository: BrowserOperator/browser-operator-core Length of output: 307 Clarify security model and consider validating Langfuse endpoint against an allowlist. This code auto-configures Langfuse tracing using credentials from the incoming evaluation request, which is intentionally designed for remote evaluation frameworks. However, without endpoint validation, an untrusted or compromised evaluation server could redirect tracing data to a malicious Langfuse instance or cause connections to arbitrary endpoints. Add documentation clarifying that this feature assumes a trusted evaluation server, or implement endpoint validation (e.g., allowlist of permitted Langfuse hosts). 🤖 Prompt for AI Agents |
||
|
|
||
| // Create a trace for this evaluation - use tracing from request if available | ||
| const traceId = requestTracing.trace_id || `eval-${params.evaluationId}-${Date.now()}`; | ||
| const sessionId = requestTracing.session_id || `eval-session-${Date.now()}`; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.