GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mcpx(logstore): Correlations counts record cross-products, not sessions — the dashboard renders '7 sessions' for a pair that co-occurs in 2, and any Query filter fails with an ambiguous-column error · Issue #1695 · developing-today/code

mcpx(logstore): Correlations counts record cross-products, not sessions — the dashboard renders '7 sessions' for a pair that co-occurs in 2, and any Query filter fails with an ambiguous-column error #1695

New issue
Copy link
New issue
Copy link
Closed
#3063
Closed
mcpx(logstore): Correlations counts record cross-products, not sessions — the dashboard renders '7 sessions' for a pair that co-occurs in 2, and any Query filter fails with an ambiguous-column error#1695
#3063
Copy link
Assignees
dezren39
Labels
app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Description

@dezren39
dezren39
opened on Oct 28, 2026
Issue body actions

Summary

logstore.Correlations (pkgs/mcpx/internal/logstore/stats.go:539-570) counts record pairs, not sessions — but the dashboard renders its count as a session count. One busy session inflates a pair's "sessions" by the product of the two tools' call counts. The same method also breaks outright when called with an ordinary Query filter, because it splices the shared unqualified where() conditions into a self-join.

Evidence (verified this run)

Line trace, stats.go:

  • :548-556 — the query self-joins records a JOIN records b ON a.session = b.session with a.tool < b.tool and selects count(*) AS cnt. For a session where tool A was called m times and tool B n times, the join produces m × n rows for that session, and count(*) sums those products across sessions.
  • The consumer, internal/dashboard/dashboard.html:260-267, titles the table "Correlated Tool Pairs (Co-Occurring in Sessions)" with a "Co-Occurrences" column, and :415 renders each row as `<strong>${cr.count}</strong> sessions` — the count is presented to the reader as a number of sessions.
  • The only production caller is internal/daemon/routes_dashboard.go:52 (st.Correlations(logstore.Query{}, 20)), feeding /v1/metrics/tools.
  • :549-551 — when q.where() is non-empty, its conditions are appended verbatim (AND + the trimmed where). Those conditions name unqualified columns (server = ?, level IN (...), ts_unix_ms >= ?, …), which are ambiguous between a and b in a self-join. Sibling stats methods (Calls, Servers, Sessions, Slowest, Timeline) all accept filtered queries against a single table, so Correlations silently having a different, broken contract is a trap for the next caller (e.g. wiring it into the daemon ops path the way Sessions/Slowest are used in internal/daemon/ops.go:241-251).

