Skip to content

Add structured logging infrastructure#59

Merged
Furisto merged 1 commit into
mainfrom
fo/logging
Nov 15, 2025
Merged

Add structured logging infrastructure#59
Furisto merged 1 commit into
mainfrom
fo/logging

Conversation

@Furisto
Copy link
Copy Markdown
Owner

@Furisto Furisto commented Nov 15, 2025

Implement comprehensive structured logging using slog across agent runtime, task reconciliation, and model providers with:

• New logging layer: agent/logger.go with standardized log key constants
• Context propagation: agent/context.go for task/agent/model tracking
• Model providers: OpenAI, Anthropic, Gemini with operation telemetry
• Task reconciliation: Detailed logging of reconciliation phases and tool execution
• Filesystem tools: Logging for file operations and search results
• Code interpreter: Execution timing and output tracking
• Runtime lifecycle: Component initialization and shutdown logging

Key features:

  • Centralized log key constants for consistency (KeyTaskID, KeyModel, etc.)
  • Operation timing with LogOperationStart/End helpers
  • Token usage logging with cache hit ratio calculations
  • Retryable error logging with retry-after timing

This enables better observability into task execution, model invocations, and tool operations for debugging and performance monitoring.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 15, 2025

Walkthrough

This PR adds structured logging with Go's slog across the backend: a new agent logger utility, integration into the Runtime and TaskReconciler, and extensive logging in model providers and filesystem/interpreter tools. It introduces timing and token usage metrics and replaces many ad-hoc logs with structured helpers. A few public APIs/structs were changed: ModelProviderFactory.CreateClient signature, RuntimeOptions (LoggerConfig) and WithLoggerConfig, Runtime (logger field), and TaskReconciler.publishError signature. Functional behavior is otherwise unchanged.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 96f836f and 6377e1f.

📒 Files selected for processing (13)
  • backend/agent/client.go (2 hunks)
  • backend/agent/logger.go (1 hunks)
  • backend/agent/runtime.go (6 hunks)
  • backend/agent/task_reconciler.go (20 hunks)
  • backend/model/anthropic_provider.go (7 hunks)
  • backend/model/gemini.go (7 hunks)
  • backend/model/openai_completion.go (6 hunks)
  • backend/tool/codeact/interpreter.go (4 hunks)
  • backend/tool/filesystem/create.go (3 hunks)
  • backend/tool/filesystem/find.go (5 hunks)
  • backend/tool/filesystem/grep.go (3 hunks)
  • backend/tool/filesystem/list.go (4 hunks)
  • backend/tool/filesystem/read.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • backend/tool/filesystem/create.go
  • backend/tool/filesystem/grep.go
  • backend/model/gemini.go
  • backend/tool/filesystem/find.go
  • backend/tool/filesystem/read.go

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Implement comprehensive structured logging using slog across agent runtime,
task reconciliation, and model providers with:

• New logging layer: agent/logger.go with standardized log key constants
• Context propagation: agent/context.go for task/agent/model tracking
• Model providers: OpenAI, Anthropic, Gemini with operation telemetry
• Task reconciliation: Detailed logging of reconciliation phases and tool execution
• Filesystem tools: Logging for file operations and search results
• Code interpreter: Execution timing and output tracking
• Runtime lifecycle: Component initialization and shutdown logging

Key features:
- Centralized log key constants for consistency (KeyTaskID, KeyModel, etc.)
- Operation timing with LogOperationStart/End helpers
- Token usage logging with cache hit ratio calculations
- Retryable error logging with retry-after timing

This enables better observability into task execution, model invocations,
and tool operations for debugging and performance monitoring.

Co-authored-by: construct-agent <noreply@construct.sh>
@Furisto Furisto merged commit 8d09f27 into main Nov 15, 2025
1 of 2 checks passed
@Furisto Furisto deleted the fo/logging branch December 1, 2025 10:51
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