Skip to content

fix: remove legacy telegram json parsing from router#64

Merged
yihong0618 merged 1 commit intoPsiACE:mainfrom
glasscatya:main
Feb 24, 2026
Merged

fix: remove legacy telegram json parsing from router#64
yihong0618 merged 1 commit intoPsiACE:mainfrom
glasscatya:main

Conversation

@glasscatya
Copy link
Contributor

@glasscatya glasscatya commented Feb 22, 2026

Bug Description

Run command:

bub run "{\"message\": null}" 
# or
bub run '"这是一个合法的JSON"'

These inputs (among others) trigger an AttributeError:

  • {"message": null}parsed is a dict, but parsed.get("message") returns None → subsequent None.startswith(...) call crashes.
  • "这是一个合法的JSON"parsed is a str without a .get() method → AttributeError is raised immediately.

Investigation

While investigating the AttributeError bugs, I traced the JSON parsing code back to commit 1fe1c18 (2026-02-10), where it was added to handle the old MessageBus communication format (InboundMessage.render()). However, after commit 9808f0f (2026-02-14) removed the MessageBus, this parsing became obsolete—the current architecture passes plain text directly from Channel.get_session_prompt() through runtime.handle_input() to router.route_user(). All modern channels (telegram/discord/base) no longer use the JSON wrapper format, making this code safe to remove.

Current Data Flow: Channel.get_session_prompt() -> runtime.handle_input() -> router.route_user(raw_text)

Resolution

Delete this dead code to reduce complexity and clarify the router's scope.

Verification

  • ruff check: passed
  • ruff format: passed
  • mypy: passed
  • pre-commit: passed

This code was originally used to parse MessageBus JSON format, but
became obsolete after MessageBus removal in 9808f0f. It also had bugs with None values and string JSON inputs.

Current flow: Channel.get_session_prompt() -> runtime.handle_input()
-> router.route_user(raw_text)
Copy link
Owner

@PsiACE PsiACE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@PsiACE PsiACE requested a review from yihong0618 February 23, 2026 18:32
@yihong0618 yihong0618 merged commit 0c0988b into PsiACE:main Feb 24, 2026
5 checks passed
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.

3 participants