Skip to content

refactor: drop the unreachable control-secret derive fallback - #31339

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/24735-drop-secret-derive
Nov 7, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/24735-drop-secret-derive

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The remote-crew turn route takes a MicroVM crew's control-secret name only from the reference its launch recorded, with no second way to build one.

control_secret_id in src/kiro_crew/dashboard/handlers_crew_turn.py had a fallback: when the matched crew record carried no control_secret_ref, it built a name from the configured secret_path_prefix and the record's tag. No live record reaches that branch. The only writer of a crew record, MicroVmLaunchEngine.provision, sets control_secret_ref when it creates the record, and the field and that writer landed in the same commit (#17540), so no older record without it exists.

Why it matters

An unreachable branch on the path that picks which secret the gateway reads with the owner's AWS credentials is code a reader has to reason about on every security review of this route, and a second source of truth for a name the launch already recorded. Removing it leaves one answer to "which secret is this crew's".

Not a goal

What changed (motivation → approach → change)

The route already refuses a crew whose record carries no reference with 503 crew_secret_unavailable ("the control secret reference is not recorded ... Relaunch the crew"), and the instances spec documents exactly that. The derive fallback was the one thing standing between that refusal and a record with an empty reference, and nothing produces such a record.

So control_secret_id now returns the matched record's control_secret_ref as is, and "" when there is no record or no reference. The _SECRET_PATH template and the CloudConfig read that fed the fallback are gone. For a correctly launched crew nothing changes: the recorded reference was always preferred.

The tests that pinned the template's shape go with it, and the test that asserted the derive ran is replaced by one asserting that a matched record with no reference resolves to nothing.

Backwards compatibility

Compatible: every crew record a launch writes carries control_secret_ref, which was already the value returned; only the unreachable empty-reference branch now answers "".

Reader: src/kiro_crew/dashboard/handlers_crew_turn.py:api_crew_turn -- crew page -- test_crew_turn_proxy.py::TestTheCredentialIsBoundToTheNodeTheTunnelDials and test_a_turn_against_a_really_registered_row_is_not_refused_for_its_secret (a recorded reference still reaches the crew; an empty one takes the existing crew_secret_unavailable branch)
Reader: src/kiro_crew/dashboard/handlers_crew_turn.py:_SECRET_PATH -- crew page -- read only by the two shape tests in test/test_crew_turn_proxy.py, removed here

Tests

  • test_crew_turn_proxy.py::TestControlSecretIdLanePrecedence::test_a_matched_record_without_a_reference_resolves_nothing: a record matched on the row's node with no control_secret_ref resolves to "", so no name is guessed.
  • Removed test_the_secret_path_is_the_one_the_deploy_wrote and test_the_path_shape_takes_the_configured_prefix, which pinned the deleted template.
  • test_crew_turn_proxy.py and test_crew_turn_proxy_reply.py pass (111), plus the backend related set from scripts/local-gate.py (158 passed).

Proof: PROVEN test/test_crew_turn_proxy.py::TestControlSecretIdLanePrecedence::test_a_matched_record_without_a_reference_resolves_nothing (head 5ae6ce0)

Manual verification

N/A — unit coverage sufficient: the change removes a branch no launch reaches, and the remaining paths are covered end to end through the handler.

Screenshots / video

N/A — no frontend change.

Related Issues

Closes #24735

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 6, 2026 10:27
@bolichen97
bolichen97 requested a review from Zedmor November 6, 2026 10:27
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 56fdac751c072253657a1539d4c61528940d77c6 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 56fdac751c072253657a1539d4c61528940d77c6 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The PR claims the fallback is unreachable, and the code bears that out: the one constructor that sets a reference is engine.py:402, and the only other one (CrewStore.apply_event at record.py:450, from None) needs EVENT_LAUNCH_STARTED, which nothing in src/ sends.

What this change ships

Inventory (4 items) — 4 justified

Intent: give a MicroVM crew's turn route a single answer to "which secret is this crew's": the reference its launch recorded. This is a FIX (removes an unreachable branch).

  1. A crew record that has no recorded secret reference no longer gets a name derived from the configured prefix and its tag; the existing crew_secret_unavailable refusal answers instead — justified
  2. The _SECRET_PATH template and the CloudConfig lookup that fed it are gone — justified
  3. The two tests that pinned the template's shape are removed; their subject no longer exists, and the description says so — justified
  4. The test that asserted the derive ran now asserts that a matched record with no reference resolves to "" — justified

[FIRST-PRINCIPLES-REVIEWED] 56fdac7

Description read

[DESCRIPTION-READ] ab0525c91ec893b101d744e39ac72f6b72eef9a5dda03c5f58eb85d8b0cd3988

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 56fdac751c072253657a1539d4c61528940d77c6 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. The launch path is the only one that writes control_secret_ref, so a reference-less record already ends at the existing crew_secret_unavailable refusal.

