fix: execution limits, checkpoints, local issue handling, and shellcheck fix #4

Merged
rileyseaburg merged 3 commits from fix/execution-limits-and-checkpoints into main 2026-04-30 21:56:04 +00:00
rileyseaburg commented 2026-04-30 21:51:50 +00:00 (Migrated from github.com)

Summary

Clean replacement for PR #2 (which had merge conflicts and a shellcheck parse error).

Changes

  • Execution limits: max_steps 30→50, task_wait_seconds 1200→3600
  • Server dispatch metadata: Passes max_steps and task_timeout_seconds to server-side agent
  • Checkpoint system: checkpoint() function with elapsed time and remaining budget tracking
  • Emergency push: emergency_push_and_exit() for time budget exhaustion
  • Local issue handling: handle_issue_local() — full branch→edit→commit→push→PR workflow in local mode
  • New input: timeout_minutes in action.yml
  • Bug fix: Shellcheck parse error in CODETETHER_TIME_BUDGET arithmetic expression

Bug Fixed

$((INPUT_TIMEOUT_MINUTES:-30) * 60)) had mismatched parentheses — replaced with $(( INPUT_TIMEOUT_MINUTES * 60 )) (INPUT_TIMEOUT_MINUTES defaults via action.yml).

CI

Shellcheck now passes with zero errors (only pre-existing warnings/info).

## Summary Clean replacement for PR #2 (which had merge conflicts and a shellcheck parse error). ### Changes - **Execution limits**: `max_steps` 30→50, `task_wait_seconds` 1200→3600 - **Server dispatch metadata**: Passes `max_steps` and `task_timeout_seconds` to server-side agent - **Checkpoint system**: `checkpoint()` function with elapsed time and remaining budget tracking - **Emergency push**: `emergency_push_and_exit()` for time budget exhaustion - **Local issue handling**: `handle_issue_local()` — full branch→edit→commit→push→PR workflow in local mode - **New input**: `timeout_minutes` in action.yml - **Bug fix**: Shellcheck parse error in `CODETETHER_TIME_BUDGET` arithmetic expression ### Bug Fixed `$((INPUT_TIMEOUT_MINUTES:-30) * 60))` had mismatched parentheses — replaced with `$(( INPUT_TIMEOUT_MINUTES * 60 ))` (INPUT_TIMEOUT_MINUTES defaults via action.yml). ### CI Shellcheck now passes with zero errors (only pre-existing warnings/info).
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-04-30 21:55:24 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR updates the CodeTether GitHub Action to increase execution budgets, add structured “checkpoint” logging for time/budget awareness, and expand local-mode support to handle Issues end-to-end (branch → edit → commit → push → PR).

Changes:

  • Increased execution limits and propagated max_steps/task_timeout_seconds into server dispatch metadata.
  • Added checkpoint() (elapsed/remaining budget logging) and integrated checkpoints across server/local/GitHub helpers.
  • Added a new local-mode issue workflow (handle_issue_local) and a new timeout_minutes action input intended for job-level budgeting.

Reviewed changes

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

Show a summary per file
File Description
action/lib/server.sh Adds checkpoint breadcrumbs and includes max steps / timeout in dispatch metadata.
action/lib/local.sh Adds checkpoints around local execution and PR fix workflow steps.
action/lib/issue.sh New local-mode issue handler implementing branch→edit→commit→push→PR.
action/lib/github.sh Adds checkpoints around GitHub API calls and push verification.
action/lib/common.sh Introduces time budget tracking, checkpoint(), and emergency push helper; adds finalize checkpoint.
action/entrypoint.sh Wires in issue handler and adds checkpoints to main routing paths.
action.yml Raises defaults (max_steps, task_wait_seconds) and adds new timeout_minutes input.

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

