Skip to content

Answer tokenized-market questions when AI synthesis fails - #283

Merged
NomadDigita merged 1 commit into
mainfrom
codex/r-token-research-source-only-fallback-20261021
Oct 21, 2026
Merged

NomadDigita merged 1 commit into
mainfrom
codex/r-token-research-source-only-fallback-20261021

Conversation

@NomadDigita

Copy link
Copy Markdown
Member

What changed

  • Make the deterministic research fallback explicitly answer rToken questions, separating issuer headlines from token-market evidence and stating missing quote, liquidity, spread, and premium/discount data.
  • Label tokenized spot and stock perpetual references separately in the research result.
  • Add focused policy coverage for the rNVDA source-only case.

Verification

  • 226 tests pass.
  • Typecheck passes.
  • Lint passes with 9 existing warnings.
  • Production build passes after moving aside a corrupted local Next.js cache.

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tidelight Ready Ready Preview Oct 21, 2026 8:37am UTC

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T08:41:20.820041Z 959d1cb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@NomadDigita
NomadDigita merged commit a950200 into main Oct 21, 2026
9 checks passed

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

market: { perpSymbol: snap.perp?.symbol ?? null, spotSymbol: snap.spot?.symbol ?? null, perpLastPrice: snap.perp?.lastPrice ?? null, perpProviderTimestamp: snap.perp?.providerTimestamp ?? null, spotLastPrice: snap.spot?.lastPrice ?? null, spotProviderTimestamp: snap.spot?.providerTimestamp ?? null, lastPrice: snap.perp?.lastPrice ?? null, providerTimestamp: snap.perp?.providerTimestamp ?? null, interval: "4H", candles: completed.slice(-30).map(candle => ({ timestamp: candle.timestamp, close: candle.close })) },

P1 Badge Preserve split spot quotes in validated result consumers

The route now returns separate spot and perpetual prices and timestamps, but the primary generated-workspace path rebuilds market in parseIntelligenceResult using only the legacy lastPrice/providerTimestamp perpetual fields, and RegistryBlock therefore still renders the perpetual as the sole Bitget snapshot. The public replay serializer drops the new fields in the same way. Consequently, an rToken fallback viewed from Overview, the global companion, or a shared replay loses the returned tokenized-spot quote and may show the stock-perpetual price next to text claiming the token quote and freshness are shown separately; propagate and label both fields through these validated and published result shapes.

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

const now = Date.now();
const assets = snapshots.map(snap => {
const assessment = assessments[snap.ticker] ?? sourceOnlyRead(snap);
const assessment = assessments[snap.ticker] ?? sourceOnlyRead(snap, tokenizedMarketQuestion);

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 Scope tokenized fallback intent to the referenced asset

When AI synthesis is unavailable, this newly passed request-wide flag can make ordinary stock questions produce an rToken answer: the existing matcher treats complete words such as recent, risk, and review as r plus 1–6 letters, so “What is the recent news for NVDA?” is now summarized as an rNVDA-market question. It also applies tokenized intent to every asset in a mixed request such as “Compare rNVDA with TSLA stock,” causing the TSLA fallback to discuss rTSLA. Determine tokenized intent from exact rToken symbols/keywords for each ticker before selecting the fallback.

Useful? React with 👍 / 👎.

Comment thread lib/agent-flow-policy.ts
export function sourceOnlyAssessment(input: { ticker: string; headlineCount: number; publishers: number; latestTitle?: string | null; latestPublisher?: string | null; latestDate?: string | null; tokenizedMarketQuestion: boolean; spotSymbol?: string | null; spotPrice?: number | null; spotTimestamp?: number | null; perpSymbol?: string | null }): FlowAssessment {
const { ticker } = input;
const summary = input.tokenizedMarketQuestion
? `${input.headlineCount} issuer-level ${ticker} headline${input.headlineCount === 1 ? " was" : "s were"} collected across ${input.publishers} publisher${input.publishers === 1 ? "" : "s"}${input.latestTitle ? `; latest listed item: “${input.latestTitle.slice(0, 120)}”${input.latestPublisher ? ` (${input.latestPublisher}${input.latestDate ? `, ${input.latestDate}` : ""})` : ""}` : ""}. This coverage concerns ${ticker}, not the r${ticker} token market. ${input.spotSymbol && input.spotPrice != null ? `A tokenized spot quote was returned for ${input.spotSymbol} at ${input.spotPrice}; quote freshness ${input.spotTimestamp ? "is shown separately below" : "is unverified"}.` : `No verified r${ticker} tokenized-spot quote was returned.`} ${input.perpSymbol ? `${input.perpSymbol} is a stock-perpetual reference, not the rToken.` : "No stock-perpetual reference was verified."} r${ticker}-specific liquidity, spread, and premium or discount were not measured. Conclusion: not enough evidence to judge whether r${ticker} is worth reviewing as a trading opportunity. A due-diligence review could proceed after verifying token availability, a fresh token quote, liquidity, spread, and premium or discount. AI synthesis is unavailable; no directional assessment was made.`

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 Bound the fallback summary before returning it

For an rToken fallback with a latest headline, this summary routinely exceeds 800 characters, and the unsliced publisher name can push it beyond the 900-character limit enforced by parseIntelligenceResult in lib/intelligence-ui.ts. In that case a successfully completed run started from the Overview or global companion is rejected as failing interface validation; owner-published replays also unconditionally slice the summary to 700 characters in app/api/research/replays/route.ts, typically cutting off the final AI-unavailable and no-directional-assessment disclaimer. Keep the generated fallback within the strictest downstream bound or preserve the complete structured conclusion through those consumers.

Useful? React with 👍 / 👎.

This branch was successfully deployed

1 active deployment
Preview — 959d1cbf Deployed Oct 21, 2026 by vercel[bot]
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