Skip to content

fix(cron): pin the session title in ScriptContext.open_session - #16867

Merged
hoang-phan98 merged 1 commit into
mainfrom
fix/cron-open-session-title
Oct 8, 2026
Merged

hoang-phan98 merged 1 commit into
mainfrom
fix/cron-open-session-title

Conversation

@hoang-phan98

@hoang-phan98 hoang-phan98 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Keep a script cron's chosen session name visible without undoing a later user rename.

A script cron opens a session with a name, but the sidebar later shows an auto-generated title instead. Sending the name again during a reopen can also replace a title that the user renamed.

Why it matters

The session name identifies the scheduled work. Replacing that name makes script-opened sessions harder to recognize, while replacing a user rename removes the user's chosen label.

Not a goal

  • Change slot-key derivation.
  • Change auto-title behavior for sessions opened without a name.
  • Change any dashboard component.

What changed (motivation → approach → change)

ScriptContext.open_session sent the chosen value only as name, which the slot creation handler uses for key derivation. The request already supports a separate title field for the visible label. The method now sends a non-empty redacted value as both fields. The gateway applies that title when a script cron creates the session. A live reopen keeps its current title. A closed-session reopen restores only the saved title and its origin. A restored automatic title rebases its refresh budget against the new live window. All other fields follow the current create path, including a new creation time. The full history-resume path is not used because it requires the transcript rows and owns a separate rollback lifecycle. Existing title behavior for other clients remains unchanged. The specification and gateway tests pin these rules.

Backwards compatibility

Compatible: existing callers still receive the same slot key and return value. Existing title updates from other clients keep their current behavior.

The creator-refusal wrapper is removed. Each reader uses the surviving admission result directly.

Reader: src/kiro_crew/dashboard/chat_handlers.py:api_chat -- chat -- reads cron_creator_admission(...).refusal directly.
Reader: src/kiro_crew/dashboard/chat_handlers.py:api_chat_slot_create -- chat -- reads the admission refusal and saved-title metadata directly.
Reader: test/test_chat_routes_cron_switch.py:TestCronCreatorAdmission -- chat -- tests the admission refusal directly.
Reader: docs/system-specs/modules/session-control.md:script-cron-chat-routes -- cron -- names the surviving admission helper.

Tests

  • The live-slot cron reopen regression test failed before the implementation because the gateway replaced the user-renamed title.
  • The closed-session regression confirms that the saved title and its origin survive, and that a later title refresh does not regenerate the title.
  • The create-path regression confirms that a closed-session reopen still runs the normal creation steps, including folder-tag inheritance, assignment persistence, and a new creation time.
  • The automatic-title regression confirms that a restored refresh mark rebases from 30 to 24 and refreshes at the next eligible cadence point.
  • The new-slot and non-cron compatibility tests guard the existing behavior.
  • All six gateway title tests pass after the implementation.
  • Focused gateway, title, creator-admission, and ScriptContext tests: 193 passed.
  • Black, isort, flake8, and mypy pass on the changed Python files.

Manual verification

N/A: focused unit coverage exercises session creation and reopen behavior through the gateway handler.

Screenshots / video

N/A: no frontend component changed.

Related Issues

Closes #16866

Stacked on #16681.

Pattern harvest

Rule candidate: review-prompt
Pattern: A create-or-reopen endpoint must apply creation-only display metadata only when it creates a resource.

Checklist

  • One commit with a Conventional Commits title.
  • Existing tests pass and new regression coverage is included.
  • Self-review completed.
  • Documentation updated.
  • Public-content scan passed.

Contribution License Agreement

@hoang-phan98
hoang-phan98 requested a review from a team as a code owner October 5, 2026 00:28
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Check one case: a closed cron session saved with no title now ignores the script's title on reopen, so the auto-title still replaces the chosen name.

[DESIGN-REVIEWED] 2586584

Description read

[DESCRIPTION-READ] e2f187a68fb50b03df951c64f90ea6015537fe5b121bc25b1cad6098b730fbae

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 25865849016331fcf472aa1fd42a9d31f12c21ea — 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

Check before merge: a closed-session cron reopen whose saved metadata has no title drops the cron's name. The resume rule in metadata_codec._read_title falls back to the request title in that case.

