Skip to content

Fix connection check prompting/disabling on a merely-stale session - #1864

Open
isc-klu wants to merge 24 commits into
intersystems-community:masterfrom
isc-klu:expired-connection
Open

Fix connection check prompting/disabling on a merely-stale session#1864
isc-klu wants to merge 24 commits into
intersystems-community:masterfrom
isc-klu:expired-connection

Conversation

@isc-klu

@isc-klu isc-klu commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1861

Root cause: checkConnection's probe requests always passed retryAfter401=false to AtelierAPI. This is likely intended to prevent a recursive loop back into checkConnection. But it also disables request's unrelated single-retry self-heal, which is what should fix a merely-expired session without user involvement.

Fix: Dropped the flag and moved all recursion-prevention logic to checkConnection (now ensureConnection) itself with a configName-scoped Set (ensuringConnection) instead of the unscoped boolean.

Cleanup that fell out of this:

  • Renamed checkConnection to ensureConnection — it's not just a check, it has side effects (prompts, workspace state, etc.).
  • Renamed its inActivate param to withTimeout, matching what the boolean actually controls.
  • Tightened request()'s signature: method: string -> literal union; options: any -> a concrete type.
  • Dropped a couple of redundant checkingConnection resets already covered by the trailing .finally(() => { ... }).

isc-klu added 24 commits April 13, 2026 16:31
…drop global checkingConnection

- checkConnection -> ensureConnection: the function verifies AND interactively
  repairs a connection (may prompt for credentials, mutates persisted state),
  which "check" undersells. Added a doc comment. Renamed the misleading
  inActivate param to withTimeout (same boolean/behavior, clearer name).
- AtelierAPI.request(): method is now a literal union instead of string,
  options is a documented inline type instead of any. Added a per-request
  checkingConnection option so request()'s 401/network-error self-heal
  guard is decided by the specific call, not ambient global state.
- Removed the module-level checkingConnection boolean entirely. It served
  two unrelated purposes: a reentrancy guard for ensureConnection (now a
  connectionsBeingChecked Set<string> keyed by configName, which also
  fixes a bug where checking one workspace folder's connection silently
  no-opped checks for other folders) and the signal read by request()
  (now purely the per-request option, no ambient fallback).
AtelierAPI's retryAfter401 constructor flag (used only by ensureConnection,
which always passed false) left wsOrFile unset, which made request()'s
401/network-error retry-and-self-heal guard always false for
ensureConnection's own serverInfo() call - regardless of any other
condition. So a merely-stale session (credentials fine, cookie expired)
skipped straight to the manual credential prompt, and dismissing it
disabled a working connection.

Removed retryAfter401 entirely; wsOrFile is now always recorded. The
scheduled follow-up ensureConnection calls this unlocks are safe: a
redundant one just no-ops via the connectionsBeingChecked reentrancy
guard if the original call is still in progress.

This also let a per-request checkingConnection option (added earlier
this session to work around the symptom) be removed again - the actual
fix makes it unnecessary.
@isc-klu
isc-klu marked this pull request as ready for review September 9, 2026 15:38
@isc-bsaviano

Copy link
Copy Markdown
Contributor

Nice, looks good. Will wait to approve until issue reporter responds.

@isc-bsaviano isc-bsaviano 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.

Upvoting so this can be merged after final confirmation.

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.

Connection check runs on every editor change and turns an expired session into a password prompt; dismissing it disables a working connection

2 participants