Notes

  • CrewStore.apply_event (record.py:449) can still create a bare CrewRecord(tag=tag) with no reference, so "only writer" is slightly too strong. Such a record has no minted secret behind it either way, so the refusal is the right outcome.

[DESIGN-REVIEWED] 56fdac7

Description read

[DESCRIPTION-READ] f674c716ac3ad02096841a10bef70c86efe97222920ed6feb8816a7407e233a4

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 56fdac751c072253657a1539d4c61528940d77c6 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 56fdac7

Verdict parsed from the review's SHA-scoped output markers for commit 56fdac751c072253657a1539d4c61528940d77c6.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 56fdac751c072253657a1539d4c61528940d77c6 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 56fdac751c072253657a1539d4c61528940d77c6 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 56fdac7

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 56fdac751c072253657a1539d4c61528940d77c6 false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 6, 2026 10:43
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/24735-drop-secret-derive branch from 5ae6ce0 to 066cb7c Compare November 6, 2026 13:16
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_turn/recovery.py, src/kiro_crew/dashboard/chat_turn/tool_rows.py, src/kiro_crew/dashboard/crash_dump_store.py, src/kiro_crew/dashboard/gateway_notice.py, src/kiro_crew/dashboard/session_transfer.py, src/kiro_crew/dashboard/session_transfer_intake.py, src/kiro_crew/snapshot_merge.py, test/test_crash_dump_store.py, test/test_session_transfer_import_body.py, test/test_slack_mirror_echo.py, test/test_transient_notice_parity.py since this head went green (31aa5b1 -> 0eecd84); CI re-running.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/24735-drop-secret-derive branch from 066cb7c to 2084008 Compare November 6, 2026 14:19
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_api/conductor_close.py, src/kiro_crew/dashboard/chat_api/slot_lifecycle.py, src/kiro_crew/dashboard/chat_handlers.py, src/kiro_crew/dashboard/handlers_system.py, test/test_channel_slot_close_binding.py, test/test_channel_slots.py, test/test_chat_handlers_composition_contract.py, test/test_conductor_close_closes_workers.py, test/test_config_live_restart_hint.py, test/test_config_meta_stamp.py, test/test_config_tailnet_fail_closed.py, test/test_coordinator_approval_slot_lane.py, test/test_crew_board_needs_you_dismiss.py, test/test_crewmate_feed_cold_store.py, test/test_crewmate_feed.py, test/test_eager_spawn_gate_config_source.py, test/test_open_slots_persistence_async_restore.py, test/test_open_slots_persistence_durability.py, test/test_open_slots_persistence_serialization.py, test/test_remote_crew_peer_slots.py, test/test_remove_slot_for_history_key.py, test/test_services_config_hot_reload.py, test/test_slot_chunk_retention.py, test/test_slot_close_nudge_race.py, test/test_slot_close_recreation_race_handover_metadata.py, test/test_slot_close_recreation_race_privacy_ratchet.py, test/test_slot_close_recreation_race.py, test/test_slot_close_recreation_race_takeover_dismissal.py, test/test_slot_close_recreation_race_takeover_ordering.py, test/test_slot_close_recreation_race_takeover_retraction.py, test/test_slot_create_refusal_builds_nothing.py, test/test_slot_list_rebuild.py, test/test_slot_needs_input_status.py, test/test_slot_ownership_checkpoint.py, test/test_slot_payload_lineage.py, test/test_slot_reset_interleaving_seam.py, test/test_stt_stream_config.py, test/test_unattended_slot_guardrails.py since this head went green (0eecd84 -> b993f2a); CI re-running.

[operator: bolichen97]

@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: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 6, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Both red backend shards (Linux and Windows, shard 2) come from main, not from this diff:

This PR waits for #31469 to merge, then rebases onto it and re-runs. No change to this diff.

@bolichen97
bolichen97 force-pushed the fix/24735-drop-secret-derive branch from 2084008 to 99a5411 Compare November 6, 2026 20:29
@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 readiness: checking Automated validation is still running labels Nov 6, 2026
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 6, 2026
control_secret_id built a secret name from the configured prefix and the
record's tag when a matched MicroVM crew record carried no
control_secret_ref. Every record is created by the launch with that
reference set, and the field and its writer landed together, so no live
record reaches the branch. Return "" for a record with no reference, the
same "cannot authenticate" answer a row that owns no record already gets,
and drop the path template and the tests that pinned its shape.

Closes #24735
@bolichen97
bolichen97 force-pushed the fix/24735-drop-secret-derive branch from 99a5411 to 56fdac7 Compare November 6, 2026 22:25
@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 Nov 6, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved for the on-call. Review lanes pass on 56fdac7, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 10e0a06 into main Nov 7, 2026
187 of 191 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/24735-drop-secret-derive branch November 7, 2026 02:26
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MicroVM: drop the unreachable control-secret derive fallback in control_secret_id

2 participants