What this change ships

Inventory (5 items) — 5 justified

Intent: when a script cron opens a session, the sidebar shows the name the cron chose, and a later reopen does not overwrite a title the user renamed. This is a FIX (#16866).

  1. A session a script cron opens now shows the cron's chosen name instead of an auto-generated title — justified
  2. Reopening a live session from a cron keeps its current title, including a user rename — justified
  3. Reopening a closed session from a cron restores its saved title and where that title came from, without reading the store a second time — justified
  4. A restored auto-generated title resets its refresh count against the new, empty session, so title refresh keeps its normal pace — justified
  5. cron_creator_refusal is renamed cron_creator_admission and now also returns the saved-session data it already read; three callers and the specs are updated — justified

[FIRST-PRINCIPLES-REVIEWED] 2586584

Description read

[DESCRIPTION-READ] 2f660145062d52edc2f49f9c157b2127a5fe89e3dbcd9b69aaea13cb83997ad5

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 25865849016331fcf472aa1fd42a9d31f12c21ea — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2586584

Verdict parsed from the review's SHA-scoped output markers for commit 25865849016331fcf472aa1fd42a9d31f12c21ea.

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

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 25865849016331fcf472aa1fd42a9d31f12c21ea and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2586584

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 25865849016331fcf472aa1fd42a9d31f12c21ea: <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 5, 2026
@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from 3f1554a to cedc314 Compare October 5, 2026 02:19
@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 5, 2026
@hoang-phan98

Copy link
Copy Markdown
Contributor Author

Fixed in cedc314: a cron reopen now keeps the session's current title, and a test and a spec line pin it.

@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 5, 2026
@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from cedc314 to a7adc98 Compare October 5, 2026 03:42
@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 5, 2026
@hoang-phan98

Copy link
Copy Markdown
Contributor Author

Fixed in a7adc98: reopening a saved cron session now keeps its user-renamed title and title origin, with regression coverage.

@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 5, 2026
@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from a7adc98 to a5a3ab4 Compare October 5, 2026 04:39
@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 5, 2026
@hoang-phan98

Copy link
Copy Markdown
Contributor Author

Fixed in a5a3ab4: a closed-session reopen keeps the normal create path, restores only the saved title and origin, and tests cover both rules.

@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from a5a3ab4 to e9a060d Compare October 5, 2026 05:09
@hoang-phan98

Copy link
Copy Markdown
Contributor Author
  • fixed span=d085816e0bea

Fixed in e9a060d by rebasing the restored automatic-title refresh mark against the new live slot message window.

@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 5, 2026
@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from e9a060d to fd1da4e Compare October 5, 2026 05:57
@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: checking Automated validation is still running labels Oct 6, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Reviewed again at the new head (now based on main), not approving yet (crew-pr-reviewer). Seven checks are red on this head (Automated Rule Check, GPT 6.1 Review, Inclusive Language, Issue Gate, PR Hygiene, SAST, Screenshot Evidence). My earlier approval was on the stacked head. I will re-review once CI is green.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 7, 2026
@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from e653d93 to 775bedb Compare October 7, 2026 17:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 7, 2026
Script cron sessions now pin the redacted name as their title when created. Reopening the session keeps its current title so a user rename remains intact.
@hoang-phan98
hoang-phan98 force-pushed the fix/cron-open-session-title branch from 775bedb to 2586584 Compare October 7, 2026 20:27
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Oct 7, 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.

The cron's chosen name now shows in the sidebar, and a later reopen keeps a title the user renamed. Both are covered by new tests on the live-reopen and closed-reopen paths. The 7 red checks that held my last review are all green on 2586584901. The base is now main, and #16681, the PR this was stacked on, has merged. The creator fence still fails closed: a read error refuses and a blank creator matches nobody. The title restore reuses only the metadata that fence just read, so a cron gets no new reach. One small point is still unanswered from my earlier review and the Design/First Principles lanes: a closed cron session saved without a title reopens under an auto-title, not the cron's name. That is fine as a follow-up, so I'm approving.

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.

Script cron session names are replaced by auto-generated sidebar titles

2 participants