#23680: fix(types): add missing config and agentDir params to maybeMarkAuthProfileFailure
agents
size: XS
Cluster:
Error Handling in Agent Tools
## Problem
The `maybeMarkAuthProfileFailure` function in `src/agents/pi-embedded-runner/run.ts` was accessing `params.config` and `params.agentDir` but these properties were not declared in the parameter type definition. This caused TypeScript compilation errors during the plugin SDK build step:
```
src/agents/pi-embedded-runner/run.ts(515,23): error TS2339: Property 'config' does not exist on type '{ profileId?: string | undefined; reason?: AuthProfileFailureReason | null | undefined; }'.
src/agents/pi-embedded-runner/run.ts(516,28): error TS2339: Property 'agentDir' does not exist on type '{ profileId?: string | undefined; reason?: AuthProfileFailureReason | null | undefined; }'.
```
## Solution
1. Added `import type { OpenClawConfig } from "../../config/types.openclaw.js"` to import the required type
2. Extended the parameter type for `maybeMarkAuthProfileFailure` to include:
- `config?: OpenClawConfig`
- `agentDir?: string`
These properties match the types expected by the `markAuthProfileFailure` function that is called within the handler, and are already present in the outer `RunEmbeddedPiAgentParams` type.
## Testing
- ✅ TypeScript compilation passes (`pnpm build`)
- ✅ Type checking passes (`pnpm tsgo`)
- ✅ Linting passes (`pnpm lint`)
- ✅ Full test suite passes (`pnpm test`)
---
*This PR was created with AI assistance as part of the OpenClaw autonomous contributor system.*
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed TypeScript compilation errors by adding missing `config` and `agentDir` parameters to the `maybeMarkAuthProfileFailure` function type definition.
**Critical Issue:**
- This PR conflicts with commit 6268ed57 on main which already fixed the underlying problem by renaming the parameter to avoid shadowing and using the outer scope's `agentDir` constant
- The current approach adds these properties to the inner function's parameter type, but call sites don't pass these values, so they'll be `undefined` at runtime
- The PR needs to be rebased on current main where the issue is already properly resolved
<h3>Confidence Score: 0/5</h3>
- This PR should not be merged as it conflicts with a fix already on main and will introduce runtime bugs
- The PR is based on outdated code and conflicts with commit 6268ed57 which already fixed the parameter shadowing issue. Merging this would reintroduce the shadowing bug and cause `config` and `agentDir` to be undefined at runtime since call sites don't pass these values.
- src/agents/pi-embedded-runner/run.ts requires rebasing on current main branch
<sub>Last reviewed commit: c0e100f</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23691: fix(pi-runner): resolve param shadowing in maybeMarkAuthProfileFailure
by irchelper · 2026-02-22
84.6%
#21646: fix(cron): pass agentDir to runEmbeddedPiAgent for correct auth res...
by zhangjunmengyang · 2026-02-20
77.0%
#11854: fix: resolve per-agent tools.exec config in pi-tools
by Yida-Dev · 2026-02-08
74.5%
#22707: fix: pass agentDir to runEmbeddedPiAgent in cron isolated sessions
by mrlerner · 2026-02-21
74.2%
#7085: test: skip flaky workspace-paths & safe-bins tests on non-Linux/CI ...
by ThinkIbrokeIt · 2026-02-02
74.1%
#22845: Pass agentDir through cron and followup embedded runs
by seilk · 2026-02-21
73.7%
#21027: fix(tests): resolve TypeScript type errors in CLI test files
by kittipond2365 · 2026-02-19
73.4%
#6136: fix(agents): cast streamParams to allow cacheRetention property ass...
by macd2 · 2026-02-01
73.1%
#13176: fix: resolve llm-task module import for global installs
by striking · 2026-02-10
72.9%
#20851: fix: harden resolveUserPath and compact against undefined workspaceDir
by davidrudduck · 2026-02-19
72.9%