Skip to content

fix(catalog): restore companion runtime_policy on member rows - #12686

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Premshay:fix/catalog-runtime-policy
Oct 1, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Premshay:fix/catalog-runtime-policy

Conversation

@Premshay

@Premshay Premshay commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An edition that projects engine capabilities can tell the agent picker, per member, whether that agent's model is selectable.

GET /api/agents/catalog (introduced in #12224) ships member rows with no
per-agent runtime_policy. An edition that projects engine capabilities
through the platform seam therefore has no channel to publish per-agent model
selection, and every agent in the picker shows the configured default
backend's models.

Why it matters

With the field, a companion edition's picker gates per-agent model discovery
on runtime_policy.model == "selectable"; without it the edition loses
per-agent model selection entirely.

Not a goal

  • Implementing any policy in the public edition: the seam returns None here and public rows are unchanged.
  • Exposing the policy to non-owner (redacted) catalog requests.
  • Changing how the picker reads the field; the consumer lives in the companion.

What changed (motivation → approach → change)

  • Declare the optional ProviderRegistry.agent_runtime_policy(agent_name) seam
    in src/kiro_crew/platform/interfaces.py (returns dict | None; the public
    edition supplies no implementation).
  • The catalog handler reads the seam the way the other dashboard handlers do —
    safe_context_call(lambda: current_context().providers, fallback=None) — and
    emits runtime_policy on a member row exactly when the seam supplies a dict.
    The field is omitted when the seam is absent, so the public edition's rows
    are unchanged.
  • The lookup key is the member's kiro_agent, falling back to its roster alias
    when empty. The policy is read and emitted only for owner-visible rows: a
    redacted (non-owner) request neither queries the seam nor carries the field,
    the same contract every other member-row field follows. Template rows never
    carry it.
  • Fix the dead wiring in the first revision, which read
    request.app["platform_context"], an aiohttp app key nothing installs; that
    version could never emit.
  • This is an ADDITION, not a restore: this repository's history never carried
    the field (an equivalent seam lived in the fork's lineage, never upstream).
    The consumer is the edition's dashboard picker, owned out-of-repo by the
    companion.

Backwards compatibility

Compatible: adds an optional, default-absent seam; nothing main currently
accepts is rejected, renamed or removed, and public-edition rows are unchanged.

Tests

Two cases in test/test_agent_execution_catalog.py pin propagation through
the composed seam and omission without a companion; the file passes 19/19.

Manual verification

N/A — unit coverage sufficient: both emission and omission are exercised
through the real endpoint, and the public-edition path is the omission case.

Related Issues

Pattern harvest

Rule candidate: review-prompt
Pattern: a platform-seam field whose only reader falls back silently when the
field is absent; pair every seam-field removal with a propagation test for
each reader.

@Premshay
Premshay requested review from a team and patrigao September 22, 2026 02:16
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 22, 2026
@dwu96

dwu96 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Problem / Motivation
  • ## Why it matters

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from 756f053 to c6f0117 Compare September 22, 2026 14:21
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 22, 2026
@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from c6f0117 to 832a3d9 Compare September 23, 2026 07:28
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 216ac3d06f596e62d7aa7044e9f48707f2308dfb via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 216ac3d

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 216ac3d06f596e62d7aa7044e9f48707f2308dfb via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the out-of-repo companion keys its policy by kiro_agent with roster-alias fallback — the lookup-key contract only the companion side can confirm.

Suggestions

  • The returned dict is emitted into web.json_response outside the safe_context_call guard; a non-JSON-serializable value from a buggy companion would 500 the whole catalog for owners. A serializability check (or round-trip) inside _agent_runtime_policy keeps a bad policy to a dropped field instead of a dead picker.

[DESIGN-REVIEWED] 216ac3d

Description read

[DESCRIPTION-READ] 42f19ab52d7decb372dd2c45b78d9142cd5b5590f68253ad5588f52f480645a0

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of 216ac3d06f596e62d7aa7044e9f48707f2308dfb via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

Core contract gains a method and wire field with zero in-repo consumers — the stated consumer is out-of-repo and uncheckable — under a fix…restore title the description itself retracts.

Not justified as shipped

  • Item 1 — zero consumers: grep runtime_policy over src/ counts 0 readers of the emitted field; the harm rests entirely on the description's claim about an out-of-repo consumer ("the consumer is the edition's dashboard picker, owned out-of-repo by the companion"), with no linked report — and the framing is self-contradicted: the title says "restore" while the description says "This is an ADDITION, not a restore: this repository's history never carried the field." The documented CPP pattern makes an edition-consumed seam legitimate in principle, which is why this is CONCERNS, not BLOCK.
    Subtraction: defer ProviderRegistry.agent_runtime_policy and the row field until the companion consumer exists; the companion can meanwhile serve its advisory policy from its own route via the existing DashboardContributor.contribute_routes seam (src/kiro_crew/platform/interfaces.py), leaving the core contract untouched.
    Clears when: the companion-side picker consumer is pointed at (a companion change or maintainer confirmation that it gates on runtime_policy.model == "selectable"), and the title type reads feat.

What this change ships

Inventory (5 items) — 4 justified

Intent: give a companion edition a channel to publish per-agent model-selection metadata on the agent picker's catalog rows — an ADDITION by the description's own statement, despite the fix…restore title.

  1. Owner-visible member rows of GET /api/agents/catalog may carry a companion-supplied runtime_policy dict — zero consumers (stated consumer is out-of-repo)
  2. New CPP seam ProviderRegistry.agent_runtime_policy, public default None, wired at one call site — justified
  3. Redacted (non-owner) requests neither query nor emit the policy; template rows never carry it — justified
  4. Seam lookup failures log at debug and omit the field; composition errors propagate — justified
  5. platform-context.md documents the seam in the same commit — justified

[FIRST-PRINCIPLES-REVIEWED] 216ac3d

Description read

[DESCRIPTION-READ] e5d59100de800fa76f46dc8135e99ce6bb82555838509068eaa8950c80a70e08

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 216ac3d06f596e62d7aa7044e9f48707f2308dfb via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 216ac3d

@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from 832a3d9 to 309e8b2 Compare September 23, 2026 21:26
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from 309e8b2 to b1e361b Compare September 24, 2026 09:44
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 24, 2026
@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from b1e361b to 5ebbcc3 Compare September 24, 2026 21:55
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 26, 2026
@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from da7e78a to 1582107 Compare October 1, 2026 08:52
@Premshay
Premshay requested a review from a team as a code owner October 1, 2026 08:52
@Premshay
Premshay requested a review from cruisercohen October 1, 2026 08:52
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 1, 2026
@Premshay
Premshay force-pushed the fix/catalog-runtime-policy branch from 1582107 to 216ac3d Compare October 1, 2026 09:51
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 1, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed. The seam is read and emitted only under if not redact (redacted test covers four caller shapes), DefaultProviderRegistry.agent_runtime_policy returns None so standalone is unchanged, and an older companion lacking the method is caught by safe_context_call with the field omitted.

Non-blocking: title says restore while the body says addition; the Tests section says two cases but the diff adds five functions; deleting the isinstance(policy, dict) guard at agent_catalog.py:56 survives every test.

@iamwhatever
iamwhatever enabled auto-merge (squash) October 1, 2026 16:05
@iamwhatever
iamwhatever merged commit fa1b47d into kirodotdev:main Oct 1, 2026
109 of 116 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 1, 2026
bolichen97 pushed a commit that referenced this pull request Oct 3, 2026
Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com>
(cherry picked from commit fa1b47d)
bolichen97 pushed a commit that referenced this pull request Oct 3, 2026
Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com>
(cherry picked from commit fa1b47d)
bolichen97 pushed a commit that referenced this pull request Oct 3, 2026
Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com>
(cherry picked from commit fa1b47d)
bolichen97 added a commit that referenced this pull request Oct 3, 2026
…/0.8.0) (#16385)

* fix(catalog): restore companion runtime_policy on member rows (#12686)

Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com>
(cherry picked from commit fa1b47d)

* fix(agents): let an installed agent become the default agent (release/0.8.0)

Backport of #16323, #16410, #16455, #16512 to release/0.8.0, cherry-picked in main's merge order.

* fix(agents): let an installed agent become the default agent (#16323)
  (cherry picked from commit 5c6268a)
  Backport adaptation: test/integration/conftest.py conflicted only on context; the
  source's added reset lines (config_loader import, docstring bullet, the three
  _MATERIALIZED_* resets and checks) were applied, nothing else. Every other file
  applied cleanly.

* fix(agents): reset a default agent only when its template was removed (#16410)
  (cherry picked from commit f16fa23)
  Backport adaptation: test/integration/conftest.py conflicted on context only (a
  main-only updates-loop entry next to it); only this change's _MATERIALIZED_SEEN
  lines were applied. Every other file applied cleanly.

* fix(agents): harden the default-agent healer and the file-name map (#16455)
  (cherry picked from commit 4a11ed2)
* fix(agents): heal a default agent only after a scan that read every spec (#16512)
  (cherry picked from commit 4576a29)

---------

Co-authored-by: Premshay <premshay@gmail.com>
Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com>
@Premshay
Premshay deleted the fix/catalog-runtime-policy branch November 13, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants