Skip to content

fix(observability): name the engine's own settle counts apart from the command's - #971

Draft
aparajon wants to merge 2 commits into
mainfrom
armand/engine-count-log-keys
Draft

fix(observability): name the engine's own settle counts apart from the command's#971
aparajon wants to merge 2 commits into
mainfrom
armand/engine-count-log-keys

Conversation

@aparajon

@aparajon aparajon commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Why this matters

During a cancel, two different numbers appear under the same key names a line apart in the logs. The command's counts say how many tasks the operator's request selected; the engine's say how many it settled in this attempt — routinely zero when the engine defers to the apply owner. Reading the engine's zero as the command's is how an operator concludes a cancel did nothing when it is simply still queued.

What it does

  • Reports the engine's own counts under engine_-prefixed keys on both the cancel and stop immediate-settle paths, so a zero there reads as "the engine deferred to the apply owner" rather than "the command selected nothing".
  • Documents on each helper which counts it is reporting and why they are named apart.

The doc-comment ambiguity exists identically on both paths, so fixing only the one that was reported would have left the other reading the same way.

🤖 Generated with Claude Code

…e command's

A cancel writes two log lines a hop apart that both carry cancelled_count and
skipped_count meaning different things. The command's counts say how many tasks
the operator's request selected; the engine's say how many it settled in the
immediate attempt, routinely zero because the engine defers to the apply owner.
Read together during triage, a zero looks like a cancel that selected nothing
rather than one that is still queued and working.

The engine's counts now log under engine_cancelled_count / engine_stopped_count
/ engine_skipped_count on both the cancel and stop immediate-attempt paths, so
the two sets can never be mistaken for each other in a log search.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Clarifies observability during stop/cancel control operations by disambiguating “command-selected” task counts from “engine-settled” task counts in logs, reducing operator confusion when the engine legitimately defers work to the apply owner.

Changes:

  • Renames immediate-settle log fields on the stop path to engine_*-prefixed keys.
  • Renames immediate-settle log fields on the cancel path to engine_*-prefixed keys.
  • Adds a test asserting the cancel path logs use engine_* keys (and do not reuse the command-level key names).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/api/control_handlers.go Renames immediate-settle log keys for stop/cancel and documents why engine vs command counts must be named apart.
pkg/api/control_handlers_test.go Adds coverage asserting cancel immediate-settle logs use engine_*-prefixed count keys.

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

Comment thread pkg/api/control_handlers_test.go
The stop path carries the same key collision the cancel test covers, and only
cancel was pinned. A stop the engine declines is where an operator is most
likely to read the engine's counts next to the command's, so assert that line
reports engine_stopped_count / engine_skipped_count and never the command's
key names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants