feat(observability): count orphaned pending task cancellations#751
Draft
aparajon wants to merge 1 commit into
Draft
feat(observability): count orphaned pending task cancellations#751aparajon wants to merge 1 commit into
aparajon wants to merge 1 commit into
Conversation
The conflict-check sweep that cancels a pending task whose apply already settled self-heals the database, but each cancellation means something upstream left a task behind on a settled apply. Count both outcomes — "cancelled" and the fail-closed "write_failed" — so operators can spot a spike and investigate the source instead of relying on log searches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds operator-facing observability around the orphaned-pending-task cancellation sweep in the local/tern conflict check, so spikes in this self-healing behavior are visible via metrics (rather than only discoverable via logs).
Changes:
- Adds a new counter metric
schemabot.orphaned_task_cancel_totalwith boundedoutcomevalues (cancelled,write_failed) and tags it withdatabaseandenvironment. - Emits the metric from the orphaned pending task cancellation path in the conflict check.
- Documents the new metric in the metrics README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/tern/local_apply.go | Records the new orphaned-task cancellation metric on success and on durable-write failure. |
| pkg/metrics/metrics.go | Defines RecordOrphanedTaskCancel and bounds outcome cardinality. |
| pkg/metrics/README.md | Adds the new metric to the published metrics table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why this matters
The conflict check now cancels pending tasks whose apply already reached a terminal state so they stop blocking new applies. That sweep self-heals the database, but every cancellation means something upstream settled an apply while leaving its task pending — a signal operators should see spike and investigate, not discover through log searches.
What it does
schemabot.orphaned_task_cancel_totalcounter (database, environment, outcome) recorded by the conflict-check sweep, with outcomescancelled(orphan durably cancelled) andwrite_failed(cancellation write failed, task kept blocking fail-closed).Follow-up observability for the orphaned-task sweep introduced in #750.
🤖 Generated with Claude Code