planner task - #518
Open
harishmotamarri wants to merge 2 commits into
Open
planner task#518harishmotamarri wants to merge 2 commits into
harishmotamarri wants to merge 2 commits into
Conversation
Contributor
🟠 Maintainer review suggested — low confidenceThe automated review could not reach a fully supported conclusion. This review is advisory and does not block merging. |
There was a problem hiding this comment.
🟡 Changes recommended
Critical and moderate issues remain in session handling, context safety, workflow execution, and dependency locking.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds Gemini-backed natural-language browser workflows with validation, context passing, CLI execution, and documentation.
Changes:
- Adds workflow planning, validation, execution, and browser-script support.
- Adds Gemini integration and a
workflow runCLI command. - Updates dependencies, tests, exports, and quickstart documentation.
File summaries
| File | Reviewed changes |
|---|---|
src/planner/index.ts |
Workflow planning, validation, execution, and browser helpers |
src/planner/index.test.ts |
Planner and workflow execution tests |
src/planner/gemini.ts |
Gemini workflow generation |
src/cli.ts |
workflow run command and session lifecycle |
package.json |
Planner exports and runtime dependency |
package-lock.json |
Dependency lockfile updates |
docs/quickstart.mdx |
Workflow usage documentation |
Review details
Suppressed comments (5)
package.json:101
@google/genaiis now a production dependency inpackage.json, but the trackedbun.lockstill lists it under the rootdevDependencies. Bun frozen or production installs can therefore remain inconsistent or omit the SDK used by the runtime import; regenerate and commit the Bun lockfile with this dependency move.
"@google/genai": "^2.10.0",
src/cli.ts:667
- The new top-level
workflowcommand is absent from the maintained Top-Level Commands table indocs/cli-reference.mdx(lines 152-166), even though this change adds a user-facing command and the reference documents every other top-level command. Add the workflow entry so CLI discoverability matches the implementation.
.command('workflow')
src/planner/index.ts:247
- When
args.textis supplied, this passes visible text such as"Save"topage.locator, which treats it as a CSS selector rather than a text query and normally finds no element. Keep selector/ref handling separate and use a text locator such asgetByTextfor thetextform.
if (step.command === 'click') {
const target = args.selector ?? args.ref ?? args.text;
return typeof target === 'string'
? `await page.locator(${JSON.stringify(target)}).click(); return { clicked: true };`
: undefined;
src/planner/index.ts:79
- Only exact duplicate output keys are rejected here. Overlapping paths such as
eventandevent.datepass validation, butwritePathreplaces the existing scalar/object while applying the second mapping, silently discarding context data. Reject ancestor/descendant output paths before execution or define explicit merge semantics.
for (const key of Object.keys(step.outputs ?? {})) {
if (!key || produced.has(key)) throw invalidWorkflow(`Workflow output "${key}" is produced more than once.`);
produced.add(key);
}
src/planner/index.ts:78
- Only output keys are checked here, but
readPathbelow assumes every mapping value is a string and calls.replaceon it. The Gemini schema also permits arbitrary values inoutputs, so a response such asoutputs: { value: 1 }passes validation and later throws a raw TypeError instead of a workflow ConfigError. Validate the mapping values as strings before adding their keys.
for (const key of Object.keys(step.outputs ?? {})) {
if (!key || produced.has(key)) throw invalidWorkflow(`Workflow output "${key}" is produced more than once.`);
produced.add(key);
- Files reviewed: 6/7 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| created = true; | ||
| } | ||
| try { | ||
| const result = await runBrowserWorkflow(workflow, { session, profile: opts.profile, context: {} }); |
Comment on lines
+212
to
+213
| const parts = path.split('.').filter(Boolean); | ||
| let current: Record<string, unknown> = target; |
| .description('Ask Gemini to plan a workflow and run it in a browser Session') | ||
| .requiredOption('--goal <text>', 'Natural-language task to perform') | ||
| .option('--session <id>', 'Existing browser Session ID; created automatically when omitted') | ||
| .option('--profile <name>', 'Browser profile to use', 'default') |
| } | ||
| const profile = resolveProfileSelection(opts.profile); | ||
| const profileId = profile?.contextId ?? 'default'; | ||
| let session = opts.session?.trim(); |
Comment on lines
+85
to
+86
| validateWorkflow(workflow); | ||
| const context: WorkflowContext = options.context ?? {}; |
Comment on lines
+155
to
+163
| executeScript: options.executeScript ?? ((script) => sendCommand('run', { | ||
| session: options.session, | ||
| surface: 'browser', | ||
| ...profileRouteParams(resolveProfileSelection(options.profile)), | ||
| source: script, | ||
| timeoutMs: 120_000, | ||
| timeout: 125, | ||
| snapshotMode: 'act', | ||
| })), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related issue:
Type of Change
Checklist
skill-src/, I ranmake buildand committedskills/Adapter Notes
CliErrorsubclasses instead of rawErrorScreenshots / Output