AstrBot-Desktop/docs/reports/p02-dual-slots-handoff.md
YokiiroBW 34a563c65b feat(connection): validate auto-connect and guard operations switches
Add configuration-only auto-connect rules, runtime operations slot lock
while tasks are active, and duplicate server-instance warnings without
silent Profile merge. Surface policy status to the settings UI and cover
the new boundaries with Rust and Vitest checks.
2026-07-20 00:49:15 +08:00

4 KiB

P02 dual-slot checkpoint and handoff

Date: 2026-07-19

Source state

  • Branch: feat/p02-dual-connections
  • Base merge: 885abd1553ed8f1428de7118a6f4b59f7e22a45c
  • Planning commit: 73693b9 docs(p02): start dual connection phase
  • Feature commit: bcc08cf feat(connection): add persistent dual slot assignment
  • Remote transport: approved ordinary Forgejo HTTP push
  • Force push, rebase, and automatic main merge: not used

Completed scope

  • SQLite schema v3 creates exactly two fixed rows: companion and operations.
  • A foreign key clears slot assignment when a Profile is deleted.
  • A unique Profile constraint prevents one Profile from occupying both slots.
  • Rust exposes bounded list, assign, and clear commands.
  • Slot requests reject unknown fields, malformed Profile IDs, missing Profiles, and duplicate cross-slot assignment.
  • The frontend validates Rust payloads with strict Zod Schemas.
  • The settings UI assigns or clears Profiles without activating REST/SSE or reading credentials.
  • Stored server_instance_id is displayed as metadata only; the increment does not enroll or silently replace server identity.

Security boundary

  • No Token, password, API Key, Cookie, Authorization header, or NAS credential field was added to slot IPC.
  • Slot assignment alone grants no local-tool permission.
  • React does not receive stored credentials.
  • Real Gateway compatibility, token refresh, identity enrollment, and certificate pinning remain explicitly unresolved in PD-0009 through PD-0012.

Verification

  • npm.cmd --prefix H:\AstrBot-Desktop run check:frontend: passed.
    • Prettier: passed.
    • ESLint: passed.
    • TypeScript: passed.
    • Vitest: 4 passed.
    • Vite production build: passed.
  • npm.cmd --prefix H:\AstrBot-Desktop run test:e2e: passed, Chromium 1/1.
  • cargo fmt --all --manifest-path H:\AstrBot-Desktop\Cargo.toml -- --check: passed.
  • cargo clippy --workspace --all-targets --manifest-path H:\AstrBot-Desktop\Cargo.toml -- -D warnings: passed.
  • cargo check --workspace --all-targets --manifest-path H:\AstrBot-Desktop\Cargo.toml: passed.
  • cargo test --workspace --manifest-path H:\AstrBot-Desktop\Cargo.toml: passed, 56 normal tests and 2 explicit manual tests ignored.
  • Changed-file high-risk secret pattern scan: passed with no matches.

Not rerun at this incremental checkpoint:

  • real Tauri development startup;
  • Windows release or NSIS build;
  • Forgejo Actions;
  • real AstrBot Gateway compatibility;
  • real UNC file transaction.

No success is claimed for the items above.

Remaining P02 work

  1. Add auto-connect validation for at most two Profiles and one Profile per slot.
  2. Block Operations Profile switching while an operations task is active.
  3. Add duplicate server_instance_id warnings without silent identity merging.
  4. Resolve the credential enrollment and rotation lifecycle.
  5. Resolve first-contact server identity confirmation.
  6. Implement validated certificate fingerprint binding without disabling TLS verification.
  7. Only then enable two independent configured REST/SSE runtimes and Mock-backed failure tests.

Handoff status

The first controller status call failed before project lookup because the global dev-handoff config references missing files:

  • identity file: C:\Users\Administrator\Documents\Codex\2026-07-14\ke\work\ssh\astrbot_vm_ed25519
  • known-hosts file: C:\Users\Administrator\Documents\Codex\2026-07-14\ke\work\ssh\known_hosts

The controller also reported host-key verification failure. No handoff ID, VM workspace, branch, or HAPI session has been created or claimed.

After the source branch was clean and pushed, the formal dev-handoff send --approve call was also attempted with the verified test and secret-scan results. It failed before task creation with the same missing identity and host-key verification error.

Next concrete step

Restore or reconfigure the authorized VM SSH identity and known-hosts paths, rerun dev-handoff status, then send this exact pushed checkpoint to vm-codex. If the controller stops at ready_to_accept, report that state honestly and wait for the VM worker.