Skip to content

Include generated tscircuit docs in local prompt#59

Open
Gimyoonsoo wants to merge 2 commits into
tscircuit:mainfrom
Gimyoonsoo:algora-45-auto-docs
Open

Include generated tscircuit docs in local prompt#59
Gimyoonsoo wants to merge 2 commits into
tscircuit:mainfrom
Gimyoonsoo:algora-45-auto-docs

Conversation

@Gimyoonsoo
Copy link
Copy Markdown

@Gimyoonsoo Gimyoonsoo commented May 12, 2026

Summary

Changes

  • Fetch https://docs.tscircuit.com/ai.txt and include it in createLocalCircuitPrompt() inside a dedicated generated-docs section.
  • Add an abort timeout so a stalled generated-docs endpoint falls back instead of hanging prompt creation.
  • Keep prompt creation resilient when the generated-docs endpoint is temporarily unavailable.
  • Add mocked-fetch regression coverage for generated-docs, fallback, and stalled-endpoint paths.
  • Skip OpenAI-dependent tests when OPENAI_API_KEY is not configured so deterministic tests can pass in no-secret environments.

Testing

  • GitHub Actions on latest commit d4cf1cc: Bun Test and Type Check passed.
  • bun test tests/prompt-templates/create-local-circuit-prompt.test.ts
  • Result: passed locally, 2 passed / 0 failed
  • bun test --timeout 50000
  • Result: passed locally, 13 passed / 2 skipped / 0 failed
  • bun x tsc --noEmit
  • Result: passed locally
  • bun run build
  • Result: passed locally

Notes

  • No authentication, payment, database, deployment, or security-sensitive configuration changes were made.
  • No secrets, credentials, production data, or security-sensitive information were accessed.

Algora

/claim #45

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 879d867005

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


async function fetchOptionalFileContent(url: string): Promise<string> {
try {
const response = await fetch(url)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add timeout to optional docs fetch

The new fetchOptionalFileContent() path only handles HTTP errors and thrown exceptions, but it still awaits fetch(url) with no timeout; if https://docs.tscircuit.com/ai.txt accepts a connection and then stalls, createLocalCircuitPrompt() will block instead of continuing with empty generated docs. This defeats the intended resilience for generated-doc outages and can hang prompt creation in degraded network conditions. Use AbortSignal.timeout(...) (or equivalent) so stalled responses fall back to "".

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in the latest commit. The optional generated-docs fetch now uses an abort timeout, and the regression test covers a stalled docs endpoint. Targeted test, full test suite, typecheck, lint, and build pass.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant