Skip to content

fix(app): always send --remove-scopes when the live grant is unknown - #89

Merged
volod-vana merged 1 commit into
mainfrom
volod/remove-scopes-fallback
Oct 8, 2026
Merged

volod-vana merged 1 commit into
mainfrom
volod/remove-scopes-fallback

Conversation

@volod-vana

Copy link
Copy Markdown
Member

Problem

vana app request --scopes github.starred --remove-scopes github.profile --owner 0x... with a live grant read that timed out printed Removing nothing and the outcome showed removed: none. The explicit removal list looked dropped.

What actually happened on the wire: the CLI still passed removeScopes to the SDK controller, and the SDK sends it in the request body on every grant-union status (merged, owner_unknown, unavailable, disabled). So the approval page, which re-reads the live grant, would have honored the removal. The bug was that the CLI threw the list away in its own plan, so the printout and the --json data said nothing would be removed.

Change

  • GrantUnionPlan now always carries the explicit removeScopes list, whatever the live grant read found, and the request is created from it.
  • Outcome data (human and --json) gains removeScopes. removed keeps its meaning: live grant entries actually removed, which is only known after a successful read.
  • When the live grant was not read (owner_unknown, owner_ambiguous, unavailable, disabled), the printout shows Removing (if shared) github.profile instead of Removing nothing.
  • Live grant read timeout raised from 5s to 10s, with one retry on a timeout or network error before falling back.
  • Builder skill doc notes the behavior.

SDK checked: createDirectDataController().createAccessRequest keeps removeScopes in the body on owner_unknown and unavailable, so no SDK change is needed.

Tests

New cases in test/cli/app-request.test.ts with fakes:

  • read times out with --owner: retried once, request body and stored request carry removeScopes, printout shows Removing (if shared), never Removing nothing
  • gateway error: --json data has removed: [] and removeScopes: [...]
  • owner unknown (no earlier approval) and --no-merge-grant: removeScopes still sent
  • planGrantUnion retries a hung read once and merges the second answer; two hung reads give unavailable with the removals kept
  • defaults are 10s and 2 attempts

pnpm validate green (60 test files) with HOME and VANA_HOME in temp dirs.

https://claude.ai/code/session_01Fcv6uEy4zcXaigzDNxeW3j

When the live grant read failed or timed out, the request printout said
"Removing nothing" and the outcome showed `removed: none`, so an explicit
--remove-scopes list looked dropped. The request body does carry it (the
approval page re-reads the live grant and honors removals), but nothing
said so.

- Keep the explicit list on every grant-union plan (`removeScopes`) and
  report it in --json/outcome data.
- Print "Removing (if shared) <list>" when the live grant was not read.
- Raise the live grant read timeout from 5s to 10s and retry once.
- Tests for timeout, gateway failure, owner unknown and --no-merge-grant
  paths, plus the retry behavior.

Claude-Session: https://claude.ai/code/session_01Fcv6uEy4zcXaigzDNxeW3j
@volod-vana
volod-vana merged commit aaeb754 into main Oct 8, 2026
6 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 8, 2026
## [0.40.1](v0.40.0...v0.40.1) (2026-10-08)

### Bug Fixes

* **app:** always send --remove-scopes when the live grant is unknown ([#89](#89)) ([aaeb754](aaeb754))
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.40.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant