Skip to content

feat(acp): make Qoder a selectable ACP backend behind a pinned ask rule - #19245

Open
atomsbaza wants to merge 1 commit into
kirodotdev:mainfrom
atomsbaza:feat/qoder-selectable
Open

atomsbaza wants to merge 1 commit into
kirodotdev:mainfrom
atomsbaza:feat/qoder-selectable

Conversation

@atomsbaza

@atomsbaza atomsbaza commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Qoder CLI can be chosen as the agent harness in Kiro Crew, with every tool call it makes still reaching Kiro Crew's approval gate (or the session being refused or stopped).

Qoder CLI serves ACP natively (qodercli --acp) and #13803 asks for it as a backend. #15038 landed it as a known-but-not-selectable id because two things that decide the approval gate were unmeasured: whether an operator's own Qoder permission rules or hooks can run a tool without raising session/request_permission, and where the sign-in lives. Those measurements are now done on a real binary, so this PR makes it selectable and replaces #15038 (Supersedes #15038; Refs #13803).

Why it matters

Without it, a user who already works in Qoder cannot use it from Kiro Crew, and the onboarding page tells them it is "not ready on this host". Making it selectable without a measured gate would be worse than leaving it dormant: a harness whose tool calls bypass Kiro Crew's deny rules and audit log.

Not a goal

  • Choosing a context-window size (200K/400K/1M). Qoder does not expose it over ACP; the model rows report an unknown window instead of a made-up one.
  • Mid-turn steering, /compact, session eviction or sharing: measured as not available over ACP or not measured, so they stay out of their capability sets.
  • Operator USER-level Qoder settings (~/.qoder/settings.json allow rules/hooks) and where allow_always would persist: not measured (needs writes to the operator's real config).
  • Any qodercli release other than the measured one (1.1.67). Newer releases are refused until re-measured.
  • Showing display names in the other model pickers (crew profile, templates, knowledge settings, ...) beyond the chat picker, the default-model and selectable-models settings and the composer chip.

What changed (motivation → approach → change)

Gate. qodercli cannot read back its resolved permission rules, so nothing is claimed as "verified"; the measured behaviour is in harness-onboarding.md. New Routing.PINNED_ASK_RULE pins --settings {"permissions":{"ask":["*"],"defaultMode":"default"},"disableAllHooks":true}, --permission-mode default and --strict-mcp-config (measured to beat a project file that allows everything, an allow-returning hook and --allowed-tools, and to gate MCP tools), and adds: an exact version gate (1.1.67; the refusal names the install command), a default-mode read-back plus a mid-session mode tripwire, an unasked-tool-call tripwire keyed by toolCallId (armed by the first live prompt, bounded bookkeeping, fails closed), allow_always never selected, QODER_* env scrubbed, PID reclaim by the --acp argv token. Hooks: with the old argv a project .qoder/settings.json PreToolUse command hook fired outside Kiro Crew's gate and audit; with disableAllHooks inline it does not (probe on the real 1.1.67: marker written in 4 of 4 control runs, 0 of 6 runs with the key; the permission request was still raised for Bash, Read, Write and an MCP tool; the inline value also beat a project-tier disableAllHooks:false in settings.json and settings.local.json). Cost: the operator's own user-level and plugin hooks do not run in Crew-run Qoder sessions (the Kiro-derived spec and the Claude Side Chat already accept that). Not measured: user-level hooks, non-command hook types, events other than PreToolUse, a mid-session settings rewrite, managed tiers, other releases (docstring and onboarding doc list them). A mode move that arrives after the session response and before the first prompt is no longer checked in the init drain (that keeps the Kiro drain unchanged, H13); it is caught by the unasked-call tripwire when a tool call starts.

Models and effort. The picker lists the models the harness advertises, with display names (the id stays the wire value; unlisted ids are refused). The catalog is re-read per session and by a 10-minute handshake-only probe that fails closed; it is separate from _CatalogCache because Qoder's catalog must survive a restart (observed-at stamp). Effort levels are ordered least to most effort for Qoder only (ACP_BACKENDS_EFFORT_LADDER_ORDERED); change_effort no longer reports success for a write that was not made. Labels apply to exclusive catalogs only.

Sign-in and the rest. No ACP authenticate is sent (measured: a browser round trip per session); a signed-out -32000 maps to "run qodercli login", Qoder only. ~/.qoder/.auth is the credential leaf. The gate lives in a new owner module, acp/client_qoder.py; shared functions carry only guarded hooks. Review lane: the change edits tool_gate.py, a sensitive path, so it needs the maintainer take-over.

Where the Qoder branches live. The runtime witnesses no longer sit inside shared paths. ProcessAdapter gained three seams with no-op defaults, on_initialized, on_session_opened and catalog_probe, and QoderLaunch implements them. client_start.py and client_model_selection.py now call the seams unconditionally, so neither file tests for Qoder or for ACP_BACKENDS_ADVERTISED_MODEL_EXCLUSIVE; git grep for either name in those two files returns nothing. The new CatalogProbePolicy answers two separate questions: whether a probe may run at all, and which verb ends the session that answered it. Qoder answers with session/close, taken from the recorded 1.1.67 frames, so the 10-minute catalog probe no longer leaves a session behind on every poll. provider_models.json keeps its id-list shape for every provider; only the catalog whose host authors labels (Qoder) is stored as stamped rows, so adding labels for one backend no longer changes the persisted shape for the rest.

Backwards compatibility

Compatible: the new routing member, sets and tables only add a harness; no existing harness's accepted values change. No existing harness changes behaviour. The one place a shared path was touched: change_effort still treats an adapter's "unknown config option" answer as before for every harness (skipped, no session reset); only Qoder, whose effort option can disappear after a model switch, reports failure and rolls the effort push back. persist_advertised_models now writes each provider's rows through advertised_model_rows, so an ids-only catalog (kiro/KAS, old sidecars) survives a restart instead of being written as empty rows. The model-label change is display-only and limited to exclusive catalogs. Downgrade: the advertised-model sidecar provider_models.json is now written as {"version": 1, "providers": ...} with rows and an observed-at stamp; model_registry._load_advertised_models reads both the old ids-only shape and the new one, but an older build reading the new file finds no lists and drops its cached picker catalogs until the next session repopulates them (nothing is lost permanently). The observed-at stamp is persisted only for exclusive catalogs (Qoder), so another backend's session start does not rewrite the file unless its catalog changed.

Nothing that main serves today is removed. The one take-away shape the PR Hygiene check detects is the sandbox mask the Qoder adapter passes at spawn (extra_hidden_dirs, the same refuse-then-mask preflight its sibling harnesses run). qodercli was a known id but never spawnable on main, so no existing session reads a path that mask hides; the readers it could affect are the three entries that spawn harness sessions:

Reader: src/kiro_crew/acp/harness/qoder.py:QoderLaunch.resolve_spawn -- chat -- qodercli was not spawnable on main, so no chat session read a path this mask now hides; test_acp_qoder_backend.py::test_credential_declaration_is_the_inferred_whole_auth_directory pins that the harness's own credential directory is carved out of the mask
Reader: src/kiro_crew/acp/harness/qoder.py:QoderLaunch.resolve_spawn -- subagent -- a subagent only reaches qodercli through the same selectable harness and the same spawn plan, with the same carve-out and no earlier Qoder subagent session to break; test_acp_qoder_backend.py::test_spawn_argv_pins_ask_rule_and_default_mode_and_has_no_escape_hatch
Reader: src/kiro_crew/acp/harness/qoder.py:QoderLaunch.resolve_spawn -- cron -- a cron child that selects Qoder takes the same spawn plan; there was no working Qoder cron on main to break; test_acp_qoder_backend.py::test_credential_declaration_is_the_inferred_whole_auth_directory

The catalog sidecar still accepts the old id-list shape and the new labeled shape in the same file, keyed per provider, so an older build reading the file sees the ids it expects and a downgrade keeps working.

Tests

  • test_acp_qoder_backend.py, test_acp_qoder_models.py, test_acp_qoder_effort_option_refresh.py: argv, version gate (1.1.17, 1.1.66, 1.1.68, 2.0.0, absent refused), mode read-back and tripwire, unasked-call tripwire lifecycle (reused ids, answer required, replay exemption, deny then run), allow_always never chosen, env scrub, catalog refresh add/remove/fail-closed/TTL/one-refresh-then-refuse, probe never prompts and kills the child, auto handling, effort option refresh and no false success.

  • Replay tests over scrubbed live corpora in test/fixtures/acp_frames/qoder/ (1.1.67 handshake, pinned ask, load replay with and without a tool call, the 17-model catalog, an unpinned bypass control, session-array MCP ask).

  • Guards updated or satisfied: capability sets, host-contract parity, harness parity, PID lifecycle exact partition, backend cards, black baseline, SDK boundary (the probe is reached through agent_sdk.drivers.acp), subagent scratch seam registry, log-sanitization sites, configuration doc backend table.

  • Sign-in: no authenticate is ever sent (normal start and catalog probe); the -32000 signed-out error maps to the qodercli login remedy only for Qoder with the exact code and message; the same code with other text, and non-Qoder clients, stay plain errors.

  • Tripwire bookkeeping: 20 approved-and-completed calls retain nothing; an approved call's mapping survives eviction pressure and a late reject still trips; overflow with every slot protected stops the harness (killed, audited, no leaked entries); every terminal status then a reused id trips; a duplicate terminal is treated as unasked (fail closed).

  • Replay snapshots: v167-load-replay-live and v167-load-replay-toolcall-live were re-recorded once for the message_id key main now emits on thinking/text chunks (7 added lines, nothing else changed).

  • Persistence: an ids-only catalog survives persist and reload; a changed kiro catalog replaces the cached rows instead of persisting stale ones; the aws_control packaging fence and the shared validator agree on the .qoder/.auth credential leaf.

  • Effort ordering unit tests (Qoder order, unknown level keeps advertised order, every other harness list unchanged) and the effort-option refresh after a model switch.

  • Frontend (vitest): label mapping, ChatPanel default-model/selectable-models/pin-notice labels, reply-footer label, the composer pin row showing the model name rather than its id, unknown context window handling (including cache clear).

  • Local runs on the final commit: the broad guard/ACP/permission/model run passed (the only red were two test_acp_bindings.py tests that were failing on main until test(providers): list approval_withdrawable and approve_tool's new signature #20902, which this branch now includes, and a dashboard boot-chain test that failed only in my worktree because it holds a built, git-ignored website/dist registering 8 extra app-window routes; it passes on a clean origin/main checkout). A related-tests gate run showed one code_review_sage test failing under load that passes alone.

  • Seam routing: on_initialized runs before session/load and session/new and a refusal there opens no session; on_session_opened sees the response that opened the session and its resumed flag; every other ProcessAdapter keeps the no-op default (asserted by the harness-parity suite).

  • Catalog probe: the probe's verb order is initialize → session/new → session/close, and a repeated probe does not grow the host's on-disk session count.

  • Sidecar shape: test_a_labeled_catalog_is_the_only_entry_whose_shape_changes pins that an ids-only provider stays an id list while the labeled catalog carries its stamp.

  • Copy: the three stop notices and the version refusal assert the plain-language wording, including the install command in the refusal.

Manual verification

Built from source (make build) and driven through a local gateway with the measured qodercli: the Agent Harness card lists Qoder; a mutating Bash call raises Kiro Crew's [a] allow once / [d] deny prompt and runs only after allow; deny creates nothing; a workspace whose own .qoder/settings.json allows everything and sets bypassPermissions still gets prompted for every call; the spawned process shows the pinned argv; GET /api/models returns the advertised catalog with names. A real session-less catalog probe returned the 17 models in about 9 s and left no process or temp directory behind; pointed at 1.1.17 it returned nothing (refused) in under 2 s.

Not verified: operator USER-level Qoder settings and hooks, where allow_always persists, and other qodercli releases. A Windows-only CI failure, test_pathres_loop_starvation.py::test_the_inline_anchors_are_the_bounded_anchors (an extra \\?\-prefixed spelling of a pytest temp directory in the inline set), appeared on one CI run of this branch and not on the previous one with no path-resolution change in between; nothing in this PR touches that code. A later Windows run (shard 7) failed test_app_mcp_tool_policy_scope, which passes locally on macOS; main has since changed that test and mcp_shared.py for an app on another Windows drive (#20802) and this branch is rebased onto it, but I could not re-run Windows to confirm that it was the cause. The effort slider appears only after a session exists on a reasoning-capable model (Qoder offers no effort option while the model is auto).

Screenshots / video

Built from this branch and run against the measured qodercli 1.1.67 through a local gateway (the two failure states use a gateway with no sign-in and one pointed at 1.1.17). The surfaces touched: the Agent Harness card, the Settings → Chat → Model lists, the composer model picker and chip, the reply footer, and the two refusal messages a user can hit when starting a Qoder chat.

Agent Harness card: the Qoder card with its supported-feature list; the card says Kiro Crew makes it always ask before each tool, and the sign-in line appears once

Agent Harness card with Qoder

Settings → Chat → Model: the Default Model select opened, listing Qoder's display names (the id stays the wire value)

Default Model select open with Qoder display names

Chat reply: a real Qoder turn; the reply footer and the composer chip show the model's display name, and the composer has no context meter because Qoder reports no window size

Chat reply with the model name and no context meter

Composer model picker: the picker lists the models Qoder advertises with their names and credit multipliers; the pin row names the model, not its id

Composer model picker open, pin row names the model

Not signed in: a qodercli with no login answers Authentication required; Kiro Crew says what to do and opens no browser tab

Not signed in message

Unsupported release: qodercli 1.1.17 is refused with the detected version and the one command that fixes it; the chat shows only that remedy (the gate explanation goes to the log), and Resume works once the right release is installed

Unsupported qodercli version message

Settings → Chat → Model, Selectable Models: the list opened, showing Qoder's display names with their credit multipliers

Selectable Models list with Qoder display names

Settings pin notice: with an explicit default model and an agent pinned to Ultimate, the notice names the pinned model by its display name. The pin itself is simulated: the screenshot was taken against the live gateway with the agent roster response intercepted, because writing a real agent pin would edit the operator's shared agent home

Pin notice naming the pinned model by display name

Composer effort block: the model picker on a reasoning-capable Qoder model (Ultimate) with the effort slider and the "Use default effort" switch off (Medium selected)

Composer model picker with the effort block for a Qoder model

Not shown: the stop that follows a mode change or an unasked tool call (a real qodercli cannot be made to do that without defeating the gate; the unit tests cover it).

Related Issues

Supersedes #15038. Refs #13803.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 12, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch 2 times, most recently from 4c288b0 to 6bb0bd8 Compare October 13, 2026 07:04
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 13, 2026
@atomsbaza
atomsbaza marked this pull request as ready for review October 13, 2026 11:25
@atomsbaza
atomsbaza requested review from a team and KiroCrewCaptain as code owners October 13, 2026 11:25
@atomsbaza
atomsbaza requested a review from mbriones98 October 13, 2026 11:25
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 93244abd150865c9bf9b0f85023059d9843ddcc3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The nine screenshots show every changed surface, but this fork lane has no blind first-time reader, so whether users understand it is still unknown; pushing the branch to this repository runs one.

Notes

  • The version-refusal text in tool_gate.py:_qoder_version_refusal doesn't match attachment-06. The shipped string is "This copy of Qoder CLI is not the one Kiro Crew was tested with…", and it drops the installed version ("this is 1.1.17") even though reported_version is available where the text is built. Name both versions ("Kiro Crew needs qodercli 1.1.67; this is {version}…") and attach a screenshot of the current text.
  • The version refusal ends "then start a new chat", but the banner and composer next to it only offer Resume. Either say whether Resume works after updating, or point to New so the copy and the visible button agree.

[UX-REVIEWED] 93244ab

Description read

[DESCRIPTION-READ] c01f6031dd2d35237a0ab5e7594d7b96c2c87646792d2515736ae887e55066e2

That sha256 names everything this verdict read: the PR description, plus the 12 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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 93244abd150865c9bf9b0f85023059d9843ddcc3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the gate fails closed (exact version pin, mode read-back, unasked-call tripwire, allow_always refused), and every Qoder branch sits behind a positive identity check or an adapter seam.

Notes

  • The description's downgrade text is out of date. The code writes no {"version": 1, "providers": ...} wrapper. It keeps the top-level per-provider map, so an older build only skips Qoder's object entry and keeps every other provider's catalog. Fix the ## Backwards compatibility sentence, which is not part of the frozen goal.
  • Accepting exactly one qodercli release (1.1.67) means each Qoder update breaks Crew sessions until someone re-measures and bumps QODER_MEASURED_VERSIONS. The refusal message names the install command, so a user can recover by pinning back. Write the re-measure procedure into harness-onboarding.md so a version bump doesn't depend on someone remembering how it was done.

[DESIGN-REVIEWED] 93244ab

Description read

[DESCRIPTION-READ] a123b87ba5a704df6c7ee39eddab86bd7244b783b83815468068c57cf0514df7

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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 910771c8ecf95ffd2da6bea83adce50288064bb0 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

provider_models.json changes shape for every backend so Qoder's catalog survives a restart, but the probe in this PR already refills it.

Not justified as shipped

  • Item 8 — inherited: "Qoder's catalog must survive a restart (observed-at stamp)" names no harm. When the stamp is missing, _maybe_refresh_qoder_catalog already probes on the first picker read. The cost is a versioned sidecar that older builds drop for every provider. It also overrides the recorded _CatalogCache decision: "the catalog is not persisted, which keeps a downgraded account's stale rows from surviving a restart".
    Subtraction: keep _ADVERTISED_MODEL_ROWS/_ADVERTISED_MODELS_OBSERVED_AT in memory only and revert persist_advertised_models/_load_advertised_models to the ids-only shape.
    Clears when: the persisted rows and stamp are removed, or the description names who is harmed by the bounded cold probe after a restart.
  • Item 9 — rides along: the description says "No existing harness changes behaviour". But the shared if advertised and target not in advertised: ... return False now makes change_effort roll back and return False on goose, pi and deepseek too.
    Subtraction: keep the not-advertised branch's old success result for every harness except ACP_BACKEND_QODER, the same way the unknown-option branch does.
    Clears when: that branch is scoped to Qoder, or the description states this change for the existing harnesses.

What this change ships

Inventory (9 items) — 7 justified

Intent: a Qoder user can run Kiro Crew on qodercli, with every tool call still going through Crew's gate. ADDITION.

  1. Qoder can be picked as the harness in the backend tab and onboarding — justified
  2. Qoder sessions run ask-every-tool with all Qoder hooks off, so the operator's own hooks don't run — justified
  3. Only qodercli 1.1.67 starts; other versions are refused with the install command — justified
  4. A session is stopped on a mode change, a tool call that was never asked, or bookkeeping overflow; allow_always is never chosen — justified
  5. A signed-out error tells the user to run qodercli login — justified
  6. The picker, composer chip, turn footer and settings show Qoder model names instead of ids like qfmodel — justified
  7. Qoder models show no context meter (window unknown) — justified
  8. provider_models.json gets a new versioned shape for every backend; a 10-minute probe refreshes Qoder's list — inherited (persistence half)
  9. A refused effort write is reported as failed, on existing harnesses too — rides along

[FIRST-PRINCIPLES-REVIEWED] 910771c

Description read

[DESCRIPTION-READ] 4bb019e3ff3cf0f651403f64bfb83168150ec4bc663515f4484d588aec0b5fbd

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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — 🔴 changes requested (blocking)

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

Blocks: the background Qoder catalog refresh is cancelled after the same 10s limit as the request, so the probe never gets its own launch bound and a slow cold start can never refresh the picker.

BLOCKING — src/kiro_crew/dashboard/handlers/agents_models.py:105

rows = await asyncio.wait_for(refresh_catalog(backend), timeout=request_timeout_secs)

Trigger: GET /api/models with a Qoder catalog older than 600s calls _maybe_refresh_qoder_catalog, then maybe_refresh_qoder_catalog with request_timeout_secs=_LIST_MODELS_SUBPROCESS_TIMEOUT_SECS (10s), then _bounded_refresh, then refresh_exclusive_catalog. That probe runs spawn, initialize (bounded by _INIT_TIMEOUT=240s), MCP prep, session/new (bounded by _ENTITLEMENT_PROBE_TIMEOUT=30s) and teardown. Its own bound is _INIT_TIMEOUT + _ENTITLEMENT_PROBE_TIMEOUT, but the inner wait_for overrides it with 10s. On a cold host this sequence takes longer than 10s.
Outcome: the probe is cancelled at 10s, at the same moment the outer shield wait gives up. The "shielded task finishes under its own launch bound" path the docstring promises never happens. On such a host no refresh ever completes. Every 30s retry window spawns and kills another qodercli, and the picker stays on the stale or empty catalog.
Anchor: defect
Fix: in _bounded_refresh, drop the inner wait_for, or bound it with the background ceiling (_LIST_MODELS_BACKGROUND_TIMEOUT_SECS, or refresh_catalog's own default timeout=None). Keep request_timeout_secs only on the outer wait_for(asyncio.shield(task), …).

[BLOCK-MERGE] 93244ab
[OPUS-REVIEWED] 93244ab

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

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

1 of 2 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- src/kiro_crew/acp/harness/qoder.py:109 -- Qoder MCP approvals bypass the MCP governance ceiling
await session._prepare_session_mcp()
Trigger: A Qoder session invokes a pooled MCP tool denied by policy, such as @crewdummy/ping; _extract_tool_event → _build_permission_event → _tier_governance ignores the captured _meta.qoder.toolName identity and evaluates the title ping (crewdummy) only against commands/tools scopes.
Outcome: A local approval executes the policy-denied MCP tool. The transport floor does not enforce policy, and Qoder’s tripwire accepts the approved call.
Anchor: backend-security-controls
Fix: Carry Qoder’s harness-authored MCP identity into the permission event and canonical governance query; refuse MCP approvals when that identity cannot be resolved.

BLOCKING -- src/kiro_crew/model_registry.py:554 -- Labeled catalog admission suppresses overflow reporting
break
Trigger: An ACP session advertises 513 distinct valid model IDs; _capture_available_models → refresh_advertised_model_rows → _admit_model_rows trims the catalog before passing its IDs to refresh_advertised_models and _admit_ids.
Outcome: Only 512 IDs are cached and persisted, with no overflow warning. The operator cannot distinguish admission refusal from models the backend never advertised; overlength IDs are likewise silently discarded.
Anchor: a-bound-bounds-every-field-it-retains
Fix: Apply _admit_ids to the original candidate IDs before retaining their labels, preserving once-per-snapshot refusal accounting.

[BLOCK-MERGE] 93244ab
[GPT-REVIEWED] 93244ab

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F2 — the harm reading would be LOW: a too-large catalog is trimmed with no warning, and the next session's refresh writes over it. But the finding's anchor, .review-base-rules/AUTOSDE.yaml:1281 (a-bound-bounds-every-field-it-retains), has blocking: true. Its rule (lines 1308–1311) says overflow must be "COUNTED and said out loud once per snapshot".
In the patch, _admit_model_rows stops at ADVERTISED_MODELS_MAX_IDS with a bare break and drops over-length ids without counting them. It then passes the already-trimmed ids to refresh_advertised_models. The warning in _admit_ids (model_registry.py:254) therefore never fires. The rule's flag outranks the weighing.

F1 (fenced) — UNBOUNDED, a governance-ceiling bypass. It only needs an operator who denies an MCP tool by policy and runs a Qoder session. That is ordinary operation, and the new qoder.py mounts the pooled MCP array on every session (await session._prepare_session_mcp()). No condition here is extreme enough to support a FLAG.

[ADJUDICATION] 93244abd150865c9bf9b0f85023059d9843ddcc3 total=1 uphold=1 downgrade=0
UPHOLD F2 src/kiro_crew/model_registry.py:554 reason=autosde-blocking-rule
[GPT-ADJUDICATED] 93244abd150865c9bf9b0f85023059d9843ddcc3

[ADJUDICATION-FENCED] 93244abd150865c9bf9b0f85023059d9843ddcc3 fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/acp/harness/qoder.py:109 -- A policy-denied MCP tool used in a Qoder session is an ordinary operator setup, not an extreme condition combination, so the governance-bypass claim stands.
[GPT-ADJUDICATED-FENCED] 93244abd150865c9bf9b0f85023059d9843ddcc3

@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from 6bb0bd8 to 9e02d81 Compare October 13, 2026 16:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 13, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from 9e02d81 to 287504f Compare October 15, 2026 14:28
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 15, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from 910771c to f3216ac Compare October 23, 2026 09:50
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 23, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from f3216ac to ef61cea Compare October 23, 2026 10:36
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 23, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from ef61cea to 93244ab Compare October 24, 2026 18:03
@atomsbaza

Copy link
Copy Markdown
Contributor Author

Dispositions for 93244abd15 (rebased onto 66b0bccc5f).

fixed — GPT 6.1 blocking, src/kiro_crew/acp/client.py:2431, H13.

The Qoder witnesses no longer run inside Kiro's initialization or entitlement-probe paths. ProcessAdapter now carries three seams with no-op defaults (on_initialized, on_session_opened, catalog_probe), and QoderLaunch implements them. client_start.py and client_model_selection.py call the seams unconditionally:

$ git grep -n "_is_qoder\|ACP_BACKEND_QODER\|ADVERTISED_MODEL_EXCLUSIVE" -- src/kiro_crew/acp/client_start.py src/kiro_crew/acp/client_model_selection.py
$ echo $?
1

Kiro's initialize and entitlement paths are back to their original shape; the Qoder-specific work happens in src/kiro_crew/acp/harness/qoder.py and src/kiro_crew/acp/client_qoder.py.

fixed — Design CONCERNS, probe leaves a Qoder session behind every 10 minutes.

CatalogProbePolicy separates "may a probe run" from "which verb ends the session that answered". QoderLaunch.catalog_probe() returns TeardownPolicy(method="session/close"), taken from the recorded 1.1.67 frames (test/fixtures/acp_frames/qoder/v167-load-replay-live.jsonl). The probe's verb order is asserted as initialize → session/new → session/close.

fixed — First Principles CONCERNS, provider_models.json changes shape for every backend.

refresh_advertised_model_rows no longer takes persist_stamp. Every provider keeps the id-list shape it had; only the catalog whose host authors labels is stored as stamped rows, in its own entry. test_a_labeled_catalog_is_the_only_entry_whose_shape_changes pins both halves, and the loader still reads the old shape.

fixed (copy) / needs screenshots — UX BLOCK.

The three stop notices and the version refusal no longer use internal wording. The unasked-call notice now reads "Qoder ran a tool without asking you first, so Kiro Crew stopped this chat. Start a new chat."; the mode-change notice reads "Qoder stopped asking before it runs a tool, so Kiro Crew stopped this chat. Start a new chat."; the version refusal names the exact install command (npm i -g @qoder-ai/qodercli@1.1.67) instead of a bare version number; the bookkeeping-overflow notice reads "Too many tool approvals were waiting at once, so Kiro Crew stopped this chat to keep your permissions safe. Start a new chat." Screenshots of the rendered notices are the remaining item.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 24, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from 93244ab to d730ed1 Compare October 27, 2026 18:45
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 27, 2026
@atomsbaza
atomsbaza force-pushed the feat/qoder-selectable branch from d730ed1 to 247e86e Compare October 31, 2026 18:13
@atomsbaza

Copy link
Copy Markdown
Contributor Author

Fixes for the three blocking findings + UX/Design notes on 247e86e6d4:

F1 (GPT, security — MCP governance bypass): tool_call_identity.py now parses _meta.qoder.toolName (format mcp__<server>__<tool>, guarded len(parts)==3) and ACP_BACKEND_QODER is added to ACP_BACKENDS_META_IDENTITY in backends_routing.py. The identity flows through the existing _tool_call_mcp_server/_tool_call_tool_name caches into the permission event, so _tier_governance sees the canonical mcp__<server>__<tool> identity. Unresolvable identity = refused.

Tests: test_qoder_mcp_tool_classified_and_denied_by_policy and test_qoder_unresolvable_mcp_identity_is_refused (red→green).

F2 (GPT — overflow reporting): _admit_model_rows now passes the original candidate IDs through _admit_ids before capping to ADVERTISED_MODELS_MAX_IDS, so the refused N model id(s) warning fires exactly as it does on the unlabeled path.

Test: test_refresh_model_rows_caps_count_and_reports_refused_overflow (red→green).

F3 (Opus — probe timeout): _bounded_refresh in agents_models.py uses _LIST_MODELS_BACKGROUND_TIMEOUT_SECS (90 s) for the inner bound, keeping request_timeout_secs only on the outer wait_for(asyncio.shield(task), …). A cold-start probe now completes in the background instead of being cancelled at 10 s.

Test: test_qoder_catalog_refresh_exceeding_request_timeout_still_completes_in_background (red→green).

UX notes:

  • tool_gate.py version refusal now names both versions ("Kiro Crew needs qodercli 1.1.67; this is {version}…") and says "then resume or start a new chat" (grounded: the version check runs on every handshake before session/load and session/new, so Resume works after updating).
  • providers.md downgrade text corrected to the actual flat per-provider map.
  • harness-onboarding.md gained a re-measure procedure section.

Full test suite (10 files): 870 passed, exit 0. Lint: isort + black clean.

Qoder CLI serves ACP natively (`qodercli --acp`). This makes it a selectable
harness whose every tool call must reach Kiro Crew's gate, or the session is
refused or stopped.

Routing: a new `Routing.PINNED_ASK_RULE`. qodercli exposes no resolved-config
read-back, so the guarantee is argv-pinned and runtime-witnessed instead of
verified:
- spawn argv pins `--settings {"permissions":{"ask":["*"],"defaultMode":"default"}}
  --permission-mode default --strict-mcp-config` (never --allowed-tools,
  --dangerously-skip-permissions or --config-dir);
- exact measured-version gate (1.1.67 only; anything else is refused);
- default-mode read-back on open/restore and a mid-session mode tripwire
  (current_mode_update and the mode config option);
- unasked-tool-call tripwire keyed by toolCallId: an executing frame needs a
  prior ALLOW answer for that call, armed by the first live prompt so replayed
  history cannot trip it;
- allow_always is never selected and a refused one is recorded as a denial;
- QODER_* variables that can relocate config/home or set permissions are
  stripped from the child env; the PID reclaim requires the `--acp` argv token.

Models: Thinking effort and the model write go through session config options.
The picker lists the models the harness itself advertises (ids are the wire
values, Qoder's display names are the labels) and refuses ids it did not
advertise. The catalog is re-read on every session, on an unknown-id refusal
(one refresh, then refuse) and, for the picker, through a TTL refresh that runs
a handshake-only probe (no prompt, no model call) and fails closed: a failed
probe keeps the last snapshot and never widens it.

Also: `~/.qoder/.auth` is declared as the (inferred, never read) credential
leaf; qoder joins the independent-setup list so onboarding offers it.
Capability sets that were not measured (compaction, steering, eviction,
session sharing, ...) stay out.

Evidence is committed as scrubbed live frame corpora (1.1.67 handshake,
pinned ask, load replay with and without a tool call, the 17-model catalog, an
unpinned bypass control, session-array MCP ask) and documented per version in
harness-onboarding.md, including that the docs' "PreToolUse allow skips the
permission pipeline" is not what 1.1.17 or 1.1.67 do for an `ask` rule.

Supersedes kirodotdev#15038. Refs kirodotdev#13803.

This branch has not been deployed

No deployments
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) merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants