Skip to content

fix(frontend): pi permissions controls hidden when harness kind missing - #5706

Open
oforiwaasam wants to merge 6 commits into
Agenta-AI:release/v0.112.2from
oforiwaasam:fix/pi-permissions-hidden-controls
Open

fix(frontend): pi permissions controls hidden when harness kind missing#5706
oforiwaasam wants to merge 6 commits into
Agenta-AI:release/v0.112.2from
oforiwaasam:fix/pi-permissions-hidden-controls

Conversation

@oforiwaasam

@oforiwaasam oforiwaasam commented Aug 3, 2026

Copy link
Copy Markdown

Summary

When an agent config omits harness.kind, the runner treats the harness as pi_core: all seven Pi built-ins are active and the harness.permissions allow/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, harnessValue stays null when harness.kind is absent (line 174), so isPiHarness is false (line 175) and hasPiPermissions (line 379) hides PiPermissionsControl.

This is a visibility gap only; the runtime permission gate (including allow_reads) still applies. The UI should treat an absent harness.kind as pi_core, matching the runner, with coverage for the {harness: {}} case.

Demo

image image image

Testing

Verified locally

pnpm --filter @agenta/entity-ui test passes.

Test Files  20 passed (20)
      Tests  303 passed (303)
   Start at  12:43:37
   Duration  6.00s (transform 14.79s, setup 0ms, import 38.21s, tests 82ms, environment 1ms)

Added or updated tests

Tests verify the following:

  • Missing or undefined harness values default to pi_core.
  • Explicit harness values like pi_agenta and claude are preserved as-is.

QA follow-up

pnpm lint-fix passes with no issues.

Tasks:    11 successful, 11 total
Cached:    0 cached, 11 total
  Time:    41.251s 

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

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@oforiwaasam is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug frontend labels Aug 3, 2026
@CLAassistant

CLAassistant commented Aug 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✅ Thanks @oforiwaasam! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon.

@github-actions github-actions Bot added the incomplete pr PR is missing required template sections or a demo recording label Aug 3, 2026
@github-actions github-actions Bot closed this Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved model harness handling by applying a consistent default when the harness type is missing or invalid.
    • Fallback behavior now uses pi_core instead of leaving the harness type unset.
  • Tests

    • Added coverage for default and explicitly specified harness types.

Walkthrough

The UI now defaults missing or invalid harness kinds to pi_core. Model handling, summaries, and fallback harness selection use the shared resolver. Unit tests cover default and explicit harness kinds.

Changes

Harness kind defaulting

Layer / File(s) Summary
Resolver contract and coverage
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx, web/packages/agenta-entity-ui/tests/unit/useModelHarness.test.ts
Adds resolveHarnessKindValue, which preserves string values and defaults other values to pi_core. Tests cover omitted, undefined, and explicit kinds.
Harness value integration
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
Uses the resolver for model handling, model summaries, and fallback harness selection.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #5661 by defaulting missing harness.kind to pi_core and preserving explicit harness values.
Out of Scope Changes check ✅ Passed The changes are limited to harness-kind resolution and focused unit tests required by issue #5661.
Title check ✅ Passed The title clearly identifies the frontend fix for hidden Pi permission controls when the harness kind is missing.
Description check ✅ Passed The description explains the missing harness-kind default, the UI visibility gap, the implementation, and the validation performed.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot removed the incomplete pr PR is missing required template sections or a demo recording label Aug 3, 2026
@github-actions github-actions Bot reopened this Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Shorten 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

📥 Commits

Reviewing files that changed from the base of the PR and between 69e2165 and a1e4760.

📒 Files selected for processing (2)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
  • web/packages/agenta-entity-ui/tests/unit/useModelHarness.test.ts

@ashrafchowdury ashrafchowdury added bug report Something isn't working and removed bug labels Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

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.
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 10, 2026
@bekossy
bekossy requested a review from ardaerzin August 17, 2026 10:31
@bekossy
bekossy changed the base branch from main to release/v0.112.2 August 17, 2026 10:33
@bekossy

bekossy commented Aug 17, 2026

Copy link
Copy Markdown
Member

@coderabbitai resolve merge conflicts

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

An unexpected error occurred while resolving merge conflicts:

Not Found - https://docs.github.com/rest/git/refs#get-a-reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug report Something isn't working frontend lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(bug) Pi permissions controls are hidden when the agent config omits harness.kind

4 participants