Skip to content

[INTEG-3460] feat: improve google docs quality#10608

Merged
ryunsong-contentful merged 1 commit intogoogle-docs-qualityfrom
INTEG-3460
Feb 24, 2026
Merged

[INTEG-3460] feat: improve google docs quality#10608
ryunsong-contentful merged 1 commit intogoogle-docs-qualityfrom
INTEG-3460

Conversation

@ryunsong-contentful
Copy link
Contributor

Summary

  • Added a new "Confirm Prompt" step in the document import flow that allows users to preview and optionally analyze the prompt before generating the full preview
  • Extended the polling timeout from 5 minutes to 50 minutes to accommodate longer-running agent operations
  • Added timing markers throughout the agent request lifecycle for debugging and performance monitoring

Changes

New Confirm Prompt Modal (step_2b/ConfirmPromptModal.tsx)

  • Introduces an intermediate step between content type selection and preview generation
  • Displays the document ID, selected content types, and the full prompt text
  • Includes an "Analyze" button that calls the google-docs-mapping-agent to preview document analysis before committing to full generation
  • Shows analysis results in a read-only textarea

New useAnalyzePrompt Hook

  • Manages state and API calls for the mapping agent analysis
  • Supports both local development API (localhost:4111) and production SDK
  • Implements polling mechanism with configurable intervals and max attempts
  • Logs timing and results to console for debugging

Updated useGeneratePreview Hook

  • Added start/end timestamps and duration logging for the full preview generation flow
  • Enhanced console logging to show assistant text content on successful polling
  • Logs duration in both seconds and minutes format

Modal Flow Updates (ModalOrchestrator.tsx, useModalManagement.ts)

  • Added CONFIRM_PROMPT modal type and state management
  • Updated flow: Select Document → Select Content Types → Confirm Prompt → Preview → Review

Configuration Updates (agent.ts)

  • Extended MAX_POLL_TIME_MS from 5 minutes to 50 minutes
  • Added AGENT_ANALYZER_ID constant for the mapping agent

Test plan

  • Verify the new Confirm Prompt modal appears after selecting content types
  • Test the "Analyze" button calls the mapping agent and displays results
  • Confirm "Back" button returns to content type selection
  • Confirm "Generate Preview" proceeds to the full preview generation
  • Verify timing logs appear in console for both analyze and generate operations
  • Test that long-running agent operations don't timeout prematurely

@ryunsong-contentful ryunsong-contentful requested a review from a team as a code owner February 24, 2026 15:40
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good so far! we can think about integrating this into the workflow with a human approval step: https://mastra.ai/docs/workflows/human-in-the-loop once it's set up

Comment on lines +335 to +348

const endTime = Date.now();
const durationMs = endTime - startTime;
const durationSec = (durationMs / 1000).toFixed(2);
const durationMin = (durationMs / 60000).toFixed(2);
console.log('[GeneratePreview] End:', new Date(endTime).toISOString());
console.log(`[GeneratePreview] Duration: ${durationSec}s (${durationMin} min)`);
} catch (err) {
const endTime = Date.now();
const durationMs = endTime - startTime;
const durationSec = (durationMs / 1000).toFixed(2);
console.log('[GeneratePreview] End (error):', new Date(endTime).toISOString());
console.log(`[GeneratePreview] Duration: ${durationSec}s`);

Choose a reason for hiding this comment

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

nit: logs

@ryunsong-contentful ryunsong-contentful merged commit 45f9f46 into google-docs-quality Feb 24, 2026
11 checks passed
@ryunsong-contentful ryunsong-contentful deleted the INTEG-3460 branch February 24, 2026 20:43
Harika Kondur (harikakondur) added a commit that referenced this pull request Mar 11, 2026
* feat: extend timeout to 50 minutes and add in timing markers (#10608)

* fix: update AGENT_ANALYZER_ID constant to reflect new workflow agent name (#10613)

* fix: update local agents API URL to use constant for base URL

* fix(google-docs): add pagination for content type fetching [INTEG-3491] (#10674)

* feat: implement pagination for content type fetching in SelectContentTypeModal

* fix: add checks to avoid infinite loop

* chore: add env example

* chore: update readme

* fix: cleanup test modal [INTEG-3496] (#10682)

* feat(google-docs): make the test modal more dev friendly

* fix(google-docs): cleanup content type ids and spacing

* fix(google-docs): implement temporary workaround for content type ID handling in workflows (#10688)

* chore: rename useAnalyzePrompt hook to useWorkflowAgent

* chore: remove logs

* chore: remove logs in useGeneratePreview hook

---------

Co-authored-by: ryunsong-contentful <124832189+ryunsong-contentful@users.noreply.github.com>
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.

2 participants