Skip to content

fix(cli): offline-vs-no-env classifier keys on the probe name, not the remembered label (bugbot #266)#274

Merged
saadqbal merged 1 commit into
developfrom
fix/266-offline-classifier
Jul 14, 2026
Merged

fix(cli): offline-vs-no-env classifier keys on the probe name, not the remembered label (bugbot #266)#274
saadqbal merged 1 commit into
developfrom
fix/266-offline-classifier

Conversation

@saadqbal

@saadqbal saadqbal commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

What

Follow-up to #267. Cursor Bugbot flagged (learned rule "commands targeting the active client must use bindActiveClientNamespace"):

Preferring the remembered client label onto env.name before the offline-vs-no-env check makes that check treat a non-empty ActiveClientName/ActiveClientID as evidence of an environment, even when ActiveClientNamespace is empty… a leftover id/name alone can render Offline with the full menu instead of the no-environment installer path.

resolveHomeModel's classifier uses provisioned || env.name != "", where env.name != "" is meant to signal "the probe surfaced an environment name." #267 made env.name carry the remembered display label, so a stale ActiveClientName/ID with no cached namespace now flips the no-env installer path to Offline.

Fix

Capture the probe's own surfaced name (probeNamedEnv) before the display-name override, and classify on provisioned || probeNamedEnv. The remembered label still drives the display name; it no longer counts as evidence of a reachable environment.

(In the real flow the probe only surfaces a name on localLive/localDegraded, never on the localNoRelease/localUnreachable branch this classifier runs on — so this restores the intended "namespace is the signal" behavior while preserving the synthetic probe-surfaced-a-name case the existing tests pin.)

Verification

  • gofmt + go vet clean; go test ./internal/cli/ green.
  • New TestResolveHomeModel_LeftoverNameNoNamespaceIsNoEnv (leftover name, no namespace → homeNoEnv) — fails on current develop (env.name="stale-id" → Offline), passes on the fix. All existing state-machine tests still pass.

Once merged to develop, promote PR #266 picks it up.

🤖 Generated with Claude Code


Note

Low Risk
Narrow CLI home state-machine fix with a dedicated regression test; no auth, data, or cluster mutation paths.

Overview
Fixes a regression where the bare tracebloc home screen could show Offline with the full menu when config still had a stale ActiveClientName/ActiveClientID but no cached ActiveClientNamespace. After the display-name override, env.name was non-empty, so provisioned || env.name != "" treated that as evidence of an environment.

resolveHomeModel now records probeNamedEnv from the cluster probe before applying the remembered display label, and uses provisioned || probeNamedEnv for the offline vs no-environment branch. Remembered names still drive envName for display; they no longer affect classification.

Adds TestResolveHomeModel_LeftoverNameNoNamespaceIsNoEnv so leftover name without namespace maps to homeNoEnv (installer path), not homeOffline.

Reviewed by Cursor Bugbot for commit 0f791a4. Bugbot is set up for automated code reviews on this repo. Configure here.

…red label

#267 made resolveHomeModel overwrite env.name with the remembered client name
for display. But the offline-vs-no-env classifier reads `env.name != ""` to mean
"the probe surfaced an environment name" — so a leftover ActiveClientName/ID with
no cached namespace (provisioned=false) now masquerades as a reachable
environment and renders Offline + full menu instead of the no-environment
installer path.

Capture the probe's own surfaced name (probeNamedEnv) BEFORE the display-name
override and classify on that: `provisioned || probeNamedEnv`. A remembered
display label with no namespace is no longer evidence of an environment. Adds a
regression test for the leftover-name-without-namespace case.

Fixes the Cursor Bugbot "Remembered name skews offline detection" finding on #266
(learned rule: commands targeting the active client must use bindActiveClientNamespace).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
Contributor

👋 Heads-up — Code review queue is at 36 / 30

Above the WIP limit. The team convention is to review existing PRs before opening new work.

Open PRs currently in Code review (oldest first):

  • averaging-service#181 — feat(weights): normalize-on-read — mixed cycles average instead of rejecting (SEC-03 §8 step 2) · author: @shujaatTracebloc · no reviewer assigned
  • averaging-service#182 — feat(weights): averaging writes SafeTensors (TF + PyTorch) — SEC-03 §8 step 4 · author: @shujaatTracebloc · no reviewer assigned
  • backend#1079 — feat(global_meta): edge dataset_meta exposure + attributes contract at ingest (#924 G4a) · author: @divyasinghds · no reviewer assigned
  • backend#1086 — docs(rfc): SafeTensors weight-format migration — SEC-03 Phase 1 (RFC 0004) · author: @shujaatTracebloc · no reviewer assigned
  • backend#1093 — chore(deps): bump django from 5.2.14 to 5.2.15 · author: @dependabot · no reviewer assigned
  • backend#1095 — feat(experiment): configurable preprocessing knobs incl. tabular scaler — RFC 0003 L1 + L1b (#1094) · author: @LukasWodka · no reviewer assigned
  • backend#1100 — fix(boot): pin SDK install to tracebloc==0.11.2, drop 404 dev line (#1098) · author: @LukasWodka · reviewer: @saqlainsyed007
  • backend#1104 — perf(experiments): remove in-request completion sweep from status ping (part 2/2, #984) · author: @aptracebloc · no reviewer assigned
  • cli#266 — main - > enhance CLI features and tests · author: @saadqbal · no reviewer assigned
  • cli#268 — test: coverage wave 2 — utility packages toward 95% · author: @LukasWodka · no reviewer assigned

Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.)

@aptracebloc aptracebloc 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.

Verified the fix — approving.

probeNamedEnv := env.name != "" is captured before the display-name override, and the classifier now keys on provisioned || probeNamedEnv. That correctly decouples the classification signal from the display label: the remembered name still drives what's shown, but only a cached namespace (provisioned) or the probe's own surfaced name count as evidence of a reachable environment. So a stale ActiveClientName/ID with no cached namespace now falls through to the no-env installer path instead of Offline. TestResolveHomeModel_LeftoverNameNoNamespaceIsNoEnv is a proper mutation guard. This is the right structural fix (not just a patch) — it restores #244's "namespace is the signal" intent while keeping #267's display improvement.

Caveat / process note: the home-screen state machine (from #244) has now taken a few follow-on fixes off the #266 promote chain (#267 label unification → this classifier fix). Each is well-tested and it's converging, but the recurring theme is env.name being overloaded for both display and classification. Before #266 promotes, it's worth a quick holistic once-over of resolveHomeModel as a whole to confirm no other display/classification coupling is lurking — cheaper to catch now than as another promote-chain follow-up.

— drafted with Claude (Opus 4.8), sent by @aptracebloc

@saadqbal
saadqbal merged commit ae11322 into develop Jul 14, 2026
21 checks passed
@saadqbal
saadqbal deleted the fix/266-offline-classifier branch July 14, 2026 10:30
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.

3 participants