Skip to content

feat(agents): incident-auto-cleanup-phase1 - #11

Merged
mashkovd merged 2 commits into
mainfrom
feat/agents-incident-auto-cleanup-phase1
May 6, 2026
Merged

mashkovd merged 2 commits into
mainfrom
feat/agents-incident-auto-cleanup-phase1

Conversation

@mashkovd

@mashkovd mashkovd commented May 6, 2026

Copy link
Copy Markdown
Member

Implements accepted proposal mctl-agent/incident-auto-cleanup-phase1.

Spec: https://github.com/mctlhq/mctl-gitops/tree/main/platform-gitops/agents-state/mctl-agent/proposals/incident-auto-cleanup-phase1/

Generated by mctl-agents Tier 2 implementer. Review carefully — this PR was opened automatically and the spec may have gaps.

Extend the stale-ticket GC to auto-resolve incidents stuck in
StatusAnalyzing (default 48h) and StatusFixProposed (default 168h),
in addition to the existing StatusOpen (24h) pass.

Adds AUTO_RESOLVE_ANALYZING_AFTER and AUTO_RESOLVE_FIX_PROPOSED_AFTER
env vars with safe defaults. Each auto-resolution appends a structured
reason string to the ticket's analysis field for audit purposes.

Proposal: platform-gitops/agents-state/mctl-agent/proposals/incident-auto-cleanup-phase1/

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27b1e3ce4b

ℹ️ 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".

Comment on lines +253 to +257
thresholds := map[string]time.Duration{
ticket.StatusOpen: p.StaleAfter,
ticket.StatusAnalyzing: p.AnalyzingAfter,
ticket.StatusFixProposed: p.FixProposedAfter,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow status-specific TTL GC when open-ticket TTL is disabled

resolveStale now defines separate thresholds for analyzing and fix_proposed, but this path is still gated by an early p.StaleAfter <= 0 return. If an operator sets AUTO_RESOLVE_STALE_AFTER=0 to disable only open-ticket cleanup while keeping AUTO_RESOLVE_ANALYZING_AFTER/AUTO_RESOLVE_FIX_PROPOSED_AFTER enabled, those newer GC passes never run, which contradicts the per-status configuration implied by this change.

Useful? React with 👍 / 👎.

@mashkovd

mashkovd commented May 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@mashkovd

mashkovd commented May 6, 2026

Copy link
Copy Markdown
Member Author

@copilot review

Codex P2 on PR #11: the early-return at the top of resolveStale was
gated on p.StaleAfter <= 0 alone, which short-circuited the entire
function. Operators setting AUTO_RESOLVE_STALE_AFTER=0 to disable
only open-ticket cleanup would also disable AUTO_RESOLVE_ANALYZING_AFTER
and AUTO_RESOLVE_FIX_PROPOSED_AFTER GC passes — contradicting the
per-status configuration.

Gate the early return on all three thresholds being zero. The per-status
cutoff <= 0 check inside the loop already skips disabled statuses
individually.
@mashkovd

mashkovd commented May 6, 2026

Copy link
Copy Markdown
Member Author

Fixed P2 finding from Codex (early-return short-circuit) in a1ac0a2 — resolveStale now only short-circuits when all three TTL thresholds are zero. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ 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".

@mashkovd
mashkovd merged commit 4ad5afb into main May 6, 2026
1 check passed
@mashkovd
mashkovd deleted the feat/agents-incident-auto-cleanup-phase1 branch May 6, 2026 20:30
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.

1 participant