Skip to content

Separate the cronjobs view by repository #1825

Closed

Description

@JacobStephens2

This was generated by AI during triage.

Problem

On /cronjobs (thirdshift cronjobs / thirdshift cronjobs --json), all thirdshift crontab entries are currently rendered together in a single flat <pre class="crontab"> listing in crontab line order. When a host schedules Passes across multiple repositories (for example Educational-Travel-Adventures/manager-tourbots, Educational-Travel-Adventures/orchestration, and JacobStephens2/thirdshift), their lines can be interleaved, making it hard to quickly answer:

  1. Which repositories are handled by thirdshift cron jobs on this host?
  2. For each repository, what specific cron jobs run for it?

Reorganize the crontab view so entries are separated into per-repository sections (e.g., a section for manager-tourbots cron jobs, a section for thirdshift cron jobs, etc.).

Codebase Context

  • src/cronjobs.rs — reads crontab -l and builds CronJobs { jobs: Vec<CronJob>, pass_starts: Vec<PassStart> }, plus cronjobs::show(json) for thirdshift cronjobs [--json].
  • src/launch_directories.rs — already parses literal cd <path> && ... thirdshift ... from crontab commands (cron_directory / resolve) without executing shell text, resolving <path>'s remote.origin.url to <owner>/<repo>.
  • src/console/cronjobs.rs & src/console/cronjobs.html — serves /cronjobs and /api/v1/cronjobs.
  • src/console/openapi.rs — OpenAPI schema for /api/v1/cronjobs.
  • docs/guide.md (and generated site/docs/index.html) — currently states "Cron commands are displayed without execution or repository inference."
  • Tests: tests/console/cronjobs.rs and console/tests/cronjobs.test.cjs.

Open Design Questions (Round 1)

  1. Q1 — Identifying a cron entry's repository and handling unassociated entries:

    • (a) Recommended: Resolve literal cd <path> && ... to <owner>/<repo> when <path> is a readable GitHub checkout (repository: Some("owner/repo")), and place any entry whose repository cannot be resolved (repository: None, e.g. @reboot thirdshift secure base main or a missing checkout path) into a trailing Other section so no thirdshift crontab entry is hidden.
    • (b) Fall back to the literal <path> string when cd <path> && is present but not a readable local GitHub checkout, and use Other only when there is no cd <path> &&.
  2. Q2 — Ordering of repository sections and jobs within each section:

    • (a) Recommended: Sort repository sections alphabetically by <owner>/<repo> (matching pass_starts and launch-directories, with Other last), and preserve crontab line order within each repository section.
    • (b) Order repository sections by first appearance in the crontab, preserving crontab line order within each section.
  3. Q3 — Page structure on /cronjobs:

    • (a) Recommended: Separate the crontab area at the top into one section per repository — each with a repository heading (<owner>/<repo>) and its own terminal-style <pre class="crontab"> block — while keeping Run Passes now and Last fired by repository as their own sections below.
    • (b) Combine everything into one section per repository (showing that repository's <pre class="crontab">, its Run now buttons, and its Last fired times together under the repository heading).
  4. Q4 — CLI (thirdshift cronjobs) and JSON (thirdshift cronjobs --json / /api/v1/cronjobs) shape:

    • (a) Recommended: Add "repository": "owner/repo" (or null for Other) to each entry in jobs (sorted by repository group), and group plain-text thirdshift cronjobs output under each repository heading before the last fired lines.
    • (b) Replace or nest jobs inside a repositories: [{ repository, jobs }] array in JSON.

Activity

  1. added
    enhancement
    needs-triage
    on Nov 6, 2026
  2. JacobStephens2 commented on Nov 10, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation of #1969 on main at 9eea88c confirms this issue covers the machine-local portion of the requested Fleet schedule overview. CronJob still contains only schedule and command (src/cronjobs.rs:17-20), while src/console/cronjobs.rs:30-56 selects one machine and the template renders a flat list. Proposed split: keep repository association/grouping here and retain Fleet aggregation in #1969, consuming the owning machine's enriched inventory. Reuse the literal parsing and origin resolution in src/launch_directories.rs; preserve unresolved entries, and keep configured schedules distinct from observed pass_starts. This is a proposed boundary pending the Day shift questionnaire on #1969.

  3. JacobStephens2 commented on Nov 10, 2026

    @JacobStephens2
    OwnerAuthor

    Scope for this issue is settled in my answers on #1969: #1969 (comment). This issue is the machine-local repository grouping, with the defaults listed in answer 1. #1969 builds the Fleet view on top of it and is blocked by this issue.

  4. added
    in-progress
    and removed
    needs-triage
    on Nov 10, 2026
  5. JacobStephens2 commented on Nov 10, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Implement machine-local repository grouping for thirdshift cronjobs, thirdshift cronjobs --json, /cronjobs and /api/v1/cronjobs.

    Settled scope

    The maintainer explicitly accepted the defaults in #1969 (comment), referenced by the supplied Trusted-account comment on #1825. No questionnaire remains necessary. This issue supplies the machine-local inventory; #1969 handles Fleet aggregation afterwards.

    Confirmed evidence

    On selected Base branch main at 02c9654:

    • src/cronjobs.rs:17-20 defines each CronJob with only schedule and command. jobs() preserves crontab order, and show() prints a flat listing.
    • src/console/cronjobs.html:11-12 renders every job in one crontab block. src/console/cronjobs.rs:30-56 loads the local inventory or one selected machine's inventory.
    • src/launch_directories.rs:60-126 already resolves GitHub checkout origins and parses literal cd-based commands without executing shell text.
    • src/console/openapi.rs:235-237 documents jobs containing schedule and command only. docs/guide.md:170 explicitly says repository inference is absent.

    Required behavior

    1. Associate an entry with owner/repo when its literal cd Launch directory resolves to a readable GitHub checkout. Reuse the existing literal parser and origin resolution. Preserve every recognized thirdshift entry even when association fails; missing paths, non-GitHub origins, shell expressions and commands without a resolvable directory receive repository null and remain visible under Other. Never execute cron command text.
    2. Sort repository groups alphabetically by full owner/repo, preserve original crontab order within each group, and place Other last. Retain duplicate jobs.
    3. Keep the existing JSON object and flat jobs array. Add nullable repository metadata to each job and return jobs in group order, preserving schedule and command. CLI and API must agree. Keep pass_starts as independent observed execution evidence.
    4. Print repository headings in plain-text output. On the page, render a heading and terminal-style crontab block for each nonempty group. Keep Run Passes now and Last fired by repository separate below the schedule groups. Preserve empty/error states, escaped one-line command display, keyboard scrolling and phone layout.
    5. Resolve paths on the owning machine. Existing remote page rendering must consume its inventory without resolving those paths locally; tolerate older inventories missing repository metadata. Preserve the existing read/run authorization behavior.

    Implementation guidance

    Share per-command association independently of inventory discovery: launch_directories::load() already calls cronjobs::jobs(), so calling that loader from job enrichment would recurse. Do not use the stricter Run now argument parser as the only repository detector; displayable jobs need association even when they cannot become Run now requests.

    Validation and documentation

    Extend tests/console/cronjobs.rs with interleaved entries from two temporary GitHub checkouts, multiple checkouts of one repository, unresolved entries, stable within-group ordering, duplicate retention and CLI/API/page agreement. Cover literal quoted/home paths and nonexecution of substitutions using the existing patterns in tests/console/start.rs:263-365. Preserve crontab error handling, percent/stdin handling, last-fired behavior and read/run scope tests. Update console/tests/cronjobs.test.cjs for multiple accessible groups while retaining its desktop/phone, JavaScript-disabled, escaping and scrolling checks. Cover older remote payloads without repository metadata.

    Update OpenAPI and docs/guide.md, regenerate the manual with npm run docs --prefix site, and update affected hand-written site descriptions, including site/how-it-works/index.html:203. Run focused Console tests and browser checks, then scripts/affected-tests main.

    Investigation validation: the focused Rust test command could not start because cargo is unavailable. Static inspection confirms the feature is absent; runtime behavior was not reproduced. scripts/affected-tests main passed with 'No changed files; no affected tests.'

  6. added
    ready-for-agent
    in-progress
    and removed
    in-progress
    ready-for-agent
    on Nov 10, 2026
  7. removed
    in-progress
    on Nov 10, 2026
  8. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Withdrawn, posted in error. #1825 was not folded into #1969: it was implemented in PR #1981 and closed, and #1969 builds on it as decided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions