Skip to content

feat(cli): auto-submit scheduler (tokscale autosubmit) #698

@junhoyeo

Description

@junhoyeo

Background

PR #55 (@Yeachan-Heo) prototyped automatic periodic submission (tokscale sync + crontab) back when the CLI was TypeScript. The multi-device aggregation half of that PR shipped on main via the relational device model (#517/#593/#609), but the auto-submit scheduler was never re-implemented after the CLI moved to Rust. Issue #123 also requests this. PR #351 (@dmego) is a more recent, more complete take (launchd/systemd/schtasks) currently pending a direction decision.

Feature

A way to submit usage automatically on a schedule from the Rust CLI, e.g. tokscale autosubmit enable|status|disable.

Requirements (carried over from the #55 review round and the #351 review)

  • Lock against concurrent runs (lock file with token), so an overlapping scheduled run can't double-submit.
  • Safe scheduler-entry management: clean rollback if enable fails, orphan-entry detection, never inject into an existing user crontab line.
  • Unattended auth: rely on the existing token under ~/.config/tokscale; an expired token must fail quietly into autosubmit status (no hang, no interactive prompt).
  • Saved submit filters must be registry-driven (the canonical --client enum), not per-client booleans — those flags are deprecated and the roster grows.
  • Cross-platform: macOS launchd user agent, Linux systemd-user with cron fallback, Windows Task Scheduler.

Open product question

Whether tokscale should write OS scheduler entries at all, vs. a lighter approach (e.g. opportunistic submit on TUI launch when the last submit is stale). Decide before implementation.

Credit: @Yeachan-Heo (#55), @dmego (#351).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions