Skip to content

feat(fleet): integrate device auth, enrollment, and live runner management - #320

Merged
AprilNEA merged 40 commits into
masterfrom
feat/abxd-99-device-auth
Aug 11, 2026
Merged

feat(fleet): integrate device auth, enrollment, and live runner management#320
AprilNEA merged 40 commits into
masterfrom
feat/abxd-99-device-auth

Conversation

@KafuChino123

@KafuChino123 KafuChino123 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

  • switch ArcBox Desktop sign-in to the Better Auth device-authorization flow while preserving Keychain-backed session restoration
  • add authenticated Fleet Platform workspace discovery and enrollment-token issuance
  • add local Fleet Agent gRPC communication, enrollment reconciliation, and watch-driven runner state
  • expose runner drain, resume, unenroll, VM settings, and runner image preparation through the Fleet Agent interface
  • replace the RUN-9 sample data with live Fleet Agent state
  • retain manual enrollment-token support as an internal fallback without exposing the fallback UI

Architecture boundary

ArcBox Desktop owns authentication, Fleet Platform REST requests, enrollment orchestration, local Fleet Agent gRPC communication, and UI state.

Desktop does not install, create, start, stop, or update the Fleet Agent. The Fleet Agent process remains managed by launchd and its corresponding daemon. Runner VM lifecycle operations remain Fleet Agent → arcbox-daemon responsibilities.

Validation

  • make verify-arcbox-protobuf
  • swift-format lint -r --strict ArcBox/ Packages/
  • swiftlint lint --strict --config .swiftlint.yml
  • xcodegen generate with no tracked project-file drift
  • full macOS Debug test suite: 165 tests, 0 failures
  • ARM64 Release build with SKIP_RUST_BUILD=1

Draft status

Remaining end-to-end validation includes:

  • real GitHub Actions runner provisioning and job execution
  • live logs and teardown through Fleet Agent → arcbox-daemon
  • signed and notarized clean-machine validation

Supersedes #281.

Summary by CodeRabbit

  • New Features

    • Added Fleet Runners support, including Mac enrollment, workspace selection, host status, active jobs, drain/resume controls, and unenrollment.
    • Added Fleet settings for VM mode, runner images, agent status, and image preparation progress.
    • Added device-based sign-in with browser prompts, session restoration, and clearer authentication states.
    • Added production and local Fleet platform configuration support.
  • Bug Fixes

    • Improved shutdown handling, connection recovery, and user-facing error messaging.
    • Improved accessibility and adaptive text sizing across empty states and status badges.
  • Documentation

    • Documented macOS window-sizing guidance for dynamic SwiftUI content.

@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

ABXD-99

KafuChino123 and others added 25 commits July 22, 2026 02:34
Add a FleetControlClient Swift package with generated protobuf and gRPC stubs for the fleet agent local control API.

Wire the local package into the ArcBox app target so phase 1 desktop integration can import the generated client types.
Wrap the generated fleet control stubs in a high-level client for lifecycle, state watch, and settings RPCs.

Map proto responses into desktop-facing models while preserving optional settings update presence semantics, and cover the mapping behavior with tests.
Add the local fleet control client to SwiftUI environment values and app scene injection.

Start the fleet control transport outside daemon startup, log through the fleet category, and close it during app termination.
Drive fleet agent state from the local control watch stream.

Add lifecycle actions, settings updates, reconnect backoff, and user-readable error handling for the runners dashboard.
Consume the signed-in OIDC session to list Platform workspaces and issue workspace-scoped Fleet enrollment tokens.

Wire token issuance into local Fleet Agent enrollment and configure the Platform endpoint for app and CI builds.
Replace RUN-9 sample data and stub actions with FleetViewModel watch snapshots, workspace enrollment, and local drain/resume controls.

Expose the runner section in release builds and cover the presentation-state mapping.
Let ArcBoxTests consume FleetControlClient through the hosted ArcBox target, avoiding Xcode’s duplicate dynamic gRPC package graph.