Laptop probe (real internal/logstore package, detached worktree at origin/main a2f85d9; stats.go sha256 cd723454, identical to the sandbox clone; probe + log in the goal's hidden_files/probe-2026-10-28-laneA-corr/):

Fixture: session s1 calls alpha ×3 and beta ×2; session s2 calls alpha ×1, beta ×1, gamma ×1.

  • BUG-A: Correlations(Query{}, 20) returns alpha/beta count=7 (3×2 + 1×1). The dashboard would render "7 sessions"; alpha and beta actually co-occur in 2 sessions.
  • Controls: alpha/gamma = 1 and beta/gamma = 1 (one call each in one session — the shapes where the product happens to equal the session count).
  • BUG-B: Correlations(Query{Server: "fff"}, 20) returns SQL logic error: ambiguous column name: server (1) instead of filtered rows.
  • Baseline: with the probe removed, the full existing internal/logstore suite passes on the same tree. No existing test calls Correlations (grep: only feedback_test.go mentions "correlation" for a different check, and routes_dashboard_test.go only asserts the JSON field is non-nil with an empty store).

Why it matters

The dashboard's correlations table is the "which tools are used together" signal for the fleet. As written it ranks pairs by how often the tools were called in shared sessions, squared-ish — a chatty session dominates — while labelling the number "sessions", so the reader cannot tell 7 sessions from 1 session with 7 pair-products. Any future filtered use (per-server, per-window) fails with a raw SQL error instead of results.

Acceptance criteria

  • The count for a tool pair equals the number of distinct sessions in which both tools were called (e.g. COUNT(DISTINCT a.session) or an equivalent per-session dedup), so the probe fixture above yields alpha/beta = 2, alpha/gamma = 1, beta/gamma = 1 — or the dashboard copy is changed to honestly name what is counted, with the semantics pinned by a test. (Session count is the recommended reading: it matches the existing dashboard copy.)
  • Correlations with a filtered Query (at minimum Server, Since/Until, Level) returns filtered results instead of an ambiguous-column SQL error — the where conditions are qualified/deduplicated for the self-join, and bound arguments stay in step with the placeholders.
  • Regression tests in internal/logstore cover: repeated calls of both tools in one session, the pair across multiple sessions, and a filtered query.
  • Existing internal/logstore and internal/daemon dashboard tests keep passing.

Notes for triage

  • Tool identity here is the bare tool name (a.tool), matching how the rest of stats.go groups; whether a pair should also be keyed by server is a separate question — not required by this issue.
  • Found by new-issue-creator lane A, 2026-10-28. Distinct from mcpx(logstore): the 'read-only' log sql guard admits mutating PRAGMAs — journal_mode=DELETE persistently un-WALs index.db, user_version/application_id rewrite its header #1664 (logstore read-only SQL guard in sql.go — different function/defect, same package).

Activity

Next
  1. developing-today commented on Oct 28, 2026

    @developing-today
    developing-todayBot
    on Oct 28, 2026 – with developing.today
    Contributor
    More actions

    CODE-679

  2. github-actions
    assigned
    dezren39
    on Oct 28, 2026
  3. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 28, 2026
  4. dezren39 commented on Oct 28, 2026

    @dezren39
    dezren39
    on Oct 28, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane A, new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-10-28 09:35 CDT
    • Found via: filed this run
    • Task: Triage the Correlations counting/filter defects: the dashboard's "N sessions" is a record cross-product, and a filtered Query errors on ambiguous columns.
    • Expectation: effort/s — done when the count is a distinct-session count (or the copy honestly renames it), filtered queries work, and regression tests pin both.
    • Links: evidence and probe in the issue body; probe + log in the goal's hidden_files/probe-2026-10-28-laneA-corr/
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Oct 31, 2026
  6. 22 remaining items

  7. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Oct 31, 2026
  8. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code), lane A
    • Session / ID: queue task 4255, repo-queue-worker-shift 2026-10-31 08:24 CDT
    • Found via: queue claim (resume)
    • Task: Parked 20m — PR fix(mcpx): logstore Correlations counts distinct sessions, filtered queries work (#1695) #3063 is merge-ready except the final: CI time budget job, still pending after the 5-minute poll window (run 41205293416). Everything else verified fresh this shift: stress PASS 3m24s, lint PASS, plugin PASS, docs build PASS, Codex review COMPLETED with no findings on head 3f63674.
    • Expectation: resume — budget green → merge → close mcpx(logstore): Correlations counts record cross-products, not sessions — the dashboard renders '7 sessions' for a pair that co-occurs in 2, and any Query filter fails with an ambiguous-column error #1695 → complete fixed_merged. No other work remains on this PR.
    • Links: PR fix(mcpx): logstore Correlations counts distinct sessions, filtered queries work (#1695) #3063 @3f6367402
  9. dezren39
    added
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 31, 2026
  10. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up (resume)

    • Agent: repo-worker-code, OpenChamber scheduled lane
    • Session / ID: queue task 4255
    • Found via: atomic queue claim
    • Task: Revalidate PR fix(mcpx): logstore Correlations counts distinct sessions, filtered queries work (#1695) #3063 and its checks; resume from awaiting CI.
    • Expectation: Merge if verified and eligible; otherwise park with a resume condition.
    • Links: fix(mcpx): logstore Correlations counts distinct sessions, filtered queries work (#1695) #3063
  11. dezren39
    added a commit that references this issue on Oct 31, 2026

    Merge pull request #3063 from developing-today/queue/4255-1695-logsto…

    e991467
  12. dezren39
    closed this as completedin #3063on Oct 31, 2026
  13. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Oct 31, 2026
  14. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done

    • Agent: repo-worker-code, OpenChamber scheduled lane
    • Session / ID: queue task 4255
    • Task: Resumed and verified PR fix(mcpx): logstore Correlations counts distinct sessions, filtered queries work (#1695) #3063; merged after CI passed. The issue closed automatically.
    • Verification: CI passed; previous worker reported logstore and daemon tests passing and fail-first regression tests.
    • Links: fix(mcpx): logstore Correlations counts distinct sessions, filtered queries work (#1695) #3063 · merge e991467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.