Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix(llm): a non-ASCII execution handoff raises UnicodeEncodeError instead of ExecutionHandoffError

Open Beginner friendly
#659 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@subidhkhanal is already working on this.

Since Oct 23, 2026.

  • #664 by @subidhkhanal — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start in infrastructure/llm/execution/handoff.py around lines 202–204 and read the surrounding payload and signature validation. Add a unit test passing "é.abc" to consume_execution_handoff and asserting ExecutionHandoffError; follow the existing tests for this function. Done when the non-ASCII payload produces that documented error instead of UnicodeEncodeError.

Written by the indexing model from the issue text.

Description

The bug. consume_execution_handoff is meant to turn every bad handoff token into ExecutionHandoffError. A token with a non-ASCII character in its first half raises UnicodeEncodeError instead.

In infrastructure/llm/execution/handoff.py (:202-204), the payload half is encoded outside any try:

expected = hmac.new(
    _signing_key(), encoded_payload.encode("ascii"), hashlib.sha256
).digest()

Reproduced on main:

Token Result
"abc.def" ExecutionHandoffError (handled)
"é.abc" UnicodeEncodeError (not handled)

The only caller, dashboard/scripts/backtest_hourly_agent.py:343-344, catches only ExecutionHandoffError. So the worker exits with a raw traceback instead of its clean "invalid execution handoff" message. The signature half is already safe (_b64decode handles this), so the two halves behave inconsistently.

Impact is low. The token is written by the parent process over stdin, so this only happens with a corrupted or tampered handoff. No secret is exposed and nothing is billed. It's about failing the documented way.

Suggested fix. Wrap the encode (or the whole signature check) so a UnicodeEncodeError is raised as ExecutionHandoffError, the same way the payload decode below it already does. A unit test can pass "é.abc" and assert ExecutionHandoffError.

Dominant language
Python
Stars
767
Forks
156
Avg merge
22h 2m
Merged PRs (30d)
88

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Open-Finance-Lab/AgenticTrading

All issues in Open-Finance-Lab/AgenticTrading

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.