Handle runner item-selection deep links explicitly so navigation remains exhaustive.
- coordinate authenticated token handoff with local Agent state
- keep Fleet watch and client transport app-scoped
- reconcile unknown outcomes and graceful termination
On macOS 26, any state change inside a fixedSize(vertical: true)
subtree triggers a window-sizing pass that resizes the window — or the
NavigationSplitView content when the window cannot grow — to the
screen's visible-frame height, sliding the sidebar under the title bar
and pushing the account button off-screen. Drop the modifier from the
dynamic error label (it wraps identically without it) and document the
pitfall in AGENTS.md.
Replace the OIDC Authorization Code + PKCE flow with the Better Auth
device-authorization grant: request a device code, open the approval page
in the default browser, and poll the token endpoint per RFC 8628. The
polled access token is an opaque Better Auth session token with a sliding
server-side expiry, sent as the platform API bearer — the token the
platform actually accepts, unblocking fleet enrollment token issuance.

Identity now comes from the provider session endpoint instead of OIDC
userinfo/ID-token claims, and sign-out revokes the session server-side.
The Keychain store self-heals by clearing pre-device-flow token blobs.
PKCE, discovery, code exchange, token refresh, and the custom-scheme
OAuth callback (including its DeepLinkRouter leg) are gone; build
configuration keys are unchanged. The Account pane and runner section
show the confirmation code with reopen-browser and cancel affordances
while approval is pending.
@KafuChino123
KafuChino123 force-pushed the feat/abxd-99-device-auth branch from c3f4c5a to 97e5cde Compare July 24, 2026 08:46
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change replaces browser-based OIDC authentication with Better Auth device authorization and adds Fleet platform/local-agent clients, enrollment orchestration, runner monitoring, VM image preparation, Fleet settings, application wiring, and associated tests.

Changes

Fleet authentication and runner integration

Layer / File(s) Summary
Device authorization session migration
Packages/ArcBoxAuth/..., Packages/ArcBoxAuth/Tests/...
Replaces OIDC token and browser callback flows with device-code polling, session verification, async keychain-backed session storage, and updated authentication tests.
Fleet client contracts and transports
Packages/FleetControlClient/..., Packages/FleetPlatformClient/...
Adds gRPC local-agent and REST platform clients, Fleet models, typed errors, image preparation models, configuration, protocol generation, and client tests.
Agent lifecycle and enrollment orchestration
ArcBox/Services/..., ArcBox/ViewModels/Fleet/..., ArcBox/ViewModels/RunnersViewModel.swift, ArcBoxTests/...
Adds connection readiness and shutdown handling, snapshot watching, enrollment reconciliation, drain/unenroll actions, VM settings management, image preparation, and orchestration tests.
Runner navigation and UI
ArcBox/Models/..., ArcBox/Views/Runners/..., ArcBox/Views/Settings/FleetSettingsView.swift, ArcBox/Views/ContentView.swift
Adds the CI Runners navigation section, enrollment states, host status and telemetry views, in-flight jobs, image preparation status, and Fleet VM settings UI.
Application wiring and build integration
ArcBox/ArcBoxApp.swift, ArcBox/App/..., ArcBox.xcodeproj/project.pbxproj, project.yml, .github/workflows/..., Info.plist
Injects Fleet clients and view models into app windows, coordinates startup and termination, configures the platform base URL, registers packages and sources, and updates generated build configuration.

Estimated code review effort: 5 (Critical) | ~120 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main Fleet integration work: device auth, enrollment, and live runner management.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/abxd-99-device-auth

Comment @coderabbitai help to get the list of available commands.

@KafuChino123
KafuChino123 marked this pull request as ready for review July 24, 2026 09:05
Comment thread ArcBox/ViewModels/RunnersViewModel.swift
@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

Prevent concurrent device sign-in tasks, expose recovery for terminal Fleet states, and complete the test-target and cancellation cleanup validated by the full app suite.
Comment thread ArcBox/ViewModels/RunnersViewModel.swift
Comment thread ArcBox/ViewModels/RunnersViewModel.swift
…hots

Credential-rejected and detached snapshots ignored loadState, so a
disconnected watch still offered the unenroll recovery action against
a stale snapshot. Extract the unenrolled branch's loadState switch
into connectivityOverride and reuse it for all three terminal cases.
…-auth

# Conflicts:
#	ArcBox.xcodeproj/project.pbxproj
#	ArcBox/App/AppDelegate.swift
#	ArcBox/App/DeepLinkRouter.swift
#	ArcBox/ArcBoxApp.swift
#	ArcBox/Info.plist
#	ArcBox/Models/NavItem.swift
#	ArcBox/Views/Settings/AccountSettingsView.swift
#	ArcBox/Views/Settings/SettingsView.swift
#	ArcBox/Views/SidebarAccountButton.swift
#	Packages/ArcBoxAuth/Sources/ArcBoxAuth/Session/AuthSession+SignIn.swift
#	Packages/ArcBoxAuth/Tests/ArcBoxAuthTests/AuthSessionTests.swift
Comment thread ArcBox/ViewModels/RunnersViewModel.swift
Comment thread ArcBox/ViewModels/RunnersViewModel.swift Outdated
Comment thread ArcBox/ViewModels/RunnersViewModel.swift Outdated
Comment thread ArcBox/ViewModels/RunnersViewModel.swift Outdated
Comment thread ArcBox/ViewModels/RunnersViewModel.swift Outdated
@AprilNEA
AprilNEA merged commit faa59dd into master Aug 11, 2026
6 checks passed
@AprilNEA
AprilNEA deleted the feat/abxd-99-device-auth branch August 11, 2026 10:36
KafuChino123 added a commit that referenced this pull request Aug 12, 2026
The 1.35.0 release PR merged with an empty `### Highlights` section, so
`cargo xtask release notes` now fails on every PR against master. That
step runs before Lint, Build and Test, so no PR gets as far as
compiling. The release DMG extracts the same section to feed Sparkle's
update dialog and refuses to build without it, so 1.35.0 cannot be
packaged either.

Write the section from what 1.35.0 actually shipped: the Fleet device
auth, enrollment and runner management in #320, the authoritative
sandbox port reconciliation in #374, and the telemetry identification
and Privacy toggle ordering in #367.
AprilNEA pushed a commit that referenced this pull request Aug 12, 2026
* fix(ui): slide the detail tab indicator instead of morphing glass

The detail tab bar played an exaggerated stretch on every tab switch,
worst on the four-tab container view, and the first switch after a cold
launch was worse still.

GlassEffectContainer's spacing is a blend threshold, not a layout gap:
the higher it is, the sooner shapes start merging as they approach. It
was set to tabCount * detailTabSegment -- 320pt for containers, 480pt
for sandboxes -- against an HStack spacing of 2pt, so the blend field
spanned the whole bar. Apple documents that a container spacing larger
than the interior stack's spacing blends the effects together at rest.

The indicator also toggled glassEffect between .regular and .identity
per segment under one shared glassEffectID. That ID stays constant while
the segment beneath it changes, which is the documented trigger for
GlassEffectTransition.matchedGeometry to apply "additional scale and
offset effects to content" -- on top of the oversized blend.

Render one persistent glass capsule instead and position it with
matchedGeometryEffect against the selected segment. The pill now moves
rather than appearing and disappearing, so there is no morph to
overshoot and no appearance transition to misfire on first mount.
GlassEffectContainer is no longer needed for a single effect.

* chore(release): curate the 1.35.0 highlights

The 1.35.0 release PR merged with an empty `### Highlights` section, so
`cargo xtask release notes` now fails on every PR against master. That
step runs before Lint, Build and Test, so no PR gets as far as
compiling. The release DMG extracts the same section to feed Sparkle's
update dialog and refuses to build without it, so 1.35.0 cannot be
packaged either.

Write the section from what 1.35.0 actually shipped: the Fleet device
auth, enrollment and runner management in #320, the authoritative
sandbox port reconciliation in #374, and the telemetry identification
and Privacy toggle ordering in #367.
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.

2 participants