diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 29be5537..6ac6550b 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -256,6 +256,14 @@ jobs: PDFIUM_CHROMIUM_REVISION: ${{ needs.read_metadata.outputs.pdfium_chromium_revision }} steps: + - name: Checkout AI Studio release metadata + uses: actions/checkout@v4 + with: + ref: ${{ env.AI_STUDIO_COMMIT }} + path: ai-studio + sparse-checkout: metadata.txt + sparse-checkout-cone-mode: false + - name: Checkout Flatpak repository uses: actions/checkout@v4 with: @@ -315,6 +323,15 @@ jobs: run: | set -euo pipefail + release_version=$(sed -n '1p' ../ai-studio/metadata.txt) + release_timestamp=$(sed -n '2p' ../ai-studio/metadata.txt) + release_date=${release_timestamp%% *} + + test "$release_version" = "${AI_STUDIO_TAG#v}" + [[ "$release_timestamp" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}[[:space:]][0-9]{2}:[0-9]{2}:[0-9]{2}[[:space:]]UTC$ ]] + python3 ./update-metainfo.py "$release_version" "$release_date" + python3 ./update-metainfo.py --check "$release_version" "$release_date" + pdfium_base_url="https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${PDFIUM_CHROMIUM_REVISION}" pdfium_x64_url="${pdfium_base_url}/pdfium-linux-x64.tgz" pdfium_arm64_url="${pdfium_base_url}/pdfium-linux-arm64.tgz" @@ -368,7 +385,7 @@ jobs: branch="sync/ai-studio-${AI_STUDIO_TAG}" git checkout -B "$branch" - git add org.MindWorkAI.AIStudio.yml cargo-sources.json dotnet-sources.json tauri-cli-sources.json + git add org.MindWorkAI.AIStudio.yml org.MindWorkAI.AIStudio.metainfo.xml cargo-sources.json dotnet-sources.json tauri-cli-sources.json if git diff --cached --quiet; then echo "Flatpak repository is already synced for ${AI_STUDIO_TAG}." @@ -483,7 +500,7 @@ jobs: FLATPAK_COMMIT: ${{ needs.sync_flatpak_repo.outputs.flatpak_commit }} steps: - - name: Wait for Flatpak main build + - name: Dispatch and wait for Flatpak build id: flatpak_run env: GH_TOKEN: ${{ secrets.FLATPAK_WORKFLOW_TOKEN }} @@ -491,7 +508,7 @@ jobs: set -euo pipefail find_run_id() { - local created_after="${1:-}" + local created_after="$1" local runs runs=$(gh run list \ @@ -502,16 +519,10 @@ jobs: --limit 20 \ --json databaseId,event,headSha,createdAt) - if [ -n "$created_after" ]; then - echo "$runs" | jq -r \ - --arg commit "$FLATPAK_COMMIT" \ - --arg created_after "$created_after" \ - '[.[] | select(.headSha == $commit and .event == "workflow_dispatch" and .createdAt >= $created_after)][0].databaseId // empty' - else - echo "$runs" | jq -r \ - --arg commit "$FLATPAK_COMMIT" \ - '[.[] | select(.headSha == $commit and (.event == "push" or .event == "workflow_dispatch"))][0].databaseId // empty' - fi + echo "$runs" | jq -r \ + --arg commit "$FLATPAK_COMMIT" \ + --arg created_after "$created_after" \ + '[.[] | select(.headSha == $commit and .event == "workflow_dispatch" and .createdAt >= $created_after)][0].databaseId // empty' } validate_required_artifacts() { @@ -584,41 +595,29 @@ jobs: return 2 } + current_main=$(gh api "repos/${FLATPAK_REPOSITORY}/commits/main" --jq .sha) + if [ "$current_main" != "$FLATPAK_COMMIT" ]; then + echo "Flatpak main advanced from ${FLATPAK_COMMIT} to ${current_main} before the build could be dispatched." + exit 1 + fi + + dispatch_started_at=$(date --utc +'%Y-%m-%dT%H:%M:%SZ') + gh workflow run "$FLATPAK_WORKFLOW" \ + --repo "$FLATPAK_REPOSITORY" \ + --ref main \ + -f "artifact_retention_days=${RETENTION_INTERMEDIATE_ASSETS}" + run_id="" for attempt in {1..15}; do - run_id=$(find_run_id) + run_id=$(find_run_id "$dispatch_started_at") if [ -n "$run_id" ]; then break fi - echo "Waiting for Flatpak workflow on commit ${FLATPAK_COMMIT}..." + echo "Waiting for the dispatched Flatpak workflow on commit ${FLATPAK_COMMIT}..." sleep 20 done - if [ -z "$run_id" ]; then - current_main=$(gh api "repos/${FLATPAK_REPOSITORY}/commits/main" --jq .sha) - if [ "$current_main" != "$FLATPAK_COMMIT" ]; then - echo "No Flatpak run exists for ${FLATPAK_COMMIT}, and Flatpak main has advanced to ${current_main}." - exit 1 - fi - - dispatch_started_at=$(date --utc +'%Y-%m-%dT%H:%M:%SZ') - gh workflow run "$FLATPAK_WORKFLOW" \ - --repo "$FLATPAK_REPOSITORY" \ - --ref main \ - -f "artifact_retention_days=${RETENTION_INTERMEDIATE_ASSETS}" - - for attempt in {1..15}; do - run_id=$(find_run_id "$dispatch_started_at") - if [ -n "$run_id" ]; then - break - fi - - echo "Waiting for the dispatched Flatpak workflow on commit ${FLATPAK_COMMIT}..." - sleep 20 - done - fi - if [ -z "$run_id" ]; then echo "Timed out waiting for a Flatpak workflow to start on commit ${FLATPAK_COMMIT}." exit 1 diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.7.3.md b/app/MindWork AI Studio/wwwroot/changelog/v26.7.3.md index 10d18f05..da17b9d1 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.7.3.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.7.3.md @@ -13,6 +13,7 @@ - Fixed voice recording and transcription on Linux. - Fixed being able to switch document analysis policies while an analysis or media transcription was still in progress. - Fixed file extension handling so files are recognized correctly regardless of uppercase or lowercase letters in their extensions. Thanks, Paul Schweiß, for reporting this issue. +- Fixed AI Studio failing to start on Linux systems & showing an outdated version on the Flatpak page. - Upgraded Rust to v1.97.0. - Upgraded .NET to v9.0.18. - Upgraded Tauri to v2.11.5. diff --git a/runtime/src/main.rs b/runtime/src/main.rs index a75f73eb..b41b4c64 100644 --- a/runtime/src/main.rs +++ b/runtime/src/main.rs @@ -12,8 +12,21 @@ use mindwork_ai_studio::metadata::MetaData; use mindwork_ai_studio::runtime_api::start_runtime_api; use mindwork_ai_studio::secret::init_secret_store; -#[tokio::main] -async fn main() { +// Keep `main` synchronous. Tauri owns the application's Tokio runtime, and Tauri itself as +// well as synchronous plugins may internally call `block_on` while they are initialized. +// In v26.7.3, `#[tokio::main]` caused the Linux single-instance plugin's synchronous D-Bus +// setup to enter `block_on` through zbus/tokio. Cargo feature unification made that path use +// Tokio, so startup panicked because a runtime was being started from inside another runtime. +// +// Run asynchronous background work with `tauri::async_runtime::spawn`. If startup must await +// asynchronous work, call `tauri::async_runtime::block_on` from this synchronous function +// before Tauri enters its event loop. If a real `#[tokio::main]` ever becomes unavoidable, +// first call `tauri::async_runtime::set(tokio::runtime::Handle::current())` before using any +// Tauri async function. Then audit every synchronously initialized Tauri plugin and transitive +// dependency for internal `block_on` calls. In particular, the Linux single-instance/D-Bus +// path must be made async, replaced, or moved to a non-conflicting backend. Such a runtime +// change requires explicit Linux startup tests; compiling successfully is not sufficient. +fn main() { let metadata = MetaData::init_from_string(include_str!("../../metadata.txt")); init_logging();