Skip to content

fix(telegram): allow agentId in account config for multi-account routing#63380

Open
mraleko wants to merge 5 commits intoopenclaw:mainfrom
mraleko:fix/telegram-account-agentid
Open

fix(telegram): allow agentId in account config for multi-account routing#63380
mraleko wants to merge 5 commits intoopenclaw:mainfrom
mraleko:fix/telegram-account-agentid

Conversation

@mraleko
Copy link
Copy Markdown
Contributor

@mraleko mraleko commented Apr 8, 2026

Summary

Fixes regression where Telegram multi-account configs with agentId were rejected as 'must NOT have additional properties' after upgrading from 2026.4.5 to 2026.4.8.

Root cause

agentId was only defined in TelegramTopicSchema (for forum group topic routing), not in TelegramAccountSchemaBase. The .strict() Zod modifier generates additionalProperties: false in JSON Schema, causing account configs with agentId to fail validation.

Changes

  • src/config/types.telegram.ts: Added agentId?: string to TelegramAccountConfig type
  • src/config/zod-schema.providers-core.ts: Added agentId: z.string().optional() to TelegramAccountSchemaBase Zod schema (after enabled field)
  • src/config/config.telegram-topic-agentid.test.ts: Added regression test for agentId in account config

Testing

  • Isolated Zod schema validation confirms: account with agentId now passes, multi-account config (6 accounts each with agentId) passes, backward compatibility preserved

Fixes #62985

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 8, 2026

Greptile Summary

Fixes a regression introduced between 2026.4.5 and 2026.4.8 where Telegram multi-account configs using agentId were rejected by schema validation. The fix adds agentId?: string to both TelegramAccountConfig and TelegramAccountSchemaBase, aligning the account-level schema with the already-supported topic-level field.

Confidence Score: 5/5

Safe to merge — targeted schema fix with regression test coverage and no behavioral side effects.

The only finding is a P2 style issue (new test placed in the wrong describe block). The core fix is minimal, correct, and type-consistent with the existing topic-level agentId pattern.

src/config/config.telegram-topic-agentid.test.ts — the account-level agentId regression test belongs in its own describe block.

Vulnerabilities

No security concerns identified.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/config/config.telegram-topic-agentid.test.ts
Line: 238-266

Comment:
**New test placed in wrong describe block**

The "accepts agentId in telegram account config (multi-account routing)" test (line 238) is nested inside `describe("telegram disableAudioPreflight schema")` (line 137), which is semantically unrelated. Consider moving it to the existing `describe("telegram topic agentId schema")` block or a dedicated new block such as `describe("telegram account agentId schema")`.

```suggestion
describe("telegram account agentId schema", () => {
  it("accepts agentId in telegram account config (multi-account routing)", () => {
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(telegram): add agentId field to acco..." | Re-trigger Greptile

Comment thread src/config/config.telegram-topic-agentid.test.ts Outdated
mraleko added 2 commits April 11, 2026 03:04
Allows agentId in channels.telegram.accounts.<id> for per-account agent
routing in multi-account setups. Fixes regression where upgrading from
2026.4.5 to 2026.4.8 caused 'must NOT have additional properties' errors
for accounts with agentId configured.
Resolves Greptile P2 review comment: test was nested inside
telegram disableAudioPreflight schema block (semantically unrelated).
Now in dedicated describe("telegram account agentId schema") block.
@mraleko mraleko force-pushed the fix/telegram-account-agentid branch from 43e7474 to 26aa82c Compare April 11, 2026 03:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 26aa82ccf0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/config/zod-schema.providers-core.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 7a303af40a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/config/zod-schema.providers-core.ts Outdated
@mraleko
Copy link
Copy Markdown
Contributor Author

mraleko commented Apr 12, 2026

Addressed the account-level agentId follow-up.

  • route channels.telegram.accounts.<id>.agentId when no explicit binding matches
  • keep explicit bindings and topic-specific agentId overrides ahead of the account default
  • reject top-level channels.telegram.agentId so only per-account config accepts this field

Validated with:

  • OPENCLAW_VITEST_INCLUDE_FILE=/tmp/openclaw-tests.json node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: M and removed size: XS labels Apr 12, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 8965daf69b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/config/types.telegram.ts
@mraleko
Copy link
Copy Markdown
Contributor Author

mraleko commented Apr 13, 2026

Addressed the remaining Telegram agentId type mismatch follow-up.

  • keep channels.telegram.accounts.<id>.agentId in TelegramAccountConfig
  • exclude agentId from the top-level TelegramConfig type so channels.telegram.agentId no longer type-checks

Validated with:

  • OPENCLAW_VITEST_INCLUDE_FILE=/tmp/openclaw-tests.json node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts
  • pnpm exec tsc -p tsconfig.telegram-types.tmp.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram multi-account config error

1 participant