fix: allow enabling an agent without Telegram credentials - #60
Jeremy2026AI wants to merge 1 commit into
Conversation
The `enable` CLI preflight hard-blocked every agent without BOT_TOKEN/CHAT_ID, but agent-manager.ts already treats Telegram as fully optional at the daemon level (Telegram is simply skipped when BOT_TOKEN is absent). This aligns the CLI check with existing daemon behavior: enabling now succeeds when both BOT_TOKEN and CHAT_ID are blank, and still fails loud on a partial config (only one of the two set), since that's a real misconfiguration rather than an intentional no-Telegram setup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the contribution, @Jeremy2026AI. We’ve acknowledged PR #60 and queued it for maintainer review. We’ll post a substantive verdict by Monday, August 10. |
|
Reopening to re-emit the pull_request event because GitHub did not materialize the first-time-contributor workflow approval run for exact head 86c7b62. |
noogalabs
left a comment
There was a problem hiding this comment.
P1 — unreadable .env now fails open as intentional no-Telegram configuration.
parseEnvFile() catches every read error and returns {} (src/cli/enable-agent.ts:33-47). This change then treats both absent values as telegramConfigured === false and continues enabling (src/cli/enable-agent.ts:182-197). On exact head 86c7b62190775c66796ed901fc026bce570cbc69, I made the discovered .env path a directory so readFileSync throws EISDIR; cortextos enable exited 0, wrote enabled-agents.json, and reported “enabling without a Telegram channel.” The predecessor failed closed because the same empty parse result hit the required-value error. A permissions/read I/O failure has the same outcome.
Please distinguish a successful readable env with both Telegram values blank/absent from an env read failure. Fail before writing the registry on read failure, and add the unreadable/non-file .env casualty. The new positive and partial-pair cases can remain as-is. I also independently verified that a configured pair still enters live validation (an invalid configured token exited 1 without writing the registry), but a committed configured-pair regression would strengthen the moved branch.
|
Evidence closure for exact head
The full isolated root suite was not used as authority because it was run before dashboard dependencies were installed and also hit an unrelated timing test; hosted CI installed both dependency sets and completed green. The review remains blocked only on the fail-open repair and its regression test. |
|
Thanks for this - it's a clean fix. You're right that the daemon already treats Telegram as optional; aligning the |
Summary
BOT_TOKEN/CHAT_ID, butagent-manager.tsalready treats Telegram as fully optional at the daemon level (it's simply skipped whenBOT_TOKENis absent — see the existing comment at agent-manager.ts:578).enablenow succeeds when bothBOT_TOKENandCHAT_IDare blank, and still fails loud on a partial config (only one of the two set), since that's a real misconfiguration rather than an intentional no-Telegram setup.Test plan
npm test— full suite passes (3646 passed)tests/integration/enable-no-telegram-cli.test.tscovers: both blank → exit 0 + enabled, onlyBOT_TOKENset → exit 1, onlyCHAT_IDset → exit 1🤖 Generated with Claude Code