Skip to content

Handle intentional bot shutdown cleanly - #76

Merged
Cordtus merged 1 commit into
mainfrom
codex/cacmin-clean-shutdown
Jul 17, 2026
Merged

Handle intentional bot shutdown cleanly#76
Cordtus merged 1 commit into
mainfrom
codex/cacmin-clean-shutdown

Conversation

@Cordtus

@Cordtus Cordtus commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • distinguish intentional Telegraf shutdown settlement from genuine launch failures
  • preserve fatal handling for launch errors before shutdown
  • add timing-aware lifecycle regression tests
  • ignore local AGENTS.md guidance so it cannot enter the remote repository

Root cause

During a systemd update restart, SIGTERM called bot.stop(). Under Bun, Telegraf then rejected the awaited launch promise while attempting to redact a read-only error property. The outer startup catch treated that expected shutdown settlement as a startup failure and exited 1 even though the updater successfully started the replacement process.

Verification

  • bun run test -- tests/unit/botLifecycle.test.ts (4 passed)
  • bun run test (122 passed)
  • bun run lint
  • bun run tsc --noEmit
  • bun run build
  • git diff --check
  • independent review of origin/main..fa15c4d: ready to merge, no Critical or Important issues

@Cordtus
Cordtus merged commit 7848794 into main Jul 17, 2026
4 checks passed
@Cordtus
Cordtus deleted the codex/cacmin-clean-shutdown branch July 17, 2026 17:16
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