Skip to content

A command's first use of a remembered Earthdata token cancels its own requests ("request cancelled before it was sent") #1626

Closed

Description

@elpidioassinaturas

What happens

On the desktop app (built from main plus #1581, 2026-11-08), with an Earthdata Login token remembered on this computer:

  1. Start the app. Nothing has read the token yet: it is read lazily (earthdata::restore).
  2. Run a plugin command that calls earthdata.status and then fetches from Earthdata. In our case it was the BrasilData plugin's GEDI L4D command: earthdata.status, then host.fetch of a CMR granules.json search, then layer.addUrl with bbox on an ORNL DAAC COG.
  3. The fetch fails with https://cmr.earthdata.nasa.gov/search/granules.json?[query omitted]: request cancelled before it was sent.
  4. Run the same command again: it works. The token was restored during the first run.

Why

  • The snapshot: a node with a Network effect binds RuntimeAccounts::capture at plan time (policy/plan.rs, bind). That snapshot includes earthdata::account_identity(), the active in-memory token, which is still None.
  • The restore: inside the command, earthdata.status calls earthdata::restore(). The remembered token becomes active (None → Some).
  • The cancel: host.fetch runs under still = continuation.check(). Node::current() then sees auth.is_current() == false ("the active account changed"), and check_still cancels the request.

The same holds for the first request to a data host inside a command, because earthdata::authorization() also calls restore(). A built-in command that reads an Earthdata COG first thing in a session probably cancels its own later requests in the same way. I have not checked that.

Since #1461 this is deliberate: remembered_tokens asserts "restoration changes active identity just like replacement". So the fix should not loosen the identity check. It should make sure the restore happens before a command takes its snapshot.

Choices in this proposal

  1. Read the remembered token off the frame at startup. The desktop app would do this as soon as it has a credential store, reusing earthaccessui::restore, which already reads it on a thread. Commands started afterwards capture the restored identity.
    • Cost: one keychain read at launch, off the frame, the same read the Earthaccess pane does today when it is opened.
    • The command line and Python already opt in to saved secrets explicitly, so they can keep reading lazily.
  2. Say why when a restore cancels a request. A command still running when that read lands is cancelled, as it should be under fix(security): bind approvals to exact execution scopes #1461. The message should then say what happened: "the Earthdata token remembered on this computer was read while this command ran; run it again". At the moment it says only "request cancelled before it was sent".
  3. Rejected: treat restoration as no account change. It is simpler, but it contradicts the rule fix(security): bind approvals to exact execution scopes #1461 states, and a maintainer should decide that, not this issue.

Workaround

Click the command a second time. The BrasilData plugin now says so when it sees this cancellation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions