Skip to content

Clarify log message when starter project crestion is skipped due to lock#11247

Open
AnilMundri wants to merge 2 commits intolangflow-ai:mainfrom
AnilMundri:fix-starter-projects-db
Open

Clarify log message when starter project crestion is skipped due to lock#11247
AnilMundri wants to merge 2 commits intolangflow-ai:mainfrom
AnilMundri:fix-starter-projects-db

Conversation

@AnilMundri
Copy link
Copy Markdown

@AnilMundri AnilMundri commented Jan 8, 2026

Clarifies the debug log message emitted when starter project creation is skipped because another worker already holds the file lock .

Summary by CodeRabbit

  • Chores
    • Improved logging messages for starter project initialization to provide clearer debugging information.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions Bot added the community Pull Request from an external contributor label Jan 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 8, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Modified the log message in the lifespan function's starter projects lock acquisition timeout path. Changed from a debug-level call to a standard debug log with an updated, more descriptive message indicating the lock was held by another worker.

Changes

Cohort / File(s) Summary
Logging message update
src/backend/base/langflow/main.py
Updated lock timeout log message in lifespan function from debug-level call to standard debug log with improved clarity: "Starter project creation skipped (lock held by another worker)"

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 3
❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning PR modifies lifespan function's error logging but includes no tests for the timeout scenario or log message validation. Add async tests covering TimeoutError in lifespan function, verify correct log message emission, and fix logger.debug() to logger.adebug() for async consistency.
Test File Naming And Structure ⚠️ Warning PR modifies critical startup logic for starter project lock timeout handling but includes no test coverage for the timeout scenario or modified logging behavior. Add test file (e.g., test_lifespan_starter_projects.py) with pytest tests covering both successful lock acquisition and timeout scenarios with descriptive test names.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: clarifying a log message when starter project creation is skipped due to lock contention, which matches the PR's objective.
Test Coverage For New Implementations ✅ Passed This PR changes only a log message in an exception handler without altering functional behavior, so test updates are not required.
Excessive Mock Usage Warning ✅ Passed The PR modifies only src/backend/base/langflow/main.py, a core application file with no test files or mock objects introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @src/backend/base/langflow/main.py:
- Around line 222-224: Replace the call to await logger.debug(...) with the
async logger method await logger.adebug(...) and remove the trailing whitespace
at the end of that line so it ends exactly with the call; target the logger
invocation in the starter-project lock branch (the await logger.debug(...)
statement) and ensure it matches other async logging calls (adebug).
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 943e22f and 98b9f85.

📒 Files selected for processing (1)
  • src/backend/base/langflow/main.py
🧰 Additional context used
📓 Path-based instructions (1)
src/backend/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

src/backend/**/*.py: Use FastAPI async patterns with await for async operations in component execution methods
Use asyncio.create_task() for background tasks and implement proper cleanup with try/except for asyncio.CancelledError
Use queue.put_nowait() for non-blocking queue operations and asyncio.wait_for() with timeouts for controlled get operations

Files:

  • src/backend/base/langflow/main.py
🧠 Learnings (2)
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: Some Langflow starter project files and components still use `from loguru import logger` instead of the centralized structlog logger from `langflow.logging.logger`. These should be updated to ensure consistent structured logging across the entire codebase.

Applied to files:

  • src/backend/base/langflow/main.py
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase has an excellent structlog implementation that follows best practices, with proper global configuration, environment-based output formatting, and widespread adoption across components. The main cleanup needed is updating starter project templates and documentation examples that still contain legacy `from loguru import logger` imports.

Applied to files:

  • src/backend/base/langflow/main.py
🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/main.py

[error] 224-224: Command 'uv run --only-dev ruff check --output-format=github .' failed: W291 Trailing whitespace detected in src/backend/base/langflow/main.py at line 224.

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/main.py

[failure] 224-224: Ruff (W291)
src/backend/base/langflow/main.py:224:2: W291 Trailing whitespace

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Lint Backend / Run Mypy (3.11)
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Lint Backend / Run Mypy (3.10)
  • GitHub Check: Lint Backend / Run Mypy (3.12)
  • GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Test Starter Templates
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Update Starter Projects
  • GitHub Check: Update Component Index

Comment thread src/backend/base/langflow/main.py Outdated
Comment on lines +222 to +224
await logger.debug(
"Starter project creation skipped (lock held by another worker)"
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix trailing whitespace and use async logger method.

Two issues need to be addressed:

  1. Pipeline Failure: Trailing whitespace on line 224 is causing the Ruff style check to fail.
  2. Incorrect Logger Method: Should use await logger.adebug(...) instead of await logger.debug(...) to maintain consistency with all other logging in this file (lines 157, 168, 170, 173, 175, 178, etc.). All logging in async contexts uses the async logger methods (adebug, aerror, awarning, etc.).
🐛 Proposed fix
         except TimeoutError:
             # Another process has the lock
-            await logger.debug(
-"Starter project creation skipped (lock held by another worker)"
-)        
+            await logger.adebug(
+                "Starter project creation skipped (lock held by another worker)"
+            )

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: Ruff Style Check

[error] 224-224: Command 'uv run --only-dev ruff check --output-format=github .' failed: W291 Trailing whitespace detected in src/backend/base/langflow/main.py at line 224.

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 224-224: Ruff (W291)
src/backend/base/langflow/main.py:224:2: W291 Trailing whitespace

🤖 Prompt for AI Agents
In @src/backend/base/langflow/main.py around lines 222 - 224, Replace the call
to await logger.debug(...) with the async logger method await logger.adebug(...)
and remove the trailing whitespace at the end of that line so it ends exactly
with the call; target the logger invocation in the starter-project lock branch
(the await logger.debug(...) statement) and ensure it matches other async
logging calls (adebug).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Request from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant