Feature/multi dimensional state - #1
Conversation
- Add scheduler_backend.py to handle job submission to `at` and job removal via `atrm`. - Introduce state_model.py to define job states and invariants for job submissions. - Create transitions.py to manage job state transitions and ensure immutability. - Develop test cases for execution, persistence, scheduler backend, state model, and transitions to ensure functionality and correctness. - Implement migration logic for legacy job formats to the new model.
…ate model visibility
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add before/after transition output to cli_reschedule_job, cli_change_session, cli_retry_job, and remove_job (non-interactive path). Each command now prints a structured header (e.g. "job1: rescheduled") plus contextual notes for at-job removal, execution state resets, and dependent job warnings. Added can_retry guard to cli_retry_job. Tests written first (TDD): 15 new tests, 220 total passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Print job_id/when header lines before calling apply_job_update in cli_reschedule_job so they appear even when resubmit fails. Add tests for cli_change_session running-job warning and cli_retry_job dependency note. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds `cli_cancel_job` and the `cancel <id>` subcommand, which marks a job as cancelled while keeping the record for audit trail. Guards against cancelling running or already-cancelled jobs; removes the at job when submission=scheduled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements cli_submit_job with guards for state, prompt file existence, and at scheduling errors, plus argparse/dispatch wiring. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…utation Replace the manual submission/at_job_id field mutation in apply_job_update's resubmit-failure path with a proper on_resubmit_failed transition function, ensuring all state changes go through the transition engine. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
load_jobs now catches invariant violations per record, returning
{"id": ..., "_invalid": True, "_error": ...} sentinels instead of
crashing. cli_show_job guards against sentinels with an actionable
error message. cancel_at_job now transitions jobs to submission=queued
(instead of leaving submission=scheduled with no at_job_id) to avoid
creating invariant-violating intermediate states.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…add past job indicator in CLI output
- Consolidated job state model tests into a more streamlined format. - Introduced new job creation and scheduling operations in `operations.py`. - Added utility functions for time handling in `time_utils.py`. - Enhanced test coverage for job transitions and state checks. - Implemented fixtures for testing with temporary directories. - Improved error handling and validation in job operations.
- Updated command building in `execution.py` for better formatting. - Enhanced import organization in `operations.py` for clarity. - Refactored job migration logic in `persistence.py` to improve readability. - Improved script generation in `scheduler_backend.py` for consistency. - Cleaned up state model definitions in `state_model.py`. - Streamlined time utility functions in `time_utils.py`. - Enhanced test structure and readability across multiple test files. - Added CI workflow for quality checks and automated testing. - Created Makefile for simplified development environment setup.
…ed detection and job modeling
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f88ffd371
ℹ️ 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".
| return "\n".join( | ||
| [ | ||
| f"cd {shlex.quote(job['cwd'])} || exit 1", | ||
| "export PATH=/usr/local/bin:/usr/bin:/bin", |
There was a problem hiding this comment.
Preserve user PATH for wrapper self-invocation
This script unconditionally resets PATH to system directories, but later in the same generated script it calls schedule-agent mark .... With the default install path (~/.local/bin), those mark commands are not resolvable under this PATH when at executes the job, so state transitions to running/done/failed can silently fail and jobs remain stuck as scheduled/missing. Keep the inherited PATH (or use an absolute path to the current schedule-agent binary) before invoking the mark subcommands.
Useful? React with 👍 / 👎.
| ) | ||
| migrated["created_at"] = migrated.get("created_at") or now_iso() | ||
| migrated["updated_at"] = ( | ||
| migrated.get("updated_at") or (legacy_state or {}).get("updated_at") or now_iso() |
There was a problem hiding this comment.
Normalize migrated legacy updated_at timestamps
migrate_job stores legacy_state.updated_at verbatim into updated_at, but downstream formatting/sorting expects strict ISO timestamps with timezone (%Y-%m-%dT%H:%M:%S%z). Legacy state from prior versions can contain non-ISO values (for example YYYY-MM-DD HH:MM:SS), which means upgraded jobs load as valid but then crash list/show paths when iso_to_display parses updated_at.
Useful? React with 👍 / 👎.
No description provided.