Skip to content

fix(agent-service): handle falsy model throws - #7638

Draft
anthonychengit wants to merge 1 commit into
apache:mainfrom
anthonychengit:fix/agent-falsy-throw
Draft

fix(agent-service): handle falsy model throws#7638
anthonychengit wants to merge 1 commit into
apache:mainfrom
anthonychengit:fix/agent-falsy-throw

Conversation

@anthonychengit

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

The model adapter can throw arbitrary JavaScript values, including null and undefined. The previous error path immediately read error.name, so those values caused sendMessage itself to reject instead of returning Texera's normal error result.

Before: falsy model throw -> error.name dereference -> rejected sendMessage
After:  falsy model throw -> normalized error text -> resolved ReAct error step

This change safely normalizes thrown values and uses optional access for optional error metadata. The regression test covers null, undefined, false, 0, and the empty string, and verifies both the resolved response and its recorded error step.

Any related issues, documentation, discussions?

Closes #7485

How was this PR tested?

npx --yes bun@1.3.14 test src/agent/texera-agent.spec.ts
npx --yes bun@1.3.14 run typecheck
npx --yes bun@1.3.14 run format:check

The test file passed 56 tests. Type checking and formatting checks also passed.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex (GPT-5)

@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Aug 13, 2026
@github-actions
github-actions Bot requested a review from xuang7 August 13, 2026 23:13
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aglinxinyuan, @bobbai00
    You can notify them by mentioning @aglinxinyuan, @bobbai00 in a comment.

@github-actions

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. Requested review from @xuang7.

Auto-label run.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.65%. Comparing base (12169c2) to head (d6cf112).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7638   +/-   ##
=========================================
  Coverage     89.65%   89.65%           
  Complexity     4397     4397           
=========================================
  Files          1177     1177           
  Lines         46996    46997    +1     
  Branches       5268     5268           
=========================================
+ Hits          42136    42137    +1     
  Misses         3094     3094           
  Partials       1766     1766           
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 12169c2
agent-service 98.62% <100.00%> (+<0.01%) ⬆️
amber 86.35% <ø> (ø) Carriedforward from 12169c2
computing-unit-managing-service 72.46% <ø> (ø) Carriedforward from 12169c2
config-service 77.31% <ø> (ø) Carriedforward from 12169c2
file-service 68.90% <ø> (ø) Carriedforward from 12169c2
frontend 90.67% <ø> (ø) Carriedforward from 12169c2
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 12169c2
pyamber 97.57% <ø> (ø) Carriedforward from 12169c2
workflow-compiling-service 57.89% <ø> (ø) Carriedforward from 12169c2

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

agent-service fix release/v1.2 back porting to release/v1.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A falsy throw from the model makes sendMessage reject instead of reporting an error step

3 participants