MCPcopy
hub / github.com/claude-code-best/claude-code / launchRemoteReview

Function launchRemoteReview

src/commands/review/reviewRemote.ts:129–319  ·  view source on GitHub ↗
(
  args: string,
  context: ToolUseContext,
  billingNote?: string,
)

Source from the content-addressed store, hash-verified

127 * (ultrareviewCommand.tsx handles the dialog).
128 */
129export async function launchRemoteReview(
130 args: string,
131 context: ToolUseContext,
132 billingNote?: string,
133): Promise<ContentBlockParam[] | null> {
134 const eligibility = await checkRemoteAgentEligibility()
135 // Synthetic DEFAULT_CODE_REVIEW_ENVIRONMENT_ID works without per-org CCR
136 // setup, so no_remote_environment isn't a blocker. Server-side quota
137 // consume at session creation routes billing: first N zero-rate, then
138 // anthropic:cccr org-service-key (overage-only).
139 if (!eligibility.eligible) {
140 const blockers = (
141 eligibility as { eligible: false; errors: Array<{ type: string }> }
142 ).errors.filter(e => e.type !== 'no_remote_environment')
143 if (blockers.length > 0) {
144 logEvent('tengu_review_remote_precondition_failed', {
145 precondition_errors: blockers
146 .map(e => e.type)
147 .join(
148 ',',
149 ) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
150 })
151 const reasons = (blockers as BackgroundRemoteSessionPrecondition[])
152 .map(formatPreconditionError)
153 .join('\n')
154 return [
155 {
156 type: 'text',
157 text: `Ultrareview cannot launch:\n${reasons}`,
158 },
159 ]
160 }
161 }
162
163 const resolvedBillingNote = billingNote ?? ''
164
165 const prNumber = args.trim()
166 const isPrNumber = /^\d+$/.test(prNumber)
167 // Synthetic code_review env. Go taggedid.FromUUID(TagEnvironment,
168 // UUID{...,0x02}) encodes with version prefix '01' — NOT Python's
169 // legacy tagged_id() format. Verified in prod.
170 const CODE_REVIEW_ENV_ID = 'env_011111111111111111111113'
171 // Lite-review bypasses bughunter.go entirely, so it doesn't see the
172 // webhook's bug_hunter_config (different GB project). These env vars are
173 // the only tuning surface — without them, run_hunt.sh's bash defaults
174 // apply (60min, 120s agent timeout), and 120s kills verifiers mid-run
175 // which causes infinite respawn.
176 //
177 // total_wallclock must stay below RemoteAgentTask's 30min poll timeout
178 // with headroom for finalization (~3min synthesis). Per-field guards
179 // match autoDream.ts — GB cache can return stale wrong-type values.
180 const raw = getFeatureValue_CACHED_MAY_BE_STALE<Record<
181 string,
182 unknown
183 > | null>('tengu_review_bughunter_config', null)
184 const posInt = (v: unknown, fallback: number, max?: number): number => {
185 if (typeof v !== 'number' || !Number.isFinite(v)) return fallback
186 const n = Math.floor(v)

Callers 1

launchAndDoneFunction · 0.85

Calls 10

logEventFunction · 0.85
posIntFunction · 0.85
teleportToRemoteFunction · 0.85
getDefaultBranchFunction · 0.85
registerRemoteAgentTaskFunction · 0.85
getRemoteTaskSessionUrlFunction · 0.85
execFileNoThrowFunction · 0.50

Tested by

no test coverage detected