Skip to content

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

Closed
mraleko wants to merge 5 commits into
openclaw:mainfrom
mraleko:fix/telegram-account-agentid
Closed

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

Conversation

@mraleko

@mraleko mraleko commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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

greptile-apps Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

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

mraleko commented Apr 12, 2026

Copy link
Copy Markdown
Contributor Author

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

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

Copy link
Copy Markdown
Contributor

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

mraleko commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

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

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open. This is a real Telegram multi-account compatibility fix path, but the branch is not merge-ready on current main because it is conflict-marked, misses the generated bundled channel metadata validation surface, and has no real Telegram behavior proof.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection: current main's strict account schema, generated bundled channel metadata, and exported account type still lack agentId, while the linked issue shows the rejected upgrade config. I did not run tests because this review is read-only.

Is this the best way to solve the issue?

Not yet. Restoring account-level agentId is a plausible compatibility fix, but this branch must be rebased and updated for current generated metadata before it is the best merge path.

Security review:

Security review cleared: The diff changes Telegram config/routing code and tests only; no dependency, workflow, credential, permission, or supply-chain surface is changed.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-08T21:37:00Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is mock_only and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • Peter Steinberger: History search tied recent Telegram routing/topic work to this contributor in the same files touched by the PR. (role: recent Telegram routing contributor; confidence: medium; commits: 179ccb952cf2, cd5c2f4cb2c2; files: extensions/telegram/src/conversation-route.ts, extensions/telegram/src/bot-message-context.topic-agentid.test.ts)
  • Vincent Koc: History search shows recent work on config and generated bundled-channel metadata surfaces relevant to the missing current-main validation path. (role: recent config/metadata contributor; confidence: medium; commits: 8c802aa68351, e77d72a91dd5; files: src/config/bundled-channel-config-metadata.generated.ts, src/config/validation.ts)
  • scoootscooob: History search shows the Telegram channel was moved into extensions/, which is the owner boundary touched by this PR. (role: extension move contributor; confidence: medium; commits: e5bca0832fbd; files: extensions/telegram/src/conversation-route.ts)
  • Josh Avant: History search found Telegram pairing/session/forum routing stabilization adjacent to the topic and account-routing behavior reviewed here. (role: adjacent Telegram routing contributor; confidence: low; commits: 68bc6effc04a; files: extensions/telegram/src/conversation-route.ts, extensions/telegram/src/bot-message-context.topic-agentid.test.ts)

Codex review notes: model internal, reasoning high; reviewed against 8682d0701b27.

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 12, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels May 19, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 4, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels Jun 4, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 5, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 5, 2026
@clawsweeper

clawsweeper Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram multi-account config error

1 participant