Skip to content

feat(autostart): add autostart_on_first_run config option - #131

Merged
ErikBjare merged 1 commit into
masterfrom
feat/autostart-on-first-run
Sep 1, 2026
Merged

ErikBjare merged 1 commit into
masterfrom
feat/autostart-on-first-run

Conversation

@ErikBjare

Copy link
Copy Markdown
Member

Adds an autostart_on_first_run config key (default false) to [aw-qt]. When true, aw-qt enables OS-level start-at-login (via the #127 machinery) on first launch and drops a marker file in the data dir so the user's later choice is always respected: disabling from the tray never gets overridden, and a failed enable writes no marker so it retries next launch. Skipped under --testing and on unsupported platforms.

Motivation: Research Edition study deployments (participants must survive reboots with zero setup; see the #127 motivation). The research CI build will flip this default to true via the existing config-patching step in the bundle repo — follow-up PR there.

Tests cover: enable+marker, marker-prevents-reenable, failure-no-marker-no-raise, unsupported-noop.

When enabled, aw-qt registers itself as a login item on first launch,
recording a marker in the data dir so a user who later disables
start-at-login from the tray is never overridden. Failures write no
marker and retry on the next launch.

Off by default; intended for Research Edition builds, where participant
machines must resume tracking after reboots without setup steps.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T16:55:58.165748Z 3459be9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a configurable first-launch flow that enables OS start-at-login outside testing mode and records successful activation so later user changes are preserved.

  • Adds autostart_on_first_run defaults and settings loading.
  • Invokes first-run registration during application startup.
  • Adds marker-based retry behavior and focused unit tests.

Confidence Score: 4/5

The marker-write failure path should be fixed before merging because it can terminate aw-qt after successfully changing the user's OS login registration.

The new startup path handles registration failures but not the equally fallible marker persistence step, allowing filesystem errors to abort application initialization and leave retry state inconsistent.

Files Needing Attention: aw_qt/autostart.py, aw_qt/main.py

Important Files Changed

Filename Overview
aw_qt/autostart.py Adds marker-backed first-run enablement, but an unhandled marker filesystem failure can abort startup after registration succeeds.
aw_qt/config.py Adds false-by-default configuration values and loads the selected section's first-run setting.
aw_qt/main.py Invokes first-run registration before Manager initialization and allows marker-write exceptions to terminate startup.
tests/test_autostart.py Covers success, existing-marker, backend-failure, and unsupported-platform behavior, but not marker-write failure after successful enablement.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Load aw-qt configuration] --> B{autostart_on_first_run and not testing?}
    B -- No --> G[Continue application startup]
    B -- Yes --> C{Platform supported?}
    C -- No --> G
    C -- Yes --> D{Marker exists?}
    D -- Yes --> G
    D -- No --> E[Enable OS start-at-login]
    E --> F[Write success marker]
    F --> G
Loading

Reviews (1): Last reviewed commit: "feat(autostart): add autostart_on_first_..." | Re-trigger Greptile

Comment thread aw_qt/autostart.py
except AutostartError as e:
logger.warning(
f"Could not enable autostart on first run (will retry next launch): {e}"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Marker failure aborts startup

When OS autostart is enabled successfully but the marker cannot be written, the unhandled filesystem exception terminates aw-qt before its manager or tray starts. No marker remains, so a later launch also retries registration and can override a subsequent user disable.

Knowledge Base Used:

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3459be9edc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread aw_qt/main.py
Comment on lines +137 to +138
if config.autostart_on_first_run and not testing:
autostart.ensure_enabled_on_first_run()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the selected profile in the login command

When a custom section such as [aw-qt-research] enables this option and aw-qt is launched with --profile research, this call registers the profile-agnostic command produced by autostart._command(); export_profile() only changes the current process environment, which is not retained by the OS login item. After reboot, the login item therefore starts the default profile rather than the research profile, potentially recording experiment data into the wrong instance. Pass the profile through to the registered command/environment or restrict this option to DEFAULT_PROFILE.

Useful? React with 👍 / 👎.

@ErikBjare
ErikBjare merged commit 1337c9a into master Sep 1, 2026
4 checks passed
@ErikBjare
ErikBjare deleted the feat/autostart-on-first-run branch September 1, 2026 16:56
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.

1 participant