forked from kunchenguid/firstmate
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(watch): add staleness auto-close for idle ship tasks #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c10a21c
feat(watch,teardown): staleness auto-close for idle>2h ship tasks
trillium 2af1794
no-mistakes(review): placeholder - waiting for test results before fi…
trillium f5ffca7
no-mistakes(review): Reorder staleness auto-close check to short-circ…
trillium 6ae2058
no-mistakes(review): {"summary": "Run staleness reclaim during afk wi…
trillium 254f492
no-mistakes(review): {"summary": "Clear staleness auto-close retries …
trillium 045bed0
no-mistakes(review): Skip staleness auto-close when parked at needs-d…
trillium 686b2c5
no-mistakes(review): Throttle post-threshold provably-working check t…
trillium 1565b46
no-mistakes(document): Document idle>2h staleness auto-close: new scr…
trillium 1f672a1
fix: address CodeRabbit review on PR #27
trillium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/usr/bin/env bash | ||
| # File a triage bead into the `staleness` federated store for a task whose | ||
| # expensive live process was just reclaimed by bin/fm-watch.sh's idle>2h | ||
| # backstop because its worktree still holds unlanded work. Called only from | ||
| # bin/fm-teardown.sh's staleness_chat_only_teardown, after work_is_landed has | ||
| # already returned false for the task's branch. | ||
| # Fail-open by design, matching bin/fm-bead-stamp.sh: a missing `staleness` CLI | ||
| # or a create call it rejects warns on stderr and exits 0 so a triage-filing | ||
| # problem never blocks or fails the reclaim that is already under way. | ||
| # Usage: fm-staleness-file.sh <task-id> <purpose> <worktree> <branch> <project> <harness> <idle-since-epoch> <change-summary> | ||
| set -u | ||
|
|
||
| ID=${1-} | ||
| PURPOSE=${2-} | ||
| WORKTREE=${3-} | ||
| BRANCH=${4-} | ||
| PROJECT=${5-} | ||
| HARNESS=${6-unknown} | ||
| IDLE_SINCE=${7-} | ||
| SUMMARY=${8-} | ||
|
|
||
| if [ -z "$ID" ] || [ -z "$WORKTREE" ]; then | ||
| echo "warning: fm-staleness-file.sh needs at least a task id and worktree, skipping" >&2 | ||
| exit 0 | ||
| fi | ||
|
|
||
| if ! command -v staleness >/dev/null 2>&1; then | ||
| echo "warning: staleness CLI not found on PATH, could not file $ID for triage" >&2 | ||
| exit 0 | ||
| fi | ||
|
|
||
| idle_human=$IDLE_SINCE | ||
| case "$IDLE_SINCE" in | ||
| '') idle_human=unknown ;; | ||
| *[!0-9]*) ;; | ||
| *) idle_human=$(date -r "$IDLE_SINCE" 2>/dev/null || date -d "@$IDLE_SINCE" 2>/dev/null || echo "$IDLE_SINCE") ;; | ||
| esac | ||
|
|
||
| body=$(printf 'task: %s\npurpose: %s\nworktree: %s\nbranch: %s\nproject: %s\nharness: %s\nidle since: %s\n\n%s\n' \ | ||
| "$ID" "${PURPOSE:-unknown}" "$WORKTREE" "${BRANCH:-unknown}" "${PROJECT:-unknown}" "$HARNESS" \ | ||
| "$idle_human" "${SUMMARY:-<no change summary>}") | ||
|
|
||
| bead_id=$(staleness create "Stale task $ID: ${BRANCH:-unknown branch}" \ | ||
| --description "$body" --labels staleness-autoclose --silent) || { | ||
| echo "warning: could not file staleness bead for $ID (see stderr above)" >&2 | ||
| exit 0 | ||
| } | ||
| echo "filed staleness bead $bead_id for $ID" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.