← Back to Pull requests

fix(probes,managers): argv truncation, silent psql failures, wrong pg cluster #40

Closed
unknown closed this pull request without merging on Sep 24, 2026 03:54 UTC
View on GitHub
unknown unknown commented on Sep 14, 2026 08:19 UTC
Author

Summary

  • probes._ps_snapshot adds -ww to its ps call, so a long argv keeps the -c <config> and --logfile that _cli_options parses out of it.
  • probes.long_queries answers (rows, error) through _psql_json, the way every sibling db probe already does, so an unreachable postgres renders as an error instead of an empty table. Updates panes/detail.py, mcp_server.py (raises ValueError, so the agent side sees the failure too) and the docs demo fixture's stub.
  • Manager.pg_target reads db_host/db_user/db_password off the odoo config alongside db_port — the probes now connect the way the instance itself does. Gated on db_host: unset means the unix socket, commonly peer auth, where forcing PGUSER would connect as the wrong role, so that case takes the old path byte-identically.
  • Manager.databases asks over that same target instead of rebuilding a bare port string for its own query, so the database list and the db tabs beside it can no longer read different clusters. DockerManager.databases already did this; base does now.
  • Four tests, one per behaviour: -ww is requested, an unreachable postgres is not an idle database, db_host decides both directions of the gate, and the database list arrives over the db-tab target.
  • Context

    Found while testing the tool against two independent Odoo projects on one box — different launchers (odoo.sh shell script vs emoi start), different configs, different addons layouts.

    ps truncation

    The Config tab reported (no config file found) and Logs (no logfile configured) for an instance whose config and logfile were both sitting on disk. For an instance started from a shell, argv is the config — _cli_options parses db_name, db_port, data_dir and logfile out of that one string — so a cut string is lost settings:

    $ ps -eo args -p <master> --no-headers | wc -c                      # 71317
    $ env COLUMNS=190 ps -eo args -p <master> --no-headers | wc -c      # 29512  <- cut
    $ env COLUMNS=190 ps -ww -eo args -p <master> --no-headers | wc -c  # 71321  <- whole
    

    Precondition, stated plainly: bash does not export COLUMNS, so this does not fire in every shell — it fires wherever something does export it (tmux and screen, dotfiles, CI runners). It surfaced here because the pty harness driving the TUI exported it. The defect is in the ps call, not the harness: the failure mode is a confident wrong answer, so an operator reading "no config file" goes looking in the wrong place.

    long_queries swallowing a failure

    With postgres unreachable, three tabs on the same connection disagreed:

    | tab | shown |
    | --- | --- |
    | Queries | (empty) |
    | Users | Error [<db>]: No such file or directory |
    | Jobs | psql: error: connection to server on socket ... failed |

    The tab that looked healthiest is the one that failed. Queries is the first tab a database row opens, and (empty) there reads as "this database is idle" — the opposite of "I could not reach postgres". No new pattern is introduced by the fix; _psql_json already draws exactly this line for the job probes, and this brings the last direct-psql probe in line with them.

    Wrong postgres cluster

    The test box runs two separate postgres servers, which is what made this visible:

    docker postgres17  ->  127.0.0.1:5432   the databases odoo actually uses
    native cluster     ->  socket :5433     unrelated; pg_wrapper's default
    

    The odoo config names db_host, db_user and db_password. The probes kept only db_port, so PgTarget.env_prefix came out empty and the call was a bare psql — and on Debian psql is pg_wrapper, which with no PG set resolves a socket connection to the box's default* cluster. Two failure shapes, one per instance:

    | instance | db_port | old behaviour |
    | --- | --- | --- |
    | A | unset | connects silently to the wrong cluster — databases_by_role returns [], psql -d <db> says the database does not exist, Queries prints (empty) |
    | B | set | fails outright — psql: connection to server on socket ".s.PGSQL.5432" failed, rc=2, every db tab dead |

    Neither reaches the postgres its Odoo is connected to. After the fix both do: 7 and 8 databases listed respectively, and res_users readable on each.

    Forge-ID: 68812

    Diff: 545 lines (+408 / -137) across 6 files Reviewer: Kimkhoi3010 Review duration: 14134m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 545 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.377
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #40"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48% (MEDIUM) · Higher = larger blast radius
    48%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.0% · Safe to merge
    19.0%