feat(google-docs): connect and replace initial mock hil steps [INTEG-3599]#10735
feat(google-docs): connect and replace initial mock hil steps [INTEG-3599]#10735Harika Kondur (harikakondur) merged 10 commits intomasterfrom
Conversation
…low after suspension
…low agent requests
d0413f8 to
34e9860
Compare
There was a problem hiding this comment.
Pull request overview
Connects the Google Docs app’s modal flow to the workflow-based human-in-the-loop (HIL) backend by starting a workflow after content type selection, polling for completion/suspension, and resuming with user review decisions.
Changes:
- Add
useWorkflowAgentworkflow start/poll/resume support and wire it intoModalOrchestrator. - Replace mock-first tab/image review flow with backend-driven suspend payload + resume payload.
- Update UI/tests/types to support the new document-scope review state and workflow results.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/google-docs/src/hooks/useWorkflowAgent.ts | Implements workflow run creation, polling, and resume calls against Agents API (local + CMA). |
| apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx | Orchestrates the new workflow-driven modal flow; builds review state and resume payload. |
| apps/google-docs/src/locations/Page/components/modals/step_2/ContentTypePickerModal.tsx | Switches onContinue to pass string[] of content type IDs (no CSV). |
| apps/google-docs/src/locations/Page/components/modals/step_3/SelectTabsModal.tsx | Removes mock tabs fallback so tabs are backend-provided only. |
| apps/google-docs/src/utils/types.ts | Adds shared types for suspend payload, resume payload, workflow results, and review state. |
| apps/google-docs/test/locations/Page/components/mainpage/ModalOrchestrator.spec.tsx | Updates tests to cover workflow start → suspend → review steps → resume. |
| apps/google-docs/src/locations/Page/Page.tsx | Removes the “Optimization tip” note content and related styling/imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| setAvailableTabs(MOCK_TABS); | ||
| setHasAttemptedSubmit(false); | ||
| }, [setAvailableTabs]); | ||
| }, [availableTabs, setAvailableTabs]); |
There was a problem hiding this comment.
The useEffect here only resets hasAttemptedSubmit, but its dependency list includes availableTabs and setAvailableTabs (which isn't otherwise used). This will reset validation state whenever the tabs array identity changes, and setAvailableTabs can likely be removed entirely from this component API now that tabs come from the backend. Consider making this effect run only on mount (or when the modal opens) and dropping the unused setAvailableTabs prop/dependency.
| }, [availableTabs, setAvailableTabs]); | |
| }, []); |
apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx
Outdated
Show resolved
Hide resolved
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'x-contentful-enable-alpha-feature': 'agents-api', | ||
| 'X-Contentful-App-Definition-Id': '653vTnuQw3j5onU1tUoH6t', | ||
| }, |
There was a problem hiding this comment.
X-Contentful-App-Definition-Id is hard-coded here. This is brittle (will break if the app definition changes or in different environments) and makes local API behavior dependent on a committed ID. Prefer deriving it from sdk.ids.app (as done elsewhere in the codebase) and only sending the header when an app id is available.
JuliRossi
left a comment
There was a problem hiding this comment.
⭐ Overall, really nice work! How you should read my comments:
💡 ideas for the future (definitely not for now)
⛏️ nitpicks (nice to haves, not need to implement)
💭 suggestions (strongly suggest, not need to implement)
⚔️ dealbreakers /must (what makes me not approve this PR, need to implement/further discussions)
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'x-contentful-enable-alpha-feature': 'agents-api', | ||
| 'X-Contentful-App-Definition-Id': '653vTnuQw3j5onU1tUoH6t', |
There was a problem hiding this comment.
⛏️ Should be an env var?
apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx
Outdated
Show resolved
Hide resolved
apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx
Outdated
Show resolved
Hide resolved
apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx
Outdated
Show resolved
Hide resolved
apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx
Outdated
Show resolved
Hide resolved
apps/google-docs/src/locations/Page/components/mainpage/ModalOrchestrator.tsx
Outdated
Show resolved
Hide resolved
ffd7fb7 to
e164198
Compare
… state management
e164198 to
c2f57ae
Compare
c5c032c to
8bc409b
Compare
8bc409b to
eee44bf
Compare
| } | ||
|
|
||
| interface WorkflowResult { | ||
| interface WorkflowHook { |
There was a problem hiding this comment.
Not the most ideal type name
PR Description
Connects the Google Docs frontend to the workflow-based human-in-the-loop flow.
After content type selection, the frontend starts the
google-docs-workflow-agent, polls the thread run until it completes or pauses for review, and uses the suspend payload to show the tabs and images steps. Resume decisions are sent back through the resume API using the thread id. This replaces the previous mock-first flow.Files Changed