Skip to content

Improve Lark subagent provisioning errors#63

Merged
danielwpz merged 2 commits into
mainfrom
fix/lark-subagent-api-errors
Jun 4, 2026
Merged

Improve Lark subagent provisioning errors#63
danielwpz merged 2 commits into
mainfrom
fix/lark-subagent-api-errors

Conversation

@danielwpz
Copy link
Copy Markdown
Owner

Summary

  • remove SubAgent welcome-card top notice publishing and drop the corresponding onboarding scope
  • log Lark API step, HTTP status, Lark code/msg, and response body for SubAgent provisioning failures
  • add regression coverage for Lark 400 responses during member add

Tests

  • pnpm preflight

@claude
Copy link
Copy Markdown

claude Bot commented Jun 4, 2026

Code Review

Summary: Removes SubAgent welcome-card top-notice pinning, wraps all Lark API calls with structured error capture, and enriches error logging with HTTP status, Lark code/msg, and response body.

1. Stack trace lost when runLarkApiStep wraps HTTP/client errors

src/channels/lark/subagent-provisioner.ts:376-382 - When the SDK throws an HTTP error, the original error is caught and replaced with a fresh LarkApiStepError. The original stack trace is discarded.

Fix: Pass the original error as cause: throw new LarkApiStepError(ctx, details, { cause: error })

2. No test coverage for Lark-level error codes through assertLarkOk

assertLarkOk now throws LarkApiStepError for non-zero Lark codes on HTTP 200. The existing failure test covers HTTP-throw path but not assertLarkOk throw path.

Fix: Add a test where a mocked API call returns non-zero Lark code without HTTP throw.

3. Documentation note is clear and actionable

The added tenant-scope note in docs/feishu-lark-setup.md is precise and helpful.

Verdict

Both issues are non-blocking. Issue 1 is worth addressing now; issue 2 is a coverage gap. The core behavior change is correct.

@danielwpz
Copy link
Copy Markdown
Owner Author

@claude Fixed in 7b1f3c4.

  • Preserved the original SDK/HTTP error as cause when wrapping it in LarkApiStepError.
  • Added regression coverage for HTTP-200 responses that carry a non-zero Lark code through assertLarkOk.

pnpm preflight passes locally: 157 test files, 1040 tests.

Please review again.

@danielwpz danielwpz merged commit e2b5019 into main Jun 4, 2026
4 checks passed
@danielwpz danielwpz deleted the fix/lark-subagent-api-errors branch June 4, 2026 11:48
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.

1 participant