Skip to content

feat(install): the self-check runner, its report, and the chat, model kinds and embeddings probes (#20447) - #20474

Closed
mrveiss wants to merge 4 commits into
mainfrom
issue-20447-self-check
Closed

mrveiss wants to merge 4 commits into
mainfrom
issue-20447-self-check

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

Install and update report success on presence, and on 2026-10-26 a local install passed every check while embeddings, uploads and retrieval were broken (#19739). #19740 asks for a self-check that exercises each function. This is its runner and first three probes; the maintainer decided it logs in with a dedicated account.

What Changed

  • autobot-infrastructure/shared/scripts/post_install_self_check.py: logs in the way a browser does, runs each probe, prints PASS or FAIL naming the probe, the expected result and what came back, writes a JSON report with timestamp and commit, and exits non-zero on any failure. Running no probes is a failure. Standard library only.

  • Probes: chat creates its own session, asks POST /api/chat a fixed prompt, treats the backend's 200 fallback error reply as a failure, and deletes the session either way (a session left behind fails the probe). model kinds uses the one check_model_kinds.sh, judged by verdict lines and exit code, so it holds before and after fix(install): the model-kind check fails on what it could not establish (#19886, #19854, #19888) #20419, with a timeout. embeddings reads the public /api/system/health probes entry embedding_model: ok, and a real embedding measured. So feat(install): install and the builtin update run the self-check and fail on a failing probe #20450's account needs no admin role.

  • SELF_CHECK_CA_FILE for an install with its own certificate. A probe's own crash is reported as that probe's failure.

  • The embeddings probe passes only on a measurement taken during the check. /api/system/health now gives embedding_measured_age_s and embedding_refresh_within_s, and the check waits as long as the backend says its cache can take (360 s by default), so on a long-running backend it can take that long. A cached failure from before the check is measured again rather than failing the run.

  • The CA file comes from the env given to main. Outcomes print before the report is written, and an unwritable report fails the run.

Verification

post_install_self_check_20447_test.py passes locally; only this was run. It uses a real local HTTP server replying in the routes' real shapes, pinned to source by a test, and the real kind script with a fake model CLI. Each probe has planted faults, the password reaches neither the output nor the report, and no-login, nothing-to-judge and no-probes all fail. Not run against a real backend, so the routes and reply shapes rest on my reading of the code, not on a live call.

Worth reviewing:

Model Used

Claude Opus 5.5

Refs #20447

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Adds a standard-library script that logs in and checks chat, embedding health, and model kinds. It records probe results, can write a JSON report, and returns a failing status when checks or report writing fail. The embedding health response now reports measurement age when a measurement exists.

Changes: Post-install self-check

Layer / File(s) Summary
Probe configuration and authentication
autobot-infrastructure/shared/scripts/post_install_self_check.py, autobot-backend/api/embedding_model_health.py
Adds probe settings and result types, HTTP and JSON helpers, login handling, and an embedding measurement age field.
Chat, embedding, and model-kind probes
autobot-infrastructure/shared/scripts/post_install_self_check.py, autobot-backend/api/embedding_model_health_test.py, repo_tests/post_install_self_check_20447_test.py
Adds chat session validation and cleanup, embedding health polling, and model-kind checks. Tests cover probe results, failures, and the measurement age assertion.
Probe execution and reporting
autobot-infrastructure/shared/scripts/post_install_self_check.py, repo_tests/post_install_self_check_20447_test.py
Adds probe result collection, JSON report writing, entry-point exit handling, and tests for login and report failures.
Merge Risk: Moderate · previous review e6717

The self-check currently reports chat failure against a healthy backend and leaves its session behind. Embedding checks can also falsely fail after recovery or with longer cache settings. Correct these behaviors before relying on the installation check.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 clearly identifies the main change: the install self-check runner and its chat, model-kinds, and embeddings probes.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 22 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fb378ec and e6717f4.

Files selected for processing: 4

  • autobot-backend/api/embedding_model_health.py
  • autobot-backend/api/embedding_model_health_test.py
  • autobot-infrastructure/shared/scripts/post_install_self_check.py
  • repo_tests/post_install_self_check_20447_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@coderabbitai coderabbitai Bot 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.

Nitpick comments: 2
repo_tests/post_install_self_check_20447_test.py: 2

43-44: Trivial · Functional Correctness · Quick win

Assert the login request body in the self-check fixture.

The stack fixture returns a token for /api/auth/login whatever the request contains, and do_POST discards the body. The success test checks only that Bearer tok was sent. A runner that sends a wrong or misnamed password still passes. Record the login body in the fixture and assert that username and password carry the dedicated-account values.


64-69: Trivial · Functional Correctness · Quick win

Record the submitted chat prompt in the self-check fixture.

do_POST reads the request body and discards it. _answer then picks the reply by path alone, so the fixture returns "Hello." whatever the runner sends. The runner posts CHAT_PROMPT as content at autobot-infrastructure/shared/scripts/post_install_self_check.py:113, and the probe passes on any non-empty reply that does not start with CHAT_ERROR_REPLY (line 115). Neither the verdict nor any test assertion depends on the prompt. A change that empties or corrupts CHAT_PROMPT would therefore still pass. Store the decoded request body in the handler and assert that content equals check.CHAT_PROMPT.

🧪 Suggested test change
-            self.rfile.read(int(self.headers.get("Content-Length", 0)))
+            body = self.rfile.read(int(self.headers.get("Content-Length", 0)))
+            calls.append(("BODY", self.path, body.decode("utf-8")))
             self._answer()

Based on the diff above, add an assertion in the chat probe test that the recorded /api/chat body contains "content": check.CHAT_PROMPT.


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between f88cd37 and fb378ec.

Files selected for processing: 3
  • autobot-infrastructure/shared/scripts/post_install_self_check.py
  • repo_tests/frontend_url_served_by_19326_test.py
  • repo_tests/post_install_self_check_20447_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20474 (head fb378ec): approve. Delta since 5dae83b, read only: embeddings reads probes from the public health route, chat creates and deletes its own session, and the reply shapes are pinned to source by substring. Check in CI: the egress guard on urlopen. Not run against a live backend.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Auto-sync: merging main into issue-20447-self-check conflicts

The sync aborted the merge and pushed nothing. Conflicts are information, so it never resolves one itself. Below, for each conflicted file, are the commits that touched it on each side since the merge base f88cd3756a. Merge main in yourself and push; the label clears on the first run that finds this branch 0 behind.

repo_tests/frontend_url_served_by_19326_test.py

side commit subject issue refs
main 8e17b7290 fix(train): reach floors return to mid-window on the merged tree (#20444) #20444
this branch 5dae83b03 chore(tests): repin the reach floors main moved (#20447) #20447

@mrveiss

mrveiss commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20474 (head 9742727): approve. Delta since fb378ec: a failed session delete adds to the chat failure rather than replacing it, with a test.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20474 (head 262a902): approve.

Covers the delta since e6717f4, read only; tests not run. The wait follows embedding_refresh_within_s (TTL plus timeout) from the health data, with the constant as a floor, so a raised TTL can't make the check impossible. A cached failure keeps polling, and a failure measured during the check fails it. EMBEDDING_WAIT_S stays as the floor value and has no caller yet in the install path.

@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20474 (head 109e99f): approve. Covers commit 109e99f, read in full; tests not run. An unreadable CA file is now inside the try and becomes a named failure, and any exception in the chat step still deletes the session.

@mrveiss mrveiss left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Delta review 109e99f..a59a55f: APPROVE.

The range holds the fix 51d86125b6 plus main auto-sync merges. The GitHub head is a59a55fb2c.

Severity File:line Issue Fix
Low repo_tests/post_install_self_check_20447_test.py Nothing pins ABSENT-stays-exit-0 at the self-check level. The script is untouched by this delta, so the behaviour is intact, but an ABSENT-only run is not covered. Optional: add a probe test where the model-kinds script prints ABSENT x plus OK y and exits 0.
  • 201 is what the route returns. create_session in chat_sessions.py returns create_chat_response(..., status_code=201), which builds a JSONResponse with that status. The new test slices the function body and asserts status_code=201, appears in it, so it follows the route.
  • Control test. A create answered 200 now fails with "HTTP 201 from session create".
  • ABSENT stays exit 0 (#2950). check_model_kinds.sh has no diff in this range and still exits 0 for ABSENT. FAILING_KINDS in the probe excludes ABSENT, so the probe only fails on a non-zero exit, a failing kind line, or no OK verdict at all.

Not checked: no CI result, and I ran no tests.

@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20474 (head a59a55f): APPROVE

A delta review of 109e99f..a59a55f. create_session returns 201 through create_chat_response, and the probe now accepts it (a 200 fails, as pinned by a test). ABSENT still exits 0 per #2950. Low, optional: no self-check test pins ABSENT staying exit 0.

@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Landed in merge train #20748 as b5dd159 (merged 2026-11-03 23:36 Riga). Closing; the train carried this PR's frozen head.

@mrveiss mrveiss closed this Nov 3, 2026
timothybrush pushed a commit to timothybrush/AutoBot-AI that referenced this pull request Nov 3, 2026
@mrveiss mrveiss reopened this Nov 18, 2026
@mrveiss

mrveiss commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Branch audit (zero-change deletion). This PR shows 0 changed files against main (head bc45178125): every change it carried is already in main. Closing and deleting the branch through this PR; it can be restored with the Restore branch button below.

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

Labels

phase:M1.4 Wizard and SLM: choose a mode, apply it, default models work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant