Skip to content

fix: exit with error code when Rulekeeper index run gives up on lock - #2810

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/rulekeeper-lock-timeout-exit-code-8d073b2af4fac0fc
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
fix/rulekeeper-lock-timeout-exit-code-8d073b2af4fac0fc

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

When an index run cannot acquire the database lock within 30 minutes, it previously exited with code 0 (success), causing Container Apps and the workflow to show green even though nothing was actually indexed. This is problematic when users manually trigger re-embeds and watch the results — they see a successful workflow when the index was never actually updated.

Changes

  • Modified scripts/rules-chat/index-rules.mjs line 202 to set process.exitCode = 1 when the lock times out (when sp_getapplock returns -1)
  • The script now exits with a non-zero code, causing Container Apps execution to end Failed and the workflow to show red
  • This ensures failure alerts fire as expected for unintended lock timeouts

Impact

  • Visibility: Manual re-embed operations now correctly show as Failed when they can't acquire the lock, making it clear to users watching the results that nothing was indexed
  • Monitoring: The hourly job's failure alert will fire for lock timeout cases, but this is expected and correct — the alert is already designed to detect meaningful failures vs expected timeouts during long first-time indexes or re-embeds (as noted in the issue)
  • No behavior change: The indexing logic is unchanged; this only affects the exit code

Related Issues

Closes #2809

Generated by Issue Triage for issue #2809 · ● 63.9K · ◷

…closes #2809

When an index run cannot acquire the database lock within 30 minutes, it previously
exited with code 0 (success), causing Container Apps and the workflow to show green
even though nothing was actually indexed.

Now it exits with code 1 (failure), so the Container Apps execution ends Failed and
the workflow shows red. This will ensure failure alerts fire for unintended lock
timeouts, making manual re-embed operations more transparent to users watching results.

The fix preserves the existing logging and allows the hourly runs to safely time out
during long first-time indexes or re-embeds without making the alert noisy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

🐛 The Rulekeeper - An index run that gives up on the lock ends Succeeded

0 participants