feat(workflows): add lifecycle steer notifications - #1092
Conversation
Assistant-model: GPT-5.5
Implementation NotesFiles changed
Tests run
Decisions / tradeoffs
Blockers
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Review — feat(workflows): add lifecycle chat notificationsThanks for the well-scoped PR and the thorough test suite. The new Most observations below are nits/polish — nothing I think blocks merging. Potential bugs / correctness
Style / consistency (minor)
Performance
Security
Test coverageGenuinely thorough — appreciated. In particular:
A couple of small gaps you might consider adding:
CLAUDE.md compliance
Nice work overall — the regression-test selection is on point, and the suppression abstraction is much cleaner than ad-hoc flags would have been. |
Assistant-model: GPT-5.5
Review — PR #1092Nice scoped addition with a solid 407-line regression suite. The store-level subscription + dedupe-set design is clean, and the restore/seed/suppress dance reads correctly. Comments below. High-priority1. PR description does not match the implementation. The body advertises a substantial SDK change in 2. CHANGELOG mixes a feature and its in-development flip-flop. Medium3. Renderer dedupe key won't survive a factory reload. 4. 5. Stage-awaiting-input notice prints empty-string fields. …whenever Lower-priority6. Suppression "swallows forever". 7. Redundant pre-marking + explicit seed. In 8. 9. CLAUDE.md style nit on TestsCoverage is strong — happy paths, disabled/filtered modes, stage vs run scope, the new promptless-after-resolved-prompt dedupe path, reused-run-ID across session reset, restore-suppression. Two small thoughts:
Style / conventions
Overall: ship-worthy after the PR-description rewrite and the CHANGELOG cleanup. The renderer-dedupe key and the stage prompt format string are worth a follow-up but don't block. |
|
Addressed feedback from #1092 (comment) in 879bff3.
Validation: |
Assistant-model: GPT-5.5
879bff3 to
62b63ae
Compare
|
Follow-up amendment pushed in 62b63ae after final type/API review. Additional adjustment:
Validation: |
PR review (automated, claude-opus-4-7)Thanks for tightening this up — the steer/triggerTurn delivery, the promptless-pause dedupe key, and the suppression-during-replay pattern are well-designed, and the test suite covers the interesting state-machine paths thoroughly. A few smaller observations below; nothing that should block merge. Code quality
Correctness / edge cases
Tests
Security / performanceNo new attack surface; notice content is built from store snapshots already trusted by the host. `truncateSnippet` correctly bounds error/prompt length at `LIFECYCLE_NOTICE_SNIPPET_LIMIT` (240) including the ellipsis. No regex backtracking concerns (`\s+` on bounded input). StyleMatches repo conventions — `.js` import extensions, no `any`, Bun-only commands in scripts/tests, `bun:test` + `node:assert/strict`, `[Unreleased]` CHANGELOG section, README example included. — Generated with Claude Code (opus-4-7) |
Code Review — workflow lifecycle steer notificationsOverall this is a clean, well-tested addition. The dedupe-state design, restore-suppression pattern, and the renderer-host WeakSet guard are all sensible. Most of my notes are minor / nice-to-have. Strengths
Issues / suggestions1. Renderer signature cast is unsafe — The cast
Worth either using the real 2.
3. Embedded JS-snippet in notice text is fragile — If a 4. Notice content length and steer prompt budget — The 5. Loop micro-redundancy —
6. Race window in The unsubscribe-then-install ordering means any store update between them is missed. In single-threaded JS with synchronous 7. Renderer is not unregistered on unsubscribe —
Test coverage gaps (optional)
Style / nit
Nothing here is blocking. The implementation is solid and the test discipline is good. Suggestions above are mostly hardening for a feature that already does what it advertises. |
Assistant-model: GPT-5.5
|
Addressed the failing Windows CI in 5918486. Root cause: Validation:
|
Review —
|
Assistant-model: GPT-5.5
|
Addressed the subscriber error escape feedback in 2247e60.
Validation:
|
Code Review — PR #1092 (lifecycle steer notifications)Solid PR overall. The architecture is clean (state / install / render / format are well separated), the suppression-on-restore pattern is correct, and the test suite genuinely earns its 505 lines — the promptless-pause-after-resolved-prompt test in particular pins down the bug the PR fixes. Findings ordered by impact. Behavior worth confirming intent on
Bugs / correctness
Cleanup
Tests
CLAUDE.md compliance
Nothing here is a blocker — items 1-3 are design tradeoffs worth a sentence in the PR description, items 4-5 are real bugs but low-likelihood, the rest is cleanup. Nice fix. |
Assistant-model: GPT-5.5
|
Pushed 0984b43 to address the Windows CI timeout that appeared after the feedback fix. Failure was in Validation:
|
Review — feat(workflows): add lifecycle steer notificationsSolid feature, well-architected, and the test coverage is good (24 tests in the dedicated suite plus expanded config-loader coverage). The dedupe model — keying terminal notices by A few notes, mostly minor. Code quality / correctness
Wiring / lifecycle
Performance
SecurityNotice content ( Tests
Subagents change (
|
Assistant-model: GPT-5.5
|
Addressed the latest code quality feedback in d824f0d.
Validation:
|
Review: feat(workflows): add lifecycle steer notificationsReviewed What looks good
Potential issues / questions
Test coverageSolid. The new Style / conventions
Overall: ship-it once items 1 and 6 above get a decision. Nice work on the failure-isolation tests in particular — those are the kind of tests that look paranoid until they save you in production. |
* feat(workflows): add lifecycle chat notifications Assistant-model: GPT-5.5 * fix(workflows): steer lifecycle notifications Assistant-model: GPT-5.5 * fix(workflows): address lifecycle notice review Assistant-model: GPT-5.5 * test(workflows): await status writer flush Assistant-model: GPT-5.5 * fix(workflows): isolate lifecycle send failures Assistant-model: GPT-5.5 * fix(subagents): skip eager skill discovery Assistant-model: GPT-5.5 * fix(workflows): harden lifecycle notification feedback Assistant-model: GPT-5.5
Summary
Delivers workflow lifecycle notices as steer prompts into the main chat/model context when a run completes, fails, or pauses awaiting input. Replaces the earlier passive append-only approach: notices now call
pi.sendMessage(..., { triggerTurn: true, deliverAs: "steer" }), waking an idle model or delivering into a streaming one.Key Changes
New:
lifecycle-notifications.tscompleted,failed, andawaiting_inputstates (run-level and stage-level){ triggerTurn: true, deliverAs: "steer" }so the model context is updated on every lifecycle transitionwithWorkflowLifecycleNotificationsSuppressedwraps restore/replay paths so historical workflow states seed dedupe state without emitting notices into the current chatregisterLifecycleNoticeRendererregisters aCardComponentrenderer for theworkflows:lifecycle-noticecustom message type (idempotent per-host)Config (
config-loader.ts)WorkflowNotificationsConfiginterface andworkflowNotificationsfield onWorkflowExtensionConfig/WorkflowEffectiveConfigenabled(default:true) andnotifyOn(default:["completed", "failed", "awaiting_input"])Extension wiring (
index.ts)PiMessageRenderComponentandPiMessageRendererResulttypes; broadensregisterMessageRenderersignature fromstringtoPiMessageRendererResultto match pi's runtime capabilitiesWorkflowLifecycleNotificationStatefor the session lifetimeresetWorkflowLifecycleNotificationStateonsession_startso reused run IDs in a later chat session still emit lifecycle noticesrestoreOnSessionStartinwithWorkflowLifecycleNotificationsSuppressed+ explicitseedWorkflowLifecycleNotificationStateto prevent historical run states from replaying notices into a fresh sessionType cleanup (
chat-surface-message.ts,inline-form-overlay.ts)unknowncasts previously needed to work around the narrowerregisterMessageRendererstring-only signature; both renderers now typecheck cleanly against the broadenedPiMessageRendererResulttypeDocs / Changelog
README.md— documentsworkflowNotificationsconfig with exampleCHANGELOG.md— entries under[Unreleased]for the new feature and the awaiting-input dedupe fixTests
New
test/unit/workflow-lifecycle-notifications.test.ts(591 lines) covering:notifyOnfilteringExpanded
config-loader.test.tsandconfig-loader-helpers.test.tswithworkflowNotificationsvalidation and merge cases.bun run typecheck— passesbun run test:unit— 1659 pass / 0 failCloses #1085