Skip to content

feat(cli): add autosubmit scheduling for submit#351

Open
dmego wants to merge 12 commits intojunhoyeo:mainfrom
dmego:feat-autosubmit-scheduling
Open

feat(cli): add autosubmit scheduling for submit#351
dmego wants to merge 12 commits intojunhoyeo:mainfrom
dmego:feat-autosubmit-scheduling

Conversation

@dmego
Copy link
Copy Markdown

@dmego dmego commented Mar 21, 2026

Closes #123

Summary

  • add tokscale autosubmit enable|disable|status|run
  • reuse the existing submit filters while keeping --dry-run unavailable in autosubmit
  • persist autosubmit config in settings.json and report both saved state and live scheduler state
  • install platform schedulers:
    • macOS: launchd
    • Linux: systemd --user, with cron fallback
    • Windows: Task Scheduler
  • run autosubmit through the same in-process submit engine as interactive submit
  • keep autosubmit runs quiet with lock / rollback / degraded-status / orphan-scheduler / minimal-log coverage

Notes

  • autosubmit run performs a manual one-shot due check using the saved config
  • invalid persisted autosubmit payloads degrade status without discarding unrelated settings
  • follow-up fixes align cron scheduling to the local minute-of-hour and keep the README --no-spinner example copy-paste safe
  • latest main has been merged into this branch to keep the PR conflict-free against the current base

Validation

  • cargo test -p tokscale-cli
  • cargo run -p tokscale-cli -- submit --help
  • cargo run -p tokscale-cli -- autosubmit enable --help
  • cargo run -p tokscale-cli -- autosubmit status
  • cargo run -p tokscale-cli -- autosubmit disable
  • rejected invocation: cargo run -p tokscale-cli -- autosubmit enable --interval 2h --dry-run
  • optional platform smoke test:
    • enable
    • status
    • scheduler inspection (launchctl / systemctl --user / schtasks)
    • disable

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 21, 2026

@dmego is attempting to deploy a commit to the Inevitable Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

5 issues found across 9 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/tokscale-cli/src/tui/settings.rs">

<violation number="1" location="crates/tokscale-cli/src/tui/settings.rs:33">
P2: Using command-layer `AutosubmitConfig` directly in settings creates brittle serialization that can silently reset all user settings on schema changes. The type lacks serde defaults, and `load()` uses `unwrap_or_default()` which discards all settings (not just autosubmit) if any field fails to deserialize. Consider adding serde defaults to `AutosubmitConfig` fields or using a separate settings-layer DTO with explicit migration/validation logic.</violation>
</file>

<file name="crates/tokscale-cli/src/main.rs">

<violation number="1" location="crates/tokscale-cli/src/main.rs:898">
P1: Add #[serde(default)] to all boolean fields in SubmitFilterArgs to prevent deserialization failures when config fields are missing</violation>
</file>

<file name="crates/tokscale-cli/src/commands/autosubmit.rs">

<violation number="1" location="crates/tokscale-cli/src/commands/autosubmit.rs:134">
P2: Unbounded interval values may cause chrono timestamp overflow/panic. The `parse_interval_spec` function accepts any u32 value without upper bound validation. Values like u32::MAX days (~4.3 billion days, ~11.7 million years) exceed chrono's DateTime representable range and will cause a panic when added to a timestamp in `is_due()`. Consider enforcing a reasonable maximum interval (e.g., 365 days or 10 years) during parsing.</violation>

<violation number="2" location="crates/tokscale-cli/src/commands/autosubmit.rs:704">
P2: Duplicate manual flag mappings in submit_args_to_cli_args and format_submit_args can diverge from SubmitFilterArgs definitions, causing autosubmit behavior mismatches</violation>
</file>

<file name="README.ja.md">

<violation number="1" location="README.ja.md:433">
P2: Missing `autosubmit run` command in Japanese README documentation. The autosubmit feature supports commands `enable|disable|status|run` but the Japanese documentation only lists `enable`, `status`, and `disable`, making the `run` command undiscoverable for Japanese users who rely on localized documentation.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread crates/tokscale-cli/src/main.rs
Comment thread crates/tokscale-cli/src/tui/settings.rs
Comment thread crates/tokscale-cli/src/commands/autosubmit.rs Outdated
Comment thread crates/tokscale-cli/src/commands/autosubmit.rs
Comment thread README.ja.md
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 7 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="README.ko.md">

<violation number="1" location="README.ko.md:440">
P3: Autosubmit docs are internally inconsistent: the synopsis omits `tokscale autosubmit run` while the added bullet claims it exists.</violation>
</file>

<file name="README.md">

<violation number="1" location="README.md:443">
P2: README autosubmit synopsis is internally inconsistent: it omits the documented `autosubmit run` subcommand, which can mislead users about available CLI commands.</violation>
</file>

<file name="README.ja.md">

<violation number="1" location="README.ja.md:441">
P2: Autosubmit docs are internally inconsistent: `run` is documented in bullets but missing from the command synopsis block.</violation>
</file>

<file name="crates/tokscale-cli/src/tui/settings.rs">

<violation number="1" location="crates/tokscale-cli/src/tui/settings.rs:76">
P1: `Settings::load()` now drops `autosubmit` on any strict-load failure, which can silently disable and later persistently erase autosubmit config.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread crates/tokscale-cli/src/tui/settings.rs Outdated
Comment thread README.md
Comment thread README.ja.md
Comment thread README.ko.md
Copilot AI and others added 3 commits April 20, 2026 10:21
Co-authored-by: dmego <22118976+dmego@users.noreply.github.com>
Resolve `main` merge conflicts for autosubmit scheduling branch
Copilot AI review requested due to automatic review settings April 20, 2026 12:30
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tokscale Ignored Ignored Preview Apr 22, 2026 11:13am

Request Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an autosubmit feature to the tokscale CLI to schedule and run automatic submit operations cross‑platform, persisting configuration in settings.json and reporting scheduler state via status.

Changes:

  • Introduces tokscale autosubmit enable|disable|status|run, including scheduler integration (launchd/systemd-user+cron/Task Scheduler).
  • Refactors submit flags into serializable argument structs and adds machine-readable submit error extraction for autosubmit failure reasons.
  • Updates settings loading/saving to be lenient around invalid autosubmit configs and expands CLI/docs/test coverage for the new commands.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/tokscale-cli/tests/cli_tests.rs Adds integration tests covering autosubmit help/contracts/status/disable/run minimal logging.
crates/tokscale-cli/src/tui/settings.rs Adds persisted autosubmit config support with lenient parsing and invalid-config preservation.
crates/tokscale-cli/src/main.rs Refactors submit args for serialization; adds autosubmit command wiring + machine-readable submit error prefix.
crates/tokscale-cli/src/commands/mod.rs Exposes the new autosubmit command module.
crates/tokscale-cli/src/commands/autosubmit.rs Implements autosubmit config, scheduler install/probe/uninstall, run locking, and status/degraded logic.
README.md Documents autosubmit usage and CLI flag expectations.
README.zh-cn.md Documents autosubmit usage (ZH-CN).
README.ko.md Documents autosubmit usage (KO).
README.ja.md Documents autosubmit usage (JA).
Cargo.lock Bumps crate versions for the release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/tokscale-cli/src/tui/settings.rs
Comment thread README.md Outdated
Comment thread crates/tokscale-cli/src/commands/autosubmit.rs Outdated
Comment thread crates/tokscale-cli/src/commands/autosubmit.rs Outdated
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.

Feature: Auto-submit

4 participants