fix(frontend): pi permissions controls hidden when harness kind missing - #5706
fix(frontend): pi permissions controls hidden when harness kind missing#5706oforiwaasam wants to merge 6 commits into
Conversation
|
@oforiwaasam is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
✅ Thanks @oforiwaasam! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe UI now defaults missing or invalid harness kinds to ChangesHarness kind defaulting
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/agenta-entity-ui/tests/unit/useModelHarness.test.ts (1)
1-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the module comment.
The six-line comment only describes the test file. The repository guideline allows at most one short in-code comment unless it documents a surprising constraint. Replace it with one short line or remove it.
Proposed fix
-/** - * Unit tests for the resolveHarnessKindValue function used by the model harness UI. - * - * These tests lock in the fallback behavior for omitted or undefined harness values and confirm - * that explicit harness selections such as `pi_agenta` and `claude` are preserved unchanged. - * Runs under `@agenta/entity-ui`'s own vitest runner. - */ +// Tests harness-kind fallback and explicit values.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1070ef17-4d4f-44b8-86bc-92da46a58035
📒 Files selected for processing (2)
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsxweb/packages/agenta-entity-ui/tests/unit/useModelHarness.test.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
The 6-line module docstring on useModelHarness.test.ts violated the documented rule (web/CLAUDE.md): at most one short line per comment unless it documents a surprising constraint. CodeRabbit review nit.
|
@coderabbitai resolve merge conflicts |
|
❌ An unexpected error occurred while resolving merge conflicts: Not Found - https://docs.github.com/rest/git/refs#get-a-reference |
Summary
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.Where the gap is: in
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx,harnessValuestaysnullwhenharness.kindis absent (line 174), soisPiHarnessis false (line 175) andhasPiPermissions(line 379) hidesPiPermissionsControl.This is a visibility gap only; the runtime permission gate (including
allow_reads) still applies. The UI should treat an absentharness.kindaspi_core, matching the runner, with coverage for the{harness: {}}case.Demo
Testing
Verified locally
pnpm --filter @agenta/entity-ui testpasses.Added or updated tests
Tests verify the following:
pi_core.pi_agentaandclaudeare preserved as-is.QA follow-up
pnpm lint-fixpasses with no issues.AI Model Usage
This change was assisted by GitHub Copilot (MAI-Code-1-Flash) on VS code following the step-by-step instructions in the issue description.
Issue
Closes #5661