Skip to content

167 - Wait for aborted process exit before finalising schedule - #167

Merged
louis-pie merged 13 commits into
mainfrom
AP-2830-harden-pipelinewise-deploys
Aug 13, 2026
Merged

167 - Wait for aborted process exit before finalising schedule#167
louis-pie merged 13 commits into
mainfrom
AP-2830-harden-pipelinewise-deploys

Conversation

@louis-pie

@louis-pie louis-pie commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Related to AP-2830

Context

Cicada currently clears is_running and finalizes the schedule log immediately after abort_running sends SIGTERM, even though the launched process may still be running.

Refer to 0.10.4 CHANGELOG for full details.

Changes

  • Keep a schedule marked as running until its launched process has stopped.
  • Clear repeated abort requests while a process is stopping so they cannot affect the next run.
  • Continue supervising the process through temporary process-check and database failures.
  • Preserve the confirmed process return code and safely record diagnostic details.
  • Clear execution state and finalize the schedule log atomically after process exit.

Test coverage

  • Existing: 2 cases related to abort_running, 5 covering broader exec_schedule behaviour.
  • New: 6 cases directly covering abort_running, plus 15 supporting shutdown, error-handling, and database cases.
  • Updated: 1 existing abort_running case. It previously checked only the final log result; it now also confirms is_running and abort_running are cleared after the process exits.
  • Deleted: None.

Validation

  • make pytest: 162 passed, 79.72% coverage
  • make flake8: passed with 0 errors
  • make black: passed

Checklist

Copilot AI lite review requested due to automatic review settings August 10, 2026 19:02
@louis-pie
louis-pie requested a review from a team as a code owner August 10, 2026 19:02
@platon-github-app-production

Copy link
Copy Markdown

Comment /request-review to automatically request reviews from the following teams:

You can also request review from a specific team by commenting /request-review team-name, or you can add a description with --notes "<message>"

💡 If you see something that doesn't look right, check the configuration guide.

@wise-github-bot-app

Copy link
Copy Markdown

This is currently a non-blocking check, and it will not prevent your Pull Request from being merged.

The CODEOWNER of this repository has some untagged assets.

As this is a public repository, asset details will not be shown.

Copilot AI 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.

Pull request overview

Changes: Bugfix (1), Test improvement (1), Documentation update (1), Meta (1)

This PR updates exec_schedule to keep schedules marked as running until an aborted child process is confirmed exited, and to consume repeated abort_running requests during shutdown waits.

Changes:

  • Add consume_abort_running() and update the abort flow to wait for child exit before clearing is_running.
  • Add focused unit tests covering abort supervision and state transitions.
  • Update docs/config examples (YAML quoting for "*", abort semantics, ERD source link) and refresh repo guidance/changelog entries.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cicada/commands/exec_schedule.py Implements the “assume running until polled closed” behavior and consumes repeated abort requests while waiting.
tests/test_exec_schedule.py New unit tests validating abort wait semantics, repeated abort consumption, and state-clearing SQL.
tests/test_functional_main.py Fixes YAML for returncodes_alert and resets the Slack mock between loop iterations.
config/example.yml Updates example config to quote "*" so it parses as a string instead of YAML alias syntax.
README.md Documents updated abort behavior and links the editable ERD source.
docs/erd.excalidraw Adds the editable Excalidraw ERD source file.
CLAUDE.md Replaces prior content with authoritative repository guidance and workflow expectations.
CHANGELOG.md Adds a new 0.10.3 section describing the abort-running behavior and ERD source addition.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CHANGELOG.md
Comment thread cicada/commands/exec_schedule.py Outdated
@louis-pie
louis-pie marked this pull request as draft August 10, 2026 19:50
@louis-pie
louis-pie force-pushed the AP-2830-harden-pipelinewise-deploys branch 3 times, most recently from 9d297ff to 34ce074 Compare August 10, 2026 21:06
@louis-pie
louis-pie requested a balanced review from Copilot August 11, 2026 09:34

Copilot AI 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.

Pull request overview

Copilot reviewed 23 out of 25 changed files in this pull request and generated no new comments.

Suppressed comments (2)

.github/workflows/linter.yml:19

  • This job uses a GitHub-hosted runner, which violates the organization requirement that all workflow jobs run on self-hosted gha-production-* runners. The lint workload should use the standard production runner.
    runs-on: ubuntu-22.04

.github/workflows/pytest.yml:20

  • This job uses a GitHub-hosted runner, which violates the organization requirement that all workflow jobs run on self-hosted gha-production-* runners. Use the standard medium runner (or a larger approved tier if the Docker test workload requires it).
    runs-on: ubuntu-22.04

@louis-pie
louis-pie force-pushed the AP-2830-harden-pipelinewise-deploys branch 2 times, most recently from e1fb625 to d62b993 Compare August 11, 2026 13:36
@louis-pie louis-pie changed the title Assume child process as running until polled as closed Wait for child process exit after abort_running Aug 11, 2026
@louis-pie
louis-pie force-pushed the AP-2830-harden-pipelinewise-deploys branch from d62b993 to 46a4deb Compare August 12, 2026 08:38
@louis-pie
louis-pie marked this pull request as ready for review August 12, 2026 11:45
@platon-github-app-production

Copy link
Copy Markdown

Comment /request-review to automatically request reviews from the following teams:

You can also request review from a specific team by commenting /request-review team-name, or you can add a description with --notes "<message>"

💡 If you see something that doesn't look right, check the configuration guide.

@louis-pie
louis-pie requested a balanced review from Copilot August 12, 2026 11:53
@louis-pie
louis-pie enabled auto-merge (squash) August 12, 2026 11:53

Copilot AI 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.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (1)

cicada/commands/exec_schedule.py:283

  • Deliver the shutdown signal before checking abort_running. As written, a received SIGTERM/SIGQUIT is recorded here, but the next operation opens a database connection; because db_cicada() has no connect_timeout, a database outage can delay child termination for the connection timeout plus the retry sleep. This leaves the launched process running during supervisor shutdown. Terminate immediately once the shutdown request is observed, and retry a failed delivery before performing the database check.
            signal_number = shutdown_request["signal"]
            if signal_number is not None and requested_stop_result is None:
                requested_stop_result = ExecutionResult(-15, f"{signal.Signals(signal_number).name} received")

@louis-pie louis-pie changed the title Wait for child process exit after abort_running Wait for aborted process exit before finalising schedule Aug 12, 2026
@louis-pie louis-pie changed the title Wait for aborted process exit before finalising schedule 167 - Wait for aborted process exit before finalising schedule Aug 12, 2026
Comment thread cicada/commands/exec_schedule.py
@louis-pie
louis-pie force-pushed the AP-2830-harden-pipelinewise-deploys branch from d6b2f13 to 8614057 Compare August 13, 2026 09:45
@louis-pie
louis-pie merged commit 531f1a6 into main Aug 13, 2026
8 checks passed
@louis-pie
louis-pie deleted the AP-2830-harden-pipelinewise-deploys branch August 13, 2026 09:45
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.

3 participants