Repository navigation
fix(help): correct input and MCP descriptions, add a first-screen help gate #3788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3c16d39
fix(help): correct two wrong input descriptions
thymikee 7b71603
fix(help): name the root decision card in the MCP help tool description
thymikee 1d23f0b
fix(help): omit a topic's own entry from its Related footer
thymikee 64abfe6
test(help): pin each topic's key rules to its first 30 lines
thymikee 138be32
build(bench): default the help bench Codex runner to gpt-6-luna
thymikee b1c8082
docs(help): describe jitterPx as a per-axis offset, not a radius
thymikee 5d267ec
test(help): anchor first-screen rules to whole rendered lines
thymikee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { test } from 'vitest'; | ||
| import { usage, usageForCommand } from '../../cli/parser/args.ts'; | ||
| import { helpTopicIds } from './cli-help.ts'; | ||
|
|
||
| // Agents often read only the first screen of a help text, and the help benchmark caps the root | ||
| // help at 30 lines (`--help:first30`). Each entry pins the rules that keep an agent safe on that | ||
| // screen: prerequisites, refusals, verification steps, and recovery. A new topic must declare its | ||
| // own entry. | ||
| const FIRST_SCREEN_LINES = 30; | ||
| const ROOT_HELP = '--help'; | ||
|
|
||
| const FIRST_SCREEN_RULES: Record<string, readonly string[]> = { | ||
| [ROOT_HELP]: [ | ||
| 'agent-device open <app> --foreground', | ||
| 'Do not probe first with devices, apps, appstate, snapshot, or screenshot', | ||
| 'Never invent ids', | ||
| 'A bare screenshot is not verification', | ||
| 'End with: agent-device close', | ||
| ], | ||
| commands: ['Use agent-device help <command> for exact flags and behavior', 'Commands:'], | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
|
||
| 'manual-qa': [ | ||
| 'Do not explore unrelated screens', | ||
| 'Stop and report ambiguity', | ||
| 'use --relaunch only when the script needs fresh state', | ||
| 'If --settle prints not settled, follow its hint', | ||
| 'A bare screenshot/snapshot is not verification', | ||
| ], | ||
| maestro: [ | ||
| 'replay <flow.yaml> --maestro', | ||
| 'there is no silent all: allow default', | ||
| 'do not place secrets in diagnostic identifiers', | ||
| 'not a security sandbox', | ||
| 'Unsupported syntax fails loudly', | ||
| ], | ||
| workflow: [ | ||
| 'never a placeholder (@ref, @eN, @Label_Name)', | ||
| 'every platform rejects a stale pinned ref', | ||
| 'Never open artifact paths or invent package ids', | ||
| 'TV/D-pad focus: help tv', | ||
| 'Matches in distinct subtrees fail with AMBIGUOUS_MATCH', | ||
| ], | ||
| scripting: [ | ||
| 'scroll down --until <selector>', | ||
| 'add an explicit landmark wait', | ||
| '--record-as PASSWORD', | ||
| 'contain only ${PASSWORD}', | ||
| 'refuses a terminal, empty input, invalid UTF-8', | ||
| ], | ||
| gestures: [ | ||
| 'coordinates only as a fallback', | ||
| 'instead of assuming requested values map exactly to recognizer output', | ||
| 'then diff snapshot -i', | ||
| 'Coordinates are fallback-only; document why you used them.', | ||
| ], | ||
| tv: [ | ||
| 'move focus with remote/D-pad buttons, then activate the focused control', | ||
| 'not ADB', | ||
| 'Physical Fire TV devices remain unsupported', | ||
| 'The VVD is never booted implicitly', | ||
| 'remain unsupported until their Vega backends are implemented', | ||
| ], | ||
| debugging: [ | ||
| 'Do not cat a full stale log into agent context', | ||
| 'do not split it into logs stop, logs clear, logs start', | ||
| '--launch-console is only for direct iOS simulator app launches, not URL opens', | ||
| 'Do not write network log headers', | ||
| ], | ||
| 'react-devtools': [ | ||
| 'React Native 0.74 or newer', | ||
| 'find again after either', | ||
| 'fail with tree-unavailable', | ||
| 'Run profile start immediately before the interaction', | ||
| ], | ||
| cdp: [ | ||
| 'Do not use this as the default React Native profiler', | ||
| 'adb reverse tcp:8081 tcp:8081', | ||
| 'agent-device cdp target select <target-id>', | ||
| 'cdp memory snapshot leak-triplet', | ||
| ], | ||
| 'react-native': [ | ||
| 'Do not run doctor as routine QA/dogfood prep', | ||
| 'prefer open --relaunch before the first snapshot', | ||
| 'Do not use agent-device reload', | ||
| 'the sandbox probe is not authoritative', | ||
| 'ask instead of inventing app ids or URLs', | ||
| ], | ||
| 'physical-device': [ | ||
| 'have Developer Mode enabled', | ||
| 'must be signed before commands can run on a physical device', | ||
| "the Mac's DevToolsSecurity setting", | ||
| "read from an iPhone's own report before the runner builds", | ||
| 'The two device reasons are never inferred from tool output or from each other', | ||
| 'Enable USB debugging', | ||
| ], | ||
| 'ios-system-ui': [ | ||
| 'agent-device open com.apple.springboard --platform ios', | ||
| 'instead of relying on the literal strings', | ||
| 'This is the one deliberate coordinate step', | ||
| 'Do not hard-code Edit/Done/Add Widget', | ||
| 'Reopen the app bundle under test', | ||
| ], | ||
| foldable: [ | ||
| 'Do not add a screen flag to the normal loop', | ||
| 'never carry coordinates or refs across', | ||
| 'Re-snapshot after every fold', | ||
| 'fold-pose-unverified', | ||
| 'report which poses the run covered', | ||
| ], | ||
| remote: [ | ||
| 'connect -> install/open -> commands -> close -> disconnect', | ||
| 'not the app artifact name, ARN, or lt:// id', | ||
| 'run its printed reconnect command', | ||
| 'Do not run devices as a pre-open catalog probe for direct providers', | ||
| 'It does not expose connect/disconnect', | ||
| ], | ||
| macos: [ | ||
| 'Do not output inspect as a command', | ||
| '--button secondary', | ||
| 'Do not let iOS simulator-set scoping hide macOS desktop targets', | ||
| 'instead of guessing coordinates', | ||
| 'without raising the app', | ||
| ], | ||
| web: [ | ||
| 'Use --platform web only for the minimal browser command loop', | ||
| 'agent-device web doctor', | ||
| 'Web automation requires Node 24+', | ||
| 'output only agent-device command lines', | ||
| ], | ||
| dogfood: [ | ||
| 'Do not read app source or invent findings from code', | ||
| 'ask only if missing', | ||
| 'Keep stateful commands serial within the same session', | ||
| 'use react-native dismiss-overlay', | ||
| ], | ||
| validate: [ | ||
| 'Do not validate against stale dist output', | ||
| 'start with pnpm build', | ||
| 'run pnpm build:android before pnpm clean:daemon', | ||
| 'Do not build the Apple runner for TypeScript-only changes', | ||
| 'Close sessions and release leases before finishing', | ||
| ], | ||
| }; | ||
|
|
||
| async function renderHelp(id: string): Promise<string> { | ||
| if (id === ROOT_HELP) return await usage(); | ||
| const text = await usageForCommand(id); | ||
| if (text === null) throw new Error(`Expected help text for topic ${id}`); | ||
| return text; | ||
| } | ||
|
|
||
| test('every help topic and the root help declare first-screen rules', () => { | ||
| assert.deepEqual(Object.keys(FIRST_SCREEN_RULES).sort(), [ROOT_HELP, ...helpTopicIds()].sort()); | ||
| }); | ||
|
|
||
| test.each(Object.entries(FIRST_SCREEN_RULES))( | ||
| 'help %s keeps its key rules in the first 30 lines', | ||
| async (id, rules) => { | ||
| const lines = (await renderHelp(id)).split('\n'); | ||
| const firstScreen = lines.slice(0, FIRST_SCREEN_LINES).join('\n'); | ||
| for (const rule of rules) { | ||
| const line = lines.findIndex((text) => text.includes(rule)) + 1; | ||
| assert.ok( | ||
| firstScreen.includes(rule), | ||
| line > 0 | ||
| ? `"${rule}" is on line ${line}, below the first ${FIRST_SCREEN_LINES} lines of help ${id}` | ||
| : `"${rule}" is missing from help ${id}`, | ||
| ); | ||
| } | ||
| }, | ||
| ); | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.