{"record":{"id":"ab7448bc76aace27","repo":"slopus/happy","slug":"unsupported-codex-goal-action","errorCode":null,"errorMessage":"Unsupported Codex goal action","messagePattern":"Unsupported Codex goal action","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/codex/runCodex.ts","lineNumber":626,"sourceCode":"                threadId,\n                objective: command.objective,\n            });\n            updateCodexGoalState({\n                type: 'thread_goal_updated',\n                threadId,\n                goal: result.goal,\n            });\n            messageBuffer.addMessage('Goal updated', 'status');\n            return true;\n        } catch (error) {\n            logger.debug('[Codex] Goal command API failed; falling back to normal turn:', error);\n            return false;\n        }\n    };\n    session.rpcHandlerManager.registerHandler('goal-action', async (params: Record<string, unknown>) => {\n        const command = parseCodexGoalActionParams(params);\n        if (!command) {\n            throw new Error('Unsupported Codex goal action');\n        }\n\n        const threadId = client.threadId;\n        if (!threadId) {\n            throw new Error('No active Codex thread');\n        }\n\n        const handled = await handleCodexGoalCommand(command, threadId);\n        if (!handled) {\n            throw new Error('Codex goal actions are not supported by this runtime');\n        }\n\n        return { ok: true };\n    });\n\n    // Approval handler: routes server → client approval requests to our permission handler\n    client.setApprovalHandler(async (params) => {\n        const toolName = params.type === 'exec'","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/codex/runCodex.ts#L608-L644","documentation":"The 'goal-action' RPC handler in runCodex validates incoming params with parseCodexGoalActionParams(); if parsing fails (unknown action name or malformed params) it throws 'Unsupported Codex goal action'. Only actions recognized by the parser are supported by this runtime.","triggerScenarios":"A remote (mobile/app) client sends a `goal-action` RPC whose params do not match the expected schema: unknown action string, missing required fields, or wrong types.","commonSituations":"Newer mobile app version sending a goal action the CLI version doesn't know; mismatched CLI/app versions after a partial update; corrupted or hand-crafted RPC payloads.","solutions":["Update both happy CLI and the mobile client to matching latest versions","Check the action name and payload against parseCodexGoalActionParams' accepted schema","Log/inspect the incoming `params` to see what failed validation","Handle the rejection on the caller side and surface 'update your CLI' guidance"],"exampleFix":"// before\nsendGoalAction('pause'); // older CLI doesn't recognize it -> throws\n\n// after\nupdate happy-cli to latest; then verify the action is in the supported set before sending","handlingStrategy":"validation","validationCode":"const SUPPORTED_GOAL_ACTIONS = ['start', 'stop', 'pause'] as const;\ntype GoalAction = typeof SUPPORTED_GOAL_ACTIONS[number];\nfunction isSupportedGoalAction(params: Record<string, unknown>): params is { action: GoalAction } {\n  return SUPPORTED_GOAL_ACTIONS.includes(params.action as GoalAction);\n}\nif (!isSupportedGoalAction(params)) throw new Error('Unsupported Codex goal action');","typeGuard":"function isGoalActionParams(p: unknown): p is { action: string; threadId?: string } {\n  return typeof p === 'object' && p !== null && 'action' in p && typeof (p as any).action === 'string';\n}","tryCatchPattern":"try {\n  await rpc('goal-action', params);\n} catch (error) {\n  if ((error as Error).message === 'Unsupported Codex goal action') {\n    console.warn('CLI does not support this goal action; update happy-cli.');\n  } else { throw error; }\n}","preventionTips":["Keep CLI and mobile client versions in sync","Version the goal-action RPC params schema","List supported actions in an RPC capability response the app can consult"],"tags":["codex","rpc","validation","version-mismatch"],"backgroundTag":"unsupported-action","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}