fix(frontend): Pi permissions controls hidden when agent config omits harness.kind - #5675
Conversation
… harness.kind The runner treats an absent harness.kind as pi_core, but the UI read path left harnessValue as null, so isPiHarness and hasPiPermissions were false and PiPermissionsControl never rendered. Extracted resolveHarnessKind helper that defaults to 'pi_core' when kind is absent, aligning the UI with the runner. The default is read-path only; it never writes kind back into the saved config. Closes Agenta-AI#5661
|
@waterWang is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
|
|
Hi @waterWang, thanks for opening a pull request. 🙏 This PR was automatically closed because it does not yet meet our contribution requirements:
We ask for this so every change is documented and demonstrably tested before review. How to get it reopened See the Contributing guide and Creating your first PR. If you think this was closed in error, leave a comment and a maintainer will take a look. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Disabled knowledge base sources:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change adds ChangesHarness kind handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for picking this up, and thanks for the tests. The approach is right: the runner treats a missing Three things before we can merge this. 1. Prettier fails on the new test file. The only difference is a missing newline at the end of cd web && pnpm format-fix2. The CLA is not signed yet. We cannot merge without it, independent of the code. The CLA bot comment on this PR has the link. 3. Two more places still read the raw value. // in the HarnessSelectControl inside the "Harness" RailField
value={resolveHarnessKind(harness)}
// in modelSummary
enumLabel(harnessProps.kind, resolveHarnessKind(harness))One optional nit, not a blocker: two of the test cases are the same assertion, Everything else looks good. The package test suite passes on your branch, TypeScript and ESLint are both clean, and the change is scoped to the two files it should touch. |
Symptom
When an agent config omits
harness.kind, the runner treats the harness aspi_core— all seven Pi built-ins are active and theharness.permissionsallow/ask/deny rules are enforced at runtime. The web UI does not apply the same default, so for such a config the Pi permissions controls are hidden while the run enforces Pi permission gating. The author cannot see or edit the rules that apply to their runs.Before
Root Cause
In
useModelHarness.tsx,harnessValuestayednullwhenharness.kindwas absent (line 174), soisPiHarnesswasfalseandhasPiPermissionshidPiPermissionsControl.Fix
Extracted a small exported helper
resolveHarnessKindthat defaults to"pi_core"whenharness.kindis absent (matching the runner's default). The default is read-path only — it never writeskindback into the saved config.Coverage
null/undefinedharness →"pi_core"{harness: {}}→"pi_core"{harness: {kind: "claude"}}→"claude"(not overridden)Validation
All 310 tests pass (20 test files, including 9 new tests for
resolveHarnessKind):No lint errors.
AI Model
This change was produced by DeepSeek V4 Flash (Hermes Agent) with web research and unit test verification. The implementation follows the step-by-step instructions left by @mmabrouk in the issue.
Closes #5661