## Pull request overview This PR updates the CodeTether GitHub Action to increase execution budgets, add structured “checkpoint” logging for time/budget awareness, and expand local-mode support to handle Issues end-to-end (branch → edit → commit → push → PR). **Changes:** - Increased execution limits and propagated `max_steps`/`task_timeout_seconds` into server dispatch metadata. - Added `checkpoint()` (elapsed/remaining budget logging) and integrated checkpoints across server/local/GitHub helpers. - Added a new local-mode issue workflow (`handle_issue_local`) and a new `timeout_minutes` action input intended for job-level budgeting. ### Reviewed changes Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | action/lib/server.sh | Adds checkpoint breadcrumbs and includes max steps / timeout in dispatch metadata. | | action/lib/local.sh | Adds checkpoints around local execution and PR fix workflow steps. | | action/lib/issue.sh | New local-mode issue handler implementing branch→edit→commit→push→PR. | | action/lib/github.sh | Adds checkpoints around GitHub API calls and push verification. | | action/lib/common.sh | Introduces time budget tracking, `checkpoint()`, and emergency push helper; adds finalize checkpoint. | | action/entrypoint.sh | Wires in issue handler and adds checkpoints to main routing paths. | | action.yml | Raises defaults (`max_steps`, `task_wait_seconds`) and adds new `timeout_minutes` input. | </details> --- 💡 <a href="/rileyseaburg/codetether-action/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -70,4 +75,3 @@
default: "1200"
version:
description: "CodeTether version to install (local mode only)"
required: false
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-30 21:55:24 +00:00

The new timeout_minutes input isn’t currently exported to the runtime environment for the bash scripts (there is no INPUT_TIMEOUT_MINUTES in the Run review step env). Since common.sh now consumes INPUT_TIMEOUT_MINUTES under set -u, the action will crash at startup unless this env var is wired through.

The new `timeout_minutes` input isn’t currently exported to the runtime environment for the bash scripts (there is no `INPUT_TIMEOUT_MINUTES` in the `Run review` step env). Since `common.sh` now consumes `INPUT_TIMEOUT_MINUTES` under `set -u`, the action will crash at startup unless this env var is wired through.
@ -137,6 +142,7 @@ ${review_text}"
log_info "Response posted to Issue #${PR_NUMBER}"
fi
fi
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-30 21:55:23 +00:00

handle_issue_local() always terminates the process via exit on all paths, so the return $? immediately after calling it is unreachable. Either have handle_issue_local return a status instead of exiting, or just call it without return to keep control flow clear.

`handle_issue_local()` always terminates the process via `exit` on all paths, so the `return $?` immediately after calling it is unreachable. Either have `handle_issue_local` return a status instead of exiting, or just call it without `return` to keep control flow clear.
@ -42,0 +44,4 @@
CODETETHER_START_EPOCH="${CODETETHER_START_EPOCH:-$(date +%s)}"
# Default budget in seconds (GitHub Actions job timeout, configurable)
# INPUT_TIMEOUT_MINUTES defaults to 30 via action.yml; guard for non-Actions contexts.
INPUT_TIMEOUT_MINUTES="${INPUT_TIMEOUT_MINUTES:-30}"
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-30 21:55:24 +00:00

common.sh runs with set -u, but CODETETHER_TIME_BUDGET is computed from INPUT_TIMEOUT_MINUTES without a default expansion. If INPUT_TIMEOUT_MINUTES is not exported (it currently isn’t in action.yml’s Run review env), sourcing this file will fail with an “unbound variable” error. Use a safe default (e.g., ${INPUT_TIMEOUT_MINUTES:-30}) and/or validate it is numeric before arithmetic expansion.

`common.sh` runs with `set -u`, but `CODETETHER_TIME_BUDGET` is computed from `INPUT_TIMEOUT_MINUTES` without a default expansion. If `INPUT_TIMEOUT_MINUTES` is not exported (it currently isn’t in `action.yml`’s Run review env), sourcing this file will fail with an “unbound variable” error. Use a safe default (e.g., `${INPUT_TIMEOUT_MINUTES:-30}`) and/or validate it is numeric before arithmetic expansion.
@ -48,0 +67,4 @@
echo "::error::$(github_actions_escape "$raw_msg")"
}
# ── Debug checkpoint with elapsed time and remaining budget ─────
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-30 21:55:24 +00:00

checkpoint() computes ts but never uses it (the log line uses date -Iseconds instead). This is dead code; remove ts or switch the message to use it to avoid confusion and keep shellcheck clean.

`checkpoint()` computes `ts` but never uses it (the log line uses `date -Iseconds` instead). This is dead code; remove `ts` or switch the message to use it to avoid confusion and keep shellcheck clean.
@ -48,0 +108,4 @@
log_warn "EMERGENCY PUSH: ${reason}"
# Stage any uncommitted changes
if [ -n "$(git status --short 2>/dev/null)" ]; then
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-30 21:55:24 +00:00

emergency_push_and_exit() is documented (and named) as if it will exit after attempting the push, but it currently only logs and returns to the caller. Either make it actually terminate (exit with a non-zero code or a provided code) or rename/update the docstring to match the current behavior so callers don’t assume it stops execution.

`emergency_push_and_exit()` is documented (and named) as if it will exit after attempting the push, but it currently only logs and returns to the caller. Either make it actually terminate (exit with a non-zero code or a provided code) or rename/update the docstring to match the current behavior so callers don’t assume it stops execution.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-04-30 21:55:23 +00:00

In poll_task_result(), the comment says checkpoints are logged every 10 polls to avoid log spam, but the else branch still logs a line on every poll via tee -a. If the intent is to reduce log volume during long waits, consider only logging on the checkpoint cadence (or gate per-poll logging behind a debug flag).

In `poll_task_result()`, the comment says checkpoints are logged every 10 polls to avoid log spam, but the `else` branch still logs a line on every poll via `tee -a`. If the intent is to reduce log volume during long waits, consider only logging on the checkpoint cadence (or gate per-poll logging behind a debug flag).
gemini-code-assist[bot] (Migrated from github.com) reviewed 2026-04-30 22:04:44 +00:00
gemini-code-assist[bot] (Migrated from github.com) left a comment

Code Review

This pull request introduces a checkpointing system and time-budget tracking to improve the observability of the action's execution. It refactors local-mode issue handling into a dedicated library that automates the branch-to-PR workflow and updates several default configuration values. A suggestion was made to harden the time budget calculation against unset variables to avoid shell errors.

## Code Review This pull request introduces a checkpointing system and time-budget tracking to improve the observability of the action's execution. It refactors local-mode issue handling into a dedicated library that automates the branch-to-PR workflow and updates several default configuration values. A suggestion was made to harden the time budget calculation against unset variables to avoid shell errors.
@ -42,0 +44,4 @@
CODETETHER_START_EPOCH="${CODETETHER_START_EPOCH:-$(date +%s)}"
# Default budget in seconds (GitHub Actions job timeout, configurable)
# INPUT_TIMEOUT_MINUTES defaults to 30 via action.yml; guard for non-Actions contexts.
INPUT_TIMEOUT_MINUTES="${INPUT_TIMEOUT_MINUTES:-30}"
gemini-code-assist[bot] (Migrated from github.com) commented 2026-04-30 22:04:44 +00:00

medium

The arithmetic expression for CODETETHER_TIME_BUDGET uses a variable that might be unset or empty. While the default is handled, it is safer to ensure INPUT_TIMEOUT_MINUTES is treated as an integer to avoid potential shell errors if it contains non-numeric characters.

CODETETHER_TIME_BUDGET="${CODETETHER_TIME_BUDGET:-$(( ${INPUT_TIMEOUT_MINUTES:-30} * 60 ))}"
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) The arithmetic expression for CODETETHER_TIME_BUDGET uses a variable that might be unset or empty. While the default is handled, it is safer to ensure INPUT_TIMEOUT_MINUTES is treated as an integer to avoid potential shell errors if it contains non-numeric characters. ```suggestion CODETETHER_TIME_BUDGET="${CODETETHER_TIME_BUDGET:-$(( ${INPUT_TIMEOUT_MINUTES:-30} * 60 ))}" ```
Sign in to join this conversation.
No description provided.