Skip to content

[codex] fix runtime guard stale log filtering - #282

Merged
Pigbibi merged 1 commit into
mainfrom
codex/fix-runtime-guard-stale-logs-20260702
Jul 1, 2026
Merged

[codex] fix runtime guard stale log filtering#282
Pigbibi merged 1 commit into
mainfrom
codex/fix-runtime-guard-stale-logs-20260702

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Ignore disabled runtime targets when deriving Cloud Run services from target JSON.
  • Filter Cloud Scheduler failures using the matching service's latest-ready revision window, consistent with Cloud Run log filtering.
  • Add regression coverage for disabled targets and scheduler stale-log filtering.

Test Plan

  • python3 -m pytest tests/test_cloud_run_runtime_guard.py -q
  • git diff --check

@Pigbibi
Pigbibi enabled auto-merge (squash) July 1, 2026 22:08
@Pigbibi
Pigbibi merged commit 1c59341 into main Jul 1, 2026
2 checks passed
@Pigbibi
Pigbibi deleted the codex/fix-runtime-guard-stale-logs-20260702 branch July 1, 2026 22:13

@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: ce9626be28

ℹ️ 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 +119 to +123
matches = [
service_since
for service, service_since in service_since_by_name.items()
if any(alias and alias in job_name for alias in _service_job_aliases(service))
]

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 Use exact scheduler job matches for revision windows

When two monitored services share a prefix, this substring check can associate a scheduler log with the wrong service window. For example, with foo-service and foo-bar-service, the foo-bar-scheduler job contains the foo alias, so max(matches) may pick foo-service's later ready-revision time and drop a real foo-bar scheduler failure as stale. Match against the expected scheduler job names or otherwise choose the service-specific alias unambiguously before filtering failures.

Useful? React with 👍 / 👎.

Comment on lines +218 to +221
text = str(value).strip().lower()
if not text:
return default
return text in {"1", "true", "yes", "y", "on"}

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 Reject invalid enabled flags instead of disabling targets

When a target has a non-empty RUNTIME_TARGET_ENABLED value outside the accepted boolean spellings, this returns False, so a typo such as treu silently removes that Cloud Run service from runtime-guard monitoring. Other configuration paths treat this flag as enabled by default and fail invalid values (scripts/build_cloud_run_env_sync_plan.py:378-386), so this should reject or ignore unknown values instead of suppressing alerts.

Useful? React with 👍 / 👎.

Comment on lines +226 to +230
for key in ("runtime_target_enabled", "RUNTIME_TARGET_ENABLED"):
if key in target:
return _coerce_bool(target.get(key), True)
if key in runtime_target:
return _coerce_bool(runtime_target.get(key), True)

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 Honor env/defaults disabled flags

When the targets JSON uses the same shape as env sync, RUNTIME_TARGET_ENABLED may come from target.env, defaults, or defaults.env, but this helper only checks the top-level target and nested runtime target. In that case env sync deploys the service with RUNTIME_TARGET_ENABLED=false while the runtime guard still loads and alerts on it, so disabled targets are not actually ignored for that supported configuration shape.

Useful? React with 👍 / 👎.

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