Skip to content

fix(startup): propagate database setup failures - #217

Open
NP-compete wants to merge 3 commits into
redhat-data-and-ai:mainfrom
NP-compete:fix/c09-database-startup-failure
Open

fix(startup): propagate database setup failures#217
NP-compete wants to merge 3 commits into
redhat-data-and-ai:mainfrom
NP-compete:fix/c09-database-startup-failure

Conversation

@NP-compete

Copy link
Copy Markdown
Member

Summary

  • _ensure_database() now re-raises exceptions instead of returning an error string, so run_startup() crashes before marking the pod ready
  • Prevents pods from passing health checks while database tables are missing

Closes #216

Test plan

  • test_db_failure_propagates -- verifies _ensure_database() re-raises ConnectionError
  • test_not_ready_when_database_fails -- verifies run_startup() does not set _startup_complete = True when database setup fails
  • All 15 startup tests pass

… them

_ensure_database() was catching all exceptions and returning an error
string, allowing the pod to report ready while database tables did not
exist. Re-raise so startup fails visibly when a configured database is
unreachable.

Signed-off-by: Soham Dutta <19648293+NP-compete@users.noreply.github.com>
@NP-compete
NP-compete requested a review from a team as a code owner August 15, 2026 19:55
@NP-compete NP-compete self-assigned this Aug 15, 2026
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 9384295e-7375-45eb-9fa7-63a72f3a0cea

📥 Commits

Reviewing files that changed from the base of the PR and between a162a8f and e4faca4.

📒 Files selected for processing (2)
  • deep_agent/aegra/startup.py
  • tests/unit/aegra/test_startup.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • redhat-data-and-ai/template-mcp (manual)
  • redhat-data-and-ai/template-ui (manual)

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


Walkthrough

_ensure_database() now re-raises database setup exceptions. run_startup() fails before setting the startup readiness flag. Tests cover startup propagation and PostgreSQL table setup failures.

Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity>

Suggested reviewers: anish701

Merge Risk: ⚪ Minimal · up to e4fac

The change keeps pods unready when database setup fails, preventing startup with missing tables; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: propagating database setup failures during startup.
Description check ✅ Passed The description accurately explains the startup failure behavior, readiness impact, linked issue, and test coverage.
Linked Issues check ✅ Passed The changes satisfy issue #216 by propagating database failures and preventing startup readiness from being marked complete.
Out of Scope Changes check ✅ Passed All code and test changes directly support database failure propagation and startup readiness behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
🚀 Post-Merge Actions
  • Update changelog

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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vishnusrichand vishnusrichand left a comment

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.

LGTM

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.

fix(startup): propagate database setup failures

3 participants