send_connection_slot_message wrote the optimistic user row from the runtime snapshot alone, then called send_slot_message, which can still refuse the send for an empty message, a busy slot or a disconnected slot. The rejected question stayed in history with no failure marker, and because each attempt minted a fresh local- id, retrying appended a second copy rather than replacing the first. Add a read-only pre-flight, ensure_slot_can_send, and run it before any database write. The conditions it checks are extracted into slot_send_precondition, which send_slot_message now uses inside its own critical section, so the two cannot drift. Mint the message id once so the failure path can address the row it wrote. A send that fails after AstrBot accepted it must keep its question: cancelled and streamInterrupted both mean the message is already in the remote conversation and a partial reply may already be stored. Those two keep the row; every other code marks it failed. server_received encodes that rule and is covered by a test that walks every AstrBotClientError variant through astrbot_send_error, so a future rename of an R2 error code cannot silently change the classification. Marking rather than deleting keeps chat_sessions.last_message_id valid, re-uses the idempotent upsert, and leaves unread counts alone since they already ignore user rows. The queue sanctions either choice. The R2 retry loop and its error mapping are untouched; all five R2 transport sentinels still pass. Refs: F-18 (audit P2-3). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| assets | ||
| crates | ||
| docs | ||
| src | ||
| src-tauri | ||
| tests | ||
| .editorconfig | ||
| .gitignore | ||
| .node-version | ||
| .npmrc | ||
| .prettierignore | ||
| AGENTS.md | ||
| AstrBot_Desktop_Codex_Forgejo_Predevelopment_Workflow.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| eslint.config.js | ||
| index.html | ||
| package.json | ||
| playwright.config.ts | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| rust-toolchain.toml | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
AstrBot Desktop
AstrBot Desktop is a Windows companion and local-assistance client built with Tauri 2, React, TypeScript, Vite, and Rust.
The MVP supports two isolated active AstrBot connection slots:
companionfor chat, proactive messages, voice, and game companionship;operationsfor user-authorized, policy-controlled diagnostics and recoverable file operations.
Security boundaries
- Credentials remain in Windows secure storage and are never exposed to React.
- Server tool requests are proposals; the Rust policy layer makes the final decision.
- The application does not provide arbitrary PowerShell, CMD, or shell execution.
- NAS transfers use
plan -> dry run -> copy -> verify -> commitand preserve source files on failure.
Current phase
The repository is in the P00 bootstrap and high-risk Spike phase. See docs/implementation-plan.md and docs/progress.md.
Authoritative documents
AGENTS.mddocs/01_Architecture_Design.mddocs/02_Codex_Implementation_Tasks.mdAstrBot_Desktop_Codex_Forgejo_Predevelopment_Workflow.md
Development prerequisites
- Windows 11
- Node.js and pnpm
- Rust stable with the MSVC target
- Visual Studio 2022 Build Tools with Desktop development with C++
- WebView2 Evergreen Runtime
Local commands
pnpm install --frozen-lockfile
pnpm check:frontend
pnpm test:e2e
pnpm rust:fmt
pnpm rust:clippy
pnpm rust:test
pnpm rust:check
pnpm tauri:dev
pnpm tauri:build
On Windows, Cargo build output can be redirected away from a NAS workspace:
$env:CARGO_TARGET_DIR = "$env:LOCALAPPDATA\Temp\AstrBot-Desktop-target"
The 30-minute connection soak and the controlled Windows UIA/capture smoke are ignored by the normal suite and must be invoked explicitly as documented in tests/README.md. The UIA/capture smoke opens only a generated, non-sensitive standard dialog and never writes captured pixels to disk.
P00 results and unresolved environment boundaries are recorded in docs/spikes and docs/progress.md.