Skip to content

fix(edge): preserve managed runner state and protect credential handoffs - #1431

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
loveRhythm1990:fix/edge-managed-runner-context
Dec 1, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:mainfrom
loveRhythm1990:fix/edge-managed-runner-context

Conversation

@loveRhythm1990

Copy link
Copy Markdown
Collaborator

Capability assessment: Unchanged: existing User Runner capabilities, identity and wire protocol are preserved.

Summary

Fix three issues in the managed User Runner lifecycle.

  • Include the absolute, shell-quoted Astra state directory in every printed management command. An operator can copy the command into a fresh terminal after installing with a custom state directory.
  • Send the startup credential over a private Unix socket attached to the child process input. The detached process receives the explicit credential without retaining it in its command line or inheriting ASTRA_TOKEN.
  • Discard outstanding credential handoffs under the runner startup lock when stopping. A later process can safely receive its own handoff. The proven credential used for reconnects keeps its existing lifecycle.

Related issue

Follow-up to #1226 and #1227.

Change type

  • Bug fix
  • Test
  • Documentation

User and compatibility impact

Operators can keep using their existing MOI connect command. The printed status, logs and stop commands select the original state directory, including when the user opens another terminal. The original interactive invocation still accepts the token on its command line.

Architecture and complexity delta

The managed Edge supervisor owns the initial parent-to-child transfer, the credential handoff files and the printed management commands. The credential reaches the existing token manager through the same explicit-token input. The Server, release installer and database schema require no changes.

Verification

  • On macOS ARM64, cargo nextest run --locked -p astra-edge --profile ci passed all 159 tests. The PTY test executes the printed commands in a clean shell, checks the WebSocket credential, and exercises reconnection and shutdown. Regression assertions cover split and inline token flags, pending and claimed handoff files, and refusal of a late handoff while stopping.
  • make format-check, python3 scripts/ci/validate_repository.py, make audit and git diff --check passed.
  • Workspace Clippy (make lint) and the complete native macOS lane (bash scripts/ci/run-macos-lanes.sh all) passed.
  • Local test traffic used loopback and synthetic credentials. Linux CI and Docker-dependent fresh-Server integration remain for GitHub Actions. The local Docker daemon did not respond.

Final checklist

  • Tests exercise the managed runner entrypoint and failure paths.
  • Updated the production User Runner guide.
  • Reviewed the diff for sensitive material and generated files.
  • Conventional Commit title.

@mergify

mergify Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The managed supervisor remains the owner of startup, state selection and shutdown, and TokenManager still owns the credential after startup. The private socket is confined to initial process startup. The stop cleanup runs under the existing start lock and preserves the proven reconnect credential. No steady-state network, database or policy path changes. I ran the 48 managed-background module tests extracted unchanged from this head on Linux. An isolated process fixture also exercised the production launch and readiness code with an explicit synthetic credential, a relative state root containing an apostrophe and spaces, and the printed status/logs/stop commands from an empty shell environment. Incomplete socket input failed before readiness. The repository PTY/WebSocket regression exercises the actual Edge boundary.

@mergify mergify Bot added the queued label Dec 1, 2026
@mergify

mergify Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as 1ee3ce6 at 05:02 UTC

24 min in the queue, 23 min of it CI.

So far

  • ✅ Entered the queue Tue 1 Dec, 04:38 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Passed · in place
  • ✅ Merged 05:02 · 1ee3ce6 · squash
17 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = Check PR title
    • check-neutral = Check PR title
    • check-skipped = Check PR title
  • any of · required by GitHub branch protection:
    • check-success = check
    • check-neutral = check
    • check-skipped = check
  • any of · required by GitHub branch protection:
    • check-success = Test: core crates + bridge hooks
    • check-neutral = Test: core crates + bridge hooks
    • check-skipped = Test: core crates + bridge hooks
  • any of · required by GitHub branch protection:
    • check-success = Test: astra-runtime
    • check-neutral = Test: astra-runtime
    • check-skipped = Test: astra-runtime
  • any of · required by GitHub branch protection:
    • check-success = Test: astra-cli (edge-fs-tools)
    • check-neutral = Test: astra-cli (edge-fs-tools)
    • check-skipped = Test: astra-cli (edge-fs-tools)
  • any of · required by GitHub branch protection:
    • check-success = Test: astra-cli (edge-git-gix)
    • check-neutral = Test: astra-cli (edge-git-gix)
    • check-skipped = Test: astra-cli (edge-git-gix)
  • any of · required by GitHub branch protection:
    • check-success = Test: astra-cli (edge-rest)
    • check-neutral = Test: astra-cli (edge-rest)
    • check-skipped = Test: astra-cli (edge-rest)
  • any of · required by GitHub branch protection:
    • check-success = Test: astra-cli (edge-shell)
    • check-neutral = Test: astra-cli (edge-shell)
    • check-skipped = Test: astra-cli (edge-shell)
  • any of · required by GitHub branch protection:
    • check-success = Test: astra-cli (non-edge)
    • check-neutral = Test: astra-cli (non-edge)
    • check-skipped = Test: astra-cli (non-edge)
  • any of · required by GitHub branch protection:
    • check-success = Test: online (core)
    • check-neutral = Test: online (core)
    • check-skipped = Test: online (core)
  • any of · required by GitHub branch protection:
    • check-success = Test: online (integration)
    • check-neutral = Test: online (integration)
    • check-skipped = Test: online (integration)
  • any of · required by GitHub branch protection:
    • check-success = Test: turn-core + services + plan
    • check-neutral = Test: turn-core + services + plan
    • check-skipped = Test: turn-core + services + plan
  • any of · required by GitHub branch protection:
    • check-skipped = web (typecheck, test, build)
    • check-neutral = web (typecheck, test, build)
    • check-success = web (typecheck, test, build)
  • any of · required by GitHub branch protection:
    • check-skipped = Astra SDK (typecheck, test+coverage, build)
    • check-neutral = Astra SDK (typecheck, test+coverage, build)
    • check-success = Astra SDK (typecheck, test+coverage, build)
  • any of · required by GitHub branch protection:
    • check-success = Test: macOS workspace coordination
    • check-neutral = Test: macOS workspace coordination
    • check-skipped = Test: macOS workspace coordination

Times in UTC · dashboard · how the merge queue works

@mergify
mergify Bot force-pushed the fix/edge-managed-runner-context branch from 5b5a62b to ffc86ba Compare December 1, 2026 04:38
@mergify
mergify Bot merged commit 1ee3ce6 into matrixorigin:main Dec 1, 2026
41 checks passed
@mergify mergify Bot removed the queued label Dec 1, 2026
@loveRhythm1990 loveRhythm1990 mentioned this pull request Dec 1, 2026
5 tasks done
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