Skip to content

feat(workflow-executor): configurable log level via LOG_LEVEL env (PRD-407)#1624

Open
nbouliol wants to merge 3 commits into
feat/prd-214-server-step-mapperfrom
feat/prd-407-executor-log-level
Open

feat(workflow-executor): configurable log level via LOG_LEVEL env (PRD-407)#1624
nbouliol wants to merge 3 commits into
feat/prd-214-server-step-mapperfrom
feat/prd-407-executor-log-level

Conversation

@nbouliol
Copy link
Copy Markdown
Member

@nbouliol nbouliol commented Jun 3, 2026

Summary

  • Align Logger shape with @forestadmin/agent convention: function signature (level: LoggerLevel, message: string, context?: Record<string, unknown>) => void, capitalized LoggerLevel = 'Debug' | 'Info' | 'Warn' | 'Error'. Structured context object preserved (executor extension, agent only carries error?).
  • createConsoleLogger(minLevel) / createPrettyLogger(minLevel) factories filter at the source — calls below the threshold are dropped before any IO.
  • CLI reads LOG_LEVEL env var (validated via zod, throws ConfigurationError on invalid value). Default Info preserves current behavior. Library consumers pass loggerLevel on ExecutorOptions.
  • printHelp and example/.env.executors.example updated.

Test plan

  • Unit tests for level filtering on both adapters (console-logger.test.ts, pretty-logger.test.ts)
  • CLI tests cover TTY/--pretty/--json selection + level filtering through pickLogger
  • Full suite: 887/887 green
  • Lint clean, build clean
  • Manual: LOG_LEVEL=Warn node dist/cli.js --in-memory --pretty should drop Info lines

fixes PRD-407

🤖 Generated with Claude Code

Note

Add configurable log level to workflow-executor via LOG_LEVEL env var

  • Replaces the Logger interface (with .info/.warn/.error methods) with a single callable Logger(level, message, context?) function type in logger-port.ts, where level is 'Debug' | 'Info' | 'Warn' | 'Error'.
  • Replaces ConsoleLogger and PrettyLogger classes with createConsoleLogger(minLevel) and createPrettyLogger(minLevel) factory functions that filter out messages below the configured level.
  • Adds parseLoggerLevelEnv to cli-core.ts to parse and validate LOG_LEVEL from the environment, throwing ConfigurationError on invalid values; defaults to 'Info'.
  • Exposes loggerLevel as an optional field on ExecutorOptions in build-workflow-executor.ts so the log level can also be set programmatically.
  • Documents valid values (Debug | Info | Warn | Error) in .env.executors.example and wires LOG_LEVEL through in docker-compose.executors.yml.
  • Risk: all call sites across adapters, executors, and runner are migrated to the new function-style API — any custom Logger implementations outside this package must be updated to match the new signature.

Macroscope summarized 5a71569.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 3, 2026

PRD-407

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Jun 3, 2026

10 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 14): createWorkflowExecutor 6
qlty Structure Function with many returns (count = 5): execute 4

@qltysh
Copy link
Copy Markdown

qltysh Bot commented Jun 3, 2026

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (16)

RatingFile% DiffUncovered Line #s
New Coverage rating: A
packages/workflow-executor/src/adapters/console-logger.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/runner.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/executors/step-executor-factory.ts100.0%
New Coverage rating: A
...ow-executor/src/executors/load-related-record-step-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/build-workflow-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/adapters/pretty-logger.ts100.0%
New Coverage rating: A
...-executor/src/adapters/forestadmin-client-activity-log-port.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/remote-tool-fetcher.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/executors/base-step-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/http/executor-http-server.ts100.0%
New Coverage rating: A
.../workflow-executor/src/adapters/forest-server-workflow-port.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/adapters/with-retry.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/executors/mcp-step-executor.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/defaults.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/stores/database-store.ts100.0%
New Coverage rating: A
packages/workflow-executor/src/cli-core.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

nbouliol and others added 3 commits June 4, 2026 11:51
…D-407]

Align Logger with @forestadmin/agent shape (function signature, capitalized
LoggerLevel) and add a minimum-level filter on the source. Default Info
preserves current behavior; CLI reads LOG_LEVEL, library consumers pass
loggerLevel in ExecutorOptions.

fixes PRD-407

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…failure [PRD-407]

- cli-core: LOG_LEVEL env var → loggerLevel (valid values, default fallback,
  empty string fallback, invalid values throw ConfigurationError)
- mcp-step-executor: when persisting formattedResponse fails, step still
  returns success and an Error log carries the enriched-save failure cause

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nbouliol nbouliol force-pushed the feat/prd-407-executor-log-level branch from 233bda2 to 5a71569 Compare June 4, 2026 09: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