Skip to content

Polish composer and Tavily research flow#108

Merged
Abdulmuiz44 merged 1 commit into
mainfrom
codex/cloudflare-deploy
May 26, 2026
Merged

Polish composer and Tavily research flow#108
Abdulmuiz44 merged 1 commit into
mainfrom
codex/cloudflare-deploy

Conversation

@Abdulmuiz44
Copy link
Copy Markdown
Collaborator

Summary\n- Move prompt selections into the composer surface so active options show inline\n- Wire Deep Research to Tavily-backed web search with plan limits\n- Clean up blockchain lab wallet creation and supporting API routes\n- Remove SEARXNG references from source/config\n- Tighten the dark UI and sidebar interactions\n\n## Verification\n- pnpm exec tsc --noEmit

@Abdulmuiz44 Abdulmuiz44 merged commit f2d24c4 into main May 26, 2026
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: b818a102c4

ℹ️ 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".

Comment thread lib/generate-answer.ts

await recordUsageLedgerEvent({
userId: authorId,
eventType: 'web_search',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update ledger schema for new web_search event type

generateAnswerForPrompt now inserts eventType: 'web_search', but the checked-in DB schema still restricts usage_ledger.event_type to chat_generation, credit_blocked, and upload (see supabase/migrations/20260514110000_create_usage_ledger.sql). In environments created from these migrations, every successful research request will hit a check-constraint error and the event will be dropped, leaving web-search analytics/accounting incomplete.

Useful? React with 👍 / 👎.

Comment thread lib/generate-answer.ts
Comment on lines +249 to +250
} catch (error) {
console.error('[tavily_search_failed]', { userId: authorId, error })
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Return a user-visible error when Tavily research fails

If Tavily search fails (e.g., missing/invalid TAVILY_API_KEY or provider outage), this block only logs and then continues generation with researchMode still on but no research context. That produces responses presented as Deep Research without the promised web grounding/citations, which is an accuracy regression specific to research-mode requests under Tavily failure conditions.

Useful? React with 👍 / 👎.

Comment thread lib/plan-config.ts
limits: {
messagesPerDay: 'unlimited',
fileUploadsPerDay: 3,
webSearchesPerMonth: 5,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align free web-search quota with research access checks

The free plan now advertises webSearchesPerMonth: 5, but generation still hard-blocks research mode for non-Pro/Plus users (lib/generate-answer.ts, the existing researchMode plan gate). That makes the new free quota unreachable in practice and creates a user-facing mismatch between plan limits/profile messaging and actual behavior.

Useful? React with 👍 / 👎.

if (now >= resetAt) {
updates.monthly_web_searches = 0
const nextSearchResetDate = new Date(now)
nextSearchResetDate.setMonth(nextSearchResetDate.getMonth() + 1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clamp monthly reset date to avoid month-end overflow

Using setMonth(getMonth() + 1) on a late-month date can skip into the following month (for example, Jan 31 becomes Mar 3 in JavaScript), so users can be locked out longer than one month before monthly_web_searches resets. This directly affects quota enforcement for users whose reset is computed near month end.

Useful? React with 👍 / 👎.

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