[Agent] Issue #448: the apigenerate endpoints call openai wi #451

Open
pook wants to merge 50 commits from feat/llm-timeout-504 into main
Owner

Closes #448

Changes

feat: issue #448 the-apigenerate-endpoints-call-openai-wi (agent task liancebot448)

Acceptance Criteria

The /api/generate endpoints call OpenAI with no timeout. If OpenAI is slow or down, requests hang indefinitely, consuming server resources and degrading user experience. Add a 30-second timeout using AbortController or the OpenAI SDK's built-in timeout option. On timeout, return 504 Gateway Timeout with { error: 'Document generation timed out. Please try again.' }. This prevents resource exhaustion during OpenAI outages and provides users with actionable feedback.


Generated by CEO Planner (priority: 3)

Tokens: 55 in / 12269 out

Closes #448 ## Changes feat: issue #448 the-apigenerate-endpoints-call-openai-wi (agent task liancebot448) ## Acceptance Criteria The /api/generate endpoints call OpenAI with no timeout. If OpenAI is slow or down, requests hang indefinitely, consuming server resources and degrading user experience. Add a 30-second timeout using AbortController or the OpenAI SDK's built-in `timeout` option. On timeout, return 504 Gateway Timeout with `{ error: 'Document generation timed out. Please try again.' }`. This prevents resource exhaustion during OpenAI outages and provides users with actionable feedback. --- *Generated by CEO Planner (priority: 3)* Tokens: 55 in / 12269 out
Prevents indefinite request hangs when OpenAI is slow or unavailable.
Uses the OpenAI SDK's built-in timeout option on chat.completions.create(),
catches APIConnectionTimeoutError, and returns 504 Gateway Timeout with
actionable error message to the user.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: issue #448 the-apigenerate-endpoints-call-openai-wi (agent task liancebot448)
Some checks failed
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Has been cancelled
09f81ec5b8
Some checks failed
CI Quality Gate / Lint / Typecheck / Test / Build (pull_request) Has been cancelled
This pull request has changes conflicting with the target branch.
  • .forgejo/workflows/ci.yml
  • bun.lock
  • package.json
  • packages/api/src/db/schema.ts
  • packages/api/src/index.ts
  • packages/api/src/middleware/rate-limit.ts
  • packages/api/src/middleware/security-headers.ts
  • packages/api/src/routes/generate-tos.ts
  • packages/api/src/routes/generate.ts
  • packages/api/src/routes/health.ts
  • packages/api/src/routes/questionnaire.ts
  • packages/api/src/services/document-generator.ts
  • packages/api/src/services/llm.ts
  • packages/api/src/templates/index.ts
  • packages/api/tsconfig.json
  • packages/shared/src/types.ts
  • packages/web/src/app/questionnaire/page.tsx
  • packages/web/src/components/documents/DocumentList.tsx
  • packages/web/src/components/questionnaire/ReviewStep.tsx
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/llm-timeout-504:feat/llm-timeout-504
git switch feat/llm-timeout-504
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot!451
No description provided.