Skip to content

fix: resolve each cron agent_sequence step as its own crew (#15139) - #16047

Merged
iamwhatever merged 1 commit into
mainfrom
fix/cron-sequence-member-pin-15139
Oct 2, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/cron-sequence-member-pin-15139

Conversation

@cruisercohen

@cruisercohen cruisercohen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A scheduled job whose captured identity is a crew member now runs each step of its agent_sequence as that step's own crew, instead of running every step as the one captured member.

A cron schedule that carries a captured crew member (created with a member_id, or from a member's own session) dispatched every entry of its agent_sequence as that one member. The sequence still ran its steps in order, with a session key per step (cron:<job id>:<step>), but each step's runtime, workspace, pinned model and capability gates came from the captured member rather than from the step's own crew — so the other crews the sequence named never actually ran.

Why it matters

A agent_sequence exists to run a pipeline of distinct crews in order. When the schedule carried a captured member, that intent silently collapsed: a two-crew sequence ran twice as one crew. The misdispatch is invisible — the path logs nothing on success — so a job looks like it is honoring its sequence while every step uses the wrong agent's tools, model and workspace.

Not a goal

  • Changing how a single-agent captured schedule resolves. Its captured-member pin is deliberately kept (a recreated same-name alias must not inherit a retired member's memory silo).
  • Changing which memory store a sequence step uses. The captured store stays the run's one shared memory identity on every step.
  • Changing the dashboard's per-crewmate grouping (wakesCrew); it still groups a member-captured sequence under its member_id.
  • Changing how a sequence step's capability-startup fault propagates (the per-step loop's existing error handling is unchanged — see Manual verification).

What changed (motivation → approach → change)

The misdispatch was the captured-member identity pin in _resolve_cron_agent (src/kiro_crew/slack/gateway.py): when the captured execution named a member, it resolved the member's alias and ignored its alias argument, so each sequence step resolved to the captured member, not its own crew.

That pin is right for a single-agent captured job but wrong for a sequence, where each step's alias already names its crew. A keyword-only sequence_step flag makes the sequential loop call _resolve_cron_agent(agent, sequence_step=True), skipping the pin so the step resolves its own crew's kiro_agent, workspace, model and capability gates. The single-agent call site keeps the pin.

Resolving the step as its own crew surfaced a second mismatch: the session record bound under the step key (bind_session_execution) drives sub-agent spawn authorization via parent_spawn_allowlists(execution.template_id), and it was still the captured member's. The loop now binds a per-step execution from cron_execution.with_template(step kiro_agent, step crew), rewriting only the template/selection the spawn gate reads while preserving the captured member_id, store, mode and app. The step key cron:<job id>:<step> is stable across fires, so the binding uses a compare-and-swap replace (replace_existing=True, the freshly read record as expected); without it an already-fired member-captured sequence would crash on every later fire. bind_session_execution is not weakened for any other caller, and deny-by-default is unchanged.

The captured memory store is untouched — bound per session key by the caller — so the run keeps one memory identity while its steps run as the crews the sequence names.Because a step now runs as its own crew, a step's session can outlive a fire (while sub-agent work is pending) under a runtime that no longer matches the crew it resolves to after a crew edit, and the session is reused by key. So the single-agent retained-session check and the sequence path share one helper, and the sequence resolves each step's agent once per fire, above the sweep, into a list parallel to the sequence (duplicate aliases stay distinct steps). The sweep only compares each step against its frozen dispatch agent and defers the whole fire on a mismatch (and, if a step names no crew, logs loudly and defers the same way — never-started, so a delete_after_run one-shot is retained); the dispatch loop reuses the frozen triple. Resolving once closes the window — the compared string is the dispatched string, so a crew edit after the sweep applies next fire rather than slipping onto an unchecked runtime; deferring before any step runs stops a mid-loop deferral replaying a partly-run fire. One window remained: the step's execution record (the spawn gate's parent-identity input) was bound from the pre-loop snapshot, but dispatch re-reads the template fresh, so a config write to the step's alias could leave the bound template stale and drop the parent's availableAgents. So after preparation the record is rebound from the dispatched template (replace_execution only, positive-evidence only, store/member/mode/app preserved) — one source of truth. The single-agent guard is unchanged, and the owning spec docs/system-specs/modules/learn-cron-dashboard.md is updated in the same commit.

Backwards compatibility

Compatible: no contract is tightened, renamed or removed. sequence_step defaults to False, so every existing caller (including the single-agent path) behaves exactly as before; only the sequential loop opts in. A member-captured sequence now runs as its named crews — the intended fix — while single-agent captured jobs are unchanged.

Tests

  • test/test_cron_sequence_member_alias.py (new): eleven tests driving the real _cron_callback closure with a stubbed session manager. (1) A member-captured sequence [beta, alpha] dispatches its first step as crew beta (its crew_agent, kiro_agent mode, own cwd), not the captured member alpha (reds without the sequence_step gate). (2) A step whose crew declares a sub-agent availableAgents allowlist binds its spawn policy from the step crew while the bound member_id, store, mode and app stay the captured run's (reds without the per-step binding). (3) A sequence fired twice succeeds on the second fire and the step record upgrades to the step crew's template keeping the captured identity (reds without the CAS replace). (4) A step key retaining a live session under a different agent defers the whole fire, no step dispatched. (5) A mismatch on a later step still defers before the first step dispatches. (6) A crew edit landing after the sweep read it does not change that step's dispatch. (7) A two-step sequence resolves each step exactly once. (8) [beta, beta] dispatches twice on one shared key. (9) An empty step ["", beta] defers (never-started, loud error) rather than raising. (10) The same empty step on a delete_after_run one-shot keeps run_never_started so it is not consumed. (11) A config write to the step's alias between resolve and dispatch leaves the bound record carrying the dispatched template, not the stale snapshot, keeping the parent's availableAgents (reds without the rebind). The single-agent loosening is caught by test/test_slack_gateway_cron_exec_coverage.py::test_recreated_alias_does_not_cross_captured_member_identity, and test/test_cron_execution_capture_async.py asserts a sequence step binds its own template while single-agent capture keeps the job's.

Manual verification

N/A — unit coverage is sufficient. The change is a backend dispatch-resolution gate with no UI surface; the new tests exercise the real callback up to the session acquire, and the existing cron/crew suites pass. One pre-existing property is intentionally left as-is: a sequence step's CapabilityStartupError propagates out of the loop as before; this fix makes a different crew's startup reachable but does not change that error handling, which is out of goal.

Related Issues

Closes #15139

Pattern harvest

Not generalizable: a single wrong-subject bug — an identity pin applied to a caller-supplied alias it should have left alone for one dispatch mode. No broader class to lint for beyond the mutation-pin the new tests provide.

Checklist

  • At most two commits (one here), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (owning spec updated in the same commit)
  • No secrets, credentials, or internal references in the diff

@cruisercohen

Copy link
Copy Markdown
Contributor Author

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

Rebased: main moved in src/kiro_crew/autonudge.py (the #16032 flake8 F811 fix) since this head went green; CI re-running on the fresh base (55d6539 -> 1001b70).

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

A permanently malformed sequence (empty step) now defers on every fire forever, never engaging the failure ladder — a transient-condition mechanism applied to a permanent condition.

Watch

  • The empty-step guard routes through _defer_cron_before_dispatch ("if a step names no crew, logs loudly and defers it the same way"), which by design counts neither success nor failure and cannot walk a job toward consecutive-failure auto-pause or trigger the failure bell/DM. A retained-session mismatch self-heals (sub-agent completion, reaper), so defer fits; an empty step persisted via cron_add's MCC-settable agent_sequence never self-heals, so a recurring job silently fires-and-skips forever with only last_error and a log line as evidence. The one-shot retention rationale covers delete_after_run only.
    Clears when: creation/update-time validation rejects a blank sequence step, or the recurring-job arm records a failure (engaging dedup/auto-pause/alerting) while the one-shot keeps run_never_started — or the author rebuts that dashboard last_error surfacing is the intended remedy.

Suggestions

  • The whole-fire defer reason reaches last_error but a repeatedly deferred sequence is indistinguishable from a healthy quiet one in any aggregate view; a deferral counter on the job would make a stuck sequence visible without changing the defer semantics.

[DESIGN-REVIEWED] 36ad2de

Description read

[DESCRIPTION-READ] d2a0fcd30c6ce0a7bb62beed34327f6d070d1201194d17a1fc0eec58fb5e5423

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 2, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf — 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: PASS

Verify the undeclared post-start rebind: _rebind_prepared_execution re-points the durable spawn record at loaded_capability_template, yet the description's "ten tests" and the spec paragraph omit it.

Not justified as shipped

  • Item 7 — undeclared: _rebind_prepared_execution (gateway.py) rewrites the bound record to the provider's actually-loaded template after startup; it appears in neither "What changed" (which stops at the CAS replace), the enumerated "ten tests" (the file ships eleven), nor the spec hunk this PR adds. Harm is nameable (spawn gate must read the runtime's real template) and loaded_capability_template is an existing, trusted property, so this is an inventory flag, not a defect.
  • Item 6 — rides along: deferring every fire of a sequence containing an empty step applies to all dispatching sequences, not just the member-captured defect this FIX names; it is declared, loud, and keeps one-shots unconsumed.

What this change ships

Inventory (10 items) — 8 justified

Intent: FIX — a cron whose captured identity is a crew member must run each agent_sequence step as that step's own crew (new tests red on base; base already pinned per-step dispatch agents for non-captured sequences).

  1. A member-captured sequence step now runs as its own crew's runtime, workspace, model and gates — justified
  2. A step's durable record names the step crew's template, so its sub-agent spawns are authorized by that crew's allowlist — justified
  3. An already-fired member-captured sequence upgrades its step record in place (CAS replace) instead of crashing on refire — justified
  4. One retained-session agent mismatch on any step now defers the whole fire before any step runs — justified
  5. Step agents resolve once per fire; a crew edit mid-fire applies on the next fire — justified
  6. A sequence with an empty step now defers every fire loudly instead of dispatching it — rides along: hardening for all sequences, declared
  7. After runtime start, the step record is re-pointed at the template actually loaded — undeclared: absent from description and spec hunk
  8. Single-agent retained-session guard extracted into a helper shared with the sweep (no behavior change) — justified
  9. Owning spec updated in the same commit — justified
  10. Capture test's pin rewritten: a sequence step binds its own template, single-agent keeps the job's — justified

[FIRST-PRINCIPLES-REVIEWED] 36ad2de

Description read

[DESCRIPTION-READ] 8f5a03b06ce38a74c60218fa4493e81fbcf1d9a0b51121adb96d297a08babf47

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 2, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 36ad2de

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 36ad2de

Verdict parsed from the review's SHA-scoped output markers for commit 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 36ad2de9194fa0f7f6685e57ebebfccb98f4e2cf: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 2, 2026
@cruisercohen
cruisercohen force-pushed the fix/cron-sequence-member-pin-15139 branch from c47441d to efba895 Compare October 2, 2026 01:36
@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: per-step execution binding via cron_execution.with_template for sequence-step spawn authorization

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=e51cd2330ac2 — fixed in efba895

Legitimate and in-scope: resolving a sequence step as its own crew (this PR's change) left the session record bound under the step key still carrying the captured member's template_id, so parent_spawn_allowlists read the captured member's sub-agent allowlist instead of the step crew's.
Fix: the sequence loop now binds a per-step execution derived with cron_execution.with_template(step kiro_agent, step crew), rewriting only the template/selection the spawn gate reads while preserving the captured member_id, memory store, memory mode and app. Spawn authorization now follows the crew the step runs as; deny-by-default is unchanged.
Regression: test_cron_sequence_member_alias.py::test_sequence_step_binds_its_spawn_policy_to_the_captured_store asserts the step binds the step crew's allowlist AND that the captured store/identity/mode/app are unchanged; it reds without the per-step binding.

@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 2, 2026
@cruisercohen
cruisercohen force-pushed the fix/cron-sequence-member-pin-15139 branch from efba895 to bde7226 Compare October 2, 2026 01:59
@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: CAS replace (replace_existing + expected) of the cron-owned step binding, sequence-step only

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=e51cd2330ac2 — fixed in bde7226

Legitimate and in-scope (regression the prior round's per-step with_template binding introduced): the step session key cron:{job.id}:{agent} is stable across fires, so a second fire of an already-fired member-captured sequence cron hit bind_session_execution's replace_existing=False mismatch and raised out of the finally-only loop, aborting the run with no recovery.
Fix: the sequence-step binding now replaces its own prior durable record via a compare-and-swap (replace_existing=True with the freshly read record as expected), scoped to the sequence step only. The first fire's captured record is upgraded in place to the step's template; a concurrently changed or foreign record is still refused. bind_session_execution is not weakened for any other caller, and the single-agent path is byte-for-byte unchanged.
Regression: test_cron_sequence_member_alias.py::test_second_sequence_fire_rebinds_a_prior_captured_execution fires the cron twice and asserts the second fire succeeds and the record upgrades to the step crew's template while member_id/store/mode/app stay captured; it reds without the CAS replace.

@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 2, 2026
@cruisercohen
cruisercohen force-pushed the fix/cron-sequence-member-pin-15139 branch from bde7226 to 9099f7d Compare October 2, 2026 02:21
@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: extend the existing single-agent retained-session guard (_get_session_agent + _defer_cron_before_dispatch) to sequence steps

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=e51cd2330ac2 — fixed in 9099f7d

Legitimate and in-scope. This PR made a sequence step's dispatched agent mutable between fires on the stable key cron:{job.id}:{agent}; a cron session can survive its fire while sub-agent work is pending, and the allocation path reuses a live session by key without comparing agent (session_allocation.py), so after a crew edit a next fire could run on the old provider's revoked tools/capabilities.
Fix: the sequence loop now carries the SAME positive-evidence guard the single-agent path already uses — before acquiring a step it reads _get_session_agent(step key); if a live session is retained under a different agent than the step now resolves to, the whole run defers via _defer_cron_before_dispatch rather than reuse the stale runtime. The single-agent guard's executable code is unchanged (only its scope comment, which excluded sequences on the now-false constant-name premise, is updated); no reset, so pending sub-agent work is preserved; session_allocation and bind_session_execution are not weakened.
Regression: test_cron_sequence_member_alias.py::test_sequence_refire_defers_when_step_runtime_uses_stale_agent asserts a step retained under a stale agent defers (get_or_create never awaited); it reds without the guard.

@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 2, 2026
@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 Oct 2, 2026
@cruisercohen
cruisercohen force-pushed the fix/cron-sequence-member-pin-15139 branch from 8bb2afa to 09e29f0 Compare October 2, 2026 13:31
@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 2, 2026
@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: empty-step rejection now logs loudly then defers via _defer_cron_before_dispatch + return None (run_never_started), instead of raising

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=afebc2c8ad23 — fixed in 09e29f0

Correct, and fixed. The empty-step rejection previously raised, which propagated with run_never_started=False, so delete_owed = delete_after_run and not (fire_time_denied or run_never_started) would delete a one-shot that ran no line — data loss — and a recurring job would error every fire.
Fix: the sweep's empty-step branch now emits a loud logger.error(...) and then refuses through the sibling arm's mechanism — _defer_cron_before_dispatch(job, "...") + return None — exactly as you suggested. That records last_status="error" and the reason in last_error (so the failure stays visible), and sets run_never_started=True, which the delete site at cron.py honours, so a delete_after_run one-shot is retained rather than consumed. A recurring malformed job goes through the normal per-fire error path with its existing cadence; no new throttling was added. The loud log keeps the "visible failure" intent while the never-started marker prevents the consumption.
Regression: test_an_empty_sequence_step_aborts_a_member_captured_cron now asserts the defer semantics (returns None, run_never_started True, reason in last_error, get_or_create never awaited), and a new test_an_empty_step_does_not_consume_a_delete_after_run_oneshot pins that a delete_after_run=True one-shot keeps run_never_started=True. Both red on the prior raise head and green here.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 2, 2026
@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: WATCH answered as intended behaviour

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=50ad64524041 (WATCH) — intended

The sweep's empty-step refusal firing for ANY agent_sequence_dispatches job, not just member-captured ones, is intended: an empty sequence step names no crew and cannot resolve a runtime, so it is invalid for every population. A pre-existing non-member sequence carrying an empty entry was relying on undefined behaviour; refusing it is correct. The refusal is non-consuming (loud log + _defer_cron_before_dispatch + return None, run_never_started=True), so a delete_after_run row is retained and a recurring job errors visibly each fire on its normal cadence rather than losing data or dispatching an unresolved step. The branch keys only on not step.alias, so the behaviour is identical for a non-member sequence; covered for the member case by the two new empty-step tests.

@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: SUGGESTIONS declined as out-of-scope follow-up

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=8074f6975af2 (SUGGESTIONS) — declined, out of scope

Rejecting empty agent_sequence entries at cron_add/cron_update validation (so the dispatch-time guard is unreachable for new jobs) is a reasonable hardening, but it is out of scope for this PR, which is the #15139 per-step-identity fix plus the dispatch-time guards it necessitated. The dispatch-time refusal is the correct backstop regardless — it also covers legacy and hand-edited records that bypass the create path — so no behaviour is lost by deferring the validation layer. Noted as a sensible follow-up; not filing an issue per the owning decision.

A schedule whose captured execution names a crew member dispatched every
agent_sequence step as that one member: _resolve_cron_agent applied the
captured-member identity pin to all steps, so each step's runtime, workspace,
pinned model and capability gates came from the captured member instead of the
step's own crew. The sequence ran its steps in order but the crews it named
never actually ran as themselves.

Gate the captured-member pin behind a new sequence_step flag. A declared
agent_sequence step passes sequence_step=True, which skips the pin and resolves
the step by its own alias; a single-agent captured job is unchanged and keeps
the pin that stops a recreated same-name alias adopting a retired member's
memory silo. The captured memory store is still shared by every step (bound per
session key by the caller), so the run keeps one memory identity while each step
runs as the crew the sequence names. Documents the per-step rule in the owning
learn-cron-dashboard spec.

Closes #15139
@cruisercohen
cruisercohen force-pushed the fix/cron-sequence-member-pin-15139 branch from 09e29f0 to 36ad2de Compare October 2, 2026 14:15
@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 2, 2026
@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: fixed via rebind-after-preparation (one source of truth)

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=e51cd2330ac2 (BLOCKING) — fixed

"Post-sweep reconciliation can bind the wrong spawn policy" (gateway.py:4730). Confirmed and fixed. The per-step execution record — the spawn gate's parent-identity input via parent_spawn_allowlists(execution.template_id) — was bound in _acquire_with_model_fallback from the pre-loop resolve-once snapshot, while dispatch re-reads the effective template fresh (prepare_runtime). For an already-enrolled member a config write to the step's own alias in the resolve→dispatch window could leave the bound template_id stale → resolve allow-all → drop the parent's availableAgents.

Fix (one source of truth): after get_or_create returns the prepared client, on replace_execution only, the record is rebound from the dispatched template (client.loaded_capability_template) via bind_session_execution(..., replace_existing=True, expected=<the record just written>). Positive-evidence only — a missing, empty, or unchanged prepared template leaves the record as-is — so the bound record always carries the template actually dispatched, not the snapshot. Applied on both the primary and the model-fallback return paths; the single-agent path (replace_execution=False) is untouched. with_template preserves member_id/store/memory_mode/app, so the memory-store seam holds. New regression test (member alias file, test 11): a config write to the step's alias between resolve and dispatch leaves the bound record carrying the dispatched template and the parent's availableAgents intact — reds on the pre-rebind head.

@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: now declared in the body (snapshot predated the body update)

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=3816f2a83610 (NOT JUSTIFIED AS SHIPPED) — now declared

Item 7 — _rebind_prepared_execution undeclared. The body has since been updated on this same head (36ad2de9) and now declares it: the "What changed" section carries the rebind paragraph ("after preparation the record is rebound from the dispatched template … positive-evidence only, store/member/mode/app preserved — one source of truth"), the Tests section now reads "eleven tests", and test (11) is enumerated ("A config write to the step's alias between resolve and dispatch leaves the bound record carrying the dispatched template … reds without the rebind"). The lane evaluated a body snapshot taken before that edit propagated. No code or test gap — the change is declared, justified, and covered.

@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: declared and intended (same as the WATCH already answered)

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=a10de69d8dd8 (NOT JUSTIFIED AS SHIPPED) — declared, intended

Item 6 — the empty-step defer "rides along", applying to every dispatching sequence, not only the member-captured defect #15139 names. Intended, and declared: the body's "What changed" states the sweep "if a step names no crew, logs loudly and defers the same way — never-started, so a delete_after_run one-shot is retained", and the Backwards-compatibility section notes the sequential loop's guards apply to all sequences. An empty sequence step names no crew and cannot resolve a runtime, so it is invalid for every population; refusing it (loud log + defer, non-consuming) is the correct backstop regardless of capture kind, and it loses no data. As the item itself grants, it is "declared, loud, and keeps one-shots unconsumed" — so it is justified as shipped, not an undeclared rider.

@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: intended — dashboard last_error is the surfacing remedy; auto-pause deliberately not engaged for a never-started defer

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=d000d7935c57 (WATCH) — intended

The empty-step guard routes through _defer_cron_before_dispatch, which counts neither success nor failure and so does not walk a job toward consecutive-failure auto-pause or fire the failure bell/DM. This is intended, and the item names the accepted remedy: the defer reason is written to last_error and surfaces on the dashboard. A never-started defer must NOT engage auto-pause/alerting here — that is the whole point of the run_never_started path the prior Opus finding required: it keeps a delete_after_run one-shot unconsumed and avoids marking an un-run fire as a failure (which would be the data-loss/false-failure the fix is avoiding). Validation-time rejection of a blank step is a reasonable future hardening (noted on the SUGGESTIONS span), but the dispatch-time loud-log + last_error surfacing is the intended behaviour for this PR, not a gap.

@cruisercohen

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: declined — sensible follow-up, out of scope for this PR

🤖 Kiro Crew Auto-Pipeline [operator: cruisercohen#97bc2b11]

  • span=a28caad316c4 (SUGGESTIONS) — declined, out of scope

A per-job deferral counter to distinguish a repeatedly-deferred sequence from a healthy quiet one is a reasonable observability improvement, and explicitly does not change the defer semantics. It is out of scope for this PR, which is the #15139 per-step-identity fix plus the dispatch-time guards it necessitated. The defer reason already reaches last_error for the immediate case; a cross-fire counter is a separate telemetry change better made on its own. Noted as a sensible follow-up; not filing an issue per the owning decision.

@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 Oct 2, 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: sequence_step=True skips the captured-member pin only in the sequence loop (gateway.py:4673), single-agent jobs keep the pin, and every step still builds its context with the captured execution and store (gateway.py:4790), so no step gets its own memory store. Two advisory notes, not blocking: (1) gateway.py:4576 _rebind_prepared_execution CAS-checks against bound_execution, but bind_session_execution stores with_mode(current.memory_mode), so a retained stricter mode would raise 'session changed during admission' after the session was created; re-read and pass that as expected, as :4538 does. (2) gateway.py:4537 passes a fresh read as expected with replace_existing=True, which is effectively an unconditional replace; asserting that only template_id / selection_kind / selection_name differ would match the PR's claim.

@iamwhatever
iamwhatever enabled auto-merge (squash) October 2, 2026 16:44
@iamwhatever
iamwhatever merged commit d88738d into main Oct 2, 2026
104 of 105 checks passed
@iamwhatever
iamwhatever deleted the fix/cron-sequence-member-pin-15139 branch October 2, 2026 16:44
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 2, 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.

cron: every crew in an agent_sequence is dispatched as the one member the schedule captured

2 participants