Conversation
📝 WalkthroughWalkthroughAgentRuntimeBridge.swift's Claude wrapper settings payload is expanded to inject managed activity hooks for surface interactions. Three new sections are added: PermissionRequest with a universal matcher, and Notification with two matchers (permission_prompt and elicitation_dialog), each triggering hooks to mark completion. Tests are updated to verify these new hook sections. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift (1)
256-285: Factor the repeatedcompletedhook payload into one builder.The same command stanza is now duplicated across
Stop,PermissionRequest, and bothNotificationentries. Centralizing that payload would make future hook changes one-shot instead of editing multiple embedded JSON fragments.As per coding guidelines, "Prefer small, composable methods and keep methods focused and readable".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift` around lines 256 - 285, The JSON hook command payload for the completed hook is duplicated across "Stop", "PermissionRequest", and both "Notification" entries; create a small helper (e.g., buildCompletedHook() or makeCompletedHookPayload()) in AgentRuntimeBridge that returns the consolidated hook structure (the command string using "$SHELLRAISER_HELPER_PATH" and "$SHELLRAISER_SURFACE_ID"), then replace the duplicated embedded JSON fragments in the Stop, PermissionRequest, and Notification builders with a call to that helper so future changes are made in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Tests/ShellraiserTests/AgentRuntimeBridgeTests.swift`:
- Around line 20-24: The test currently only checks wrapperContents contains
entries for "PermissionRequest", "Notification", and matchers but not that those
hooks map to the completed lifecycle; update the assertions in
AgentRuntimeBridgeTests (e.g., the expectations referencing wrapperContents) to
also assert the specific mapping value is "\"state\": \"completed\"" (or the
exact completed mapping used by the product) for the new hooks—ensure you check
that the PermissionRequest, Notification, and matcher entries include the
completed state rather than started or another command so a regression will fail
if they do not map to completed.
---
Nitpick comments:
In `@Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift`:
- Around line 256-285: The JSON hook command payload for the completed hook is
duplicated across "Stop", "PermissionRequest", and both "Notification" entries;
create a small helper (e.g., buildCompletedHook() or makeCompletedHookPayload())
in AgentRuntimeBridge that returns the consolidated hook structure (the command
string using "$SHELLRAISER_HELPER_PATH" and "$SHELLRAISER_SURFACE_ID"), then
replace the duplicated embedded JSON fragments in the Stop, PermissionRequest,
and Notification builders with a call to that helper so future changes are made
in one place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1307b620-b340-4c3d-9180-dae6de318952
📒 Files selected for processing (2)
Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swiftTests/ShellraiserTests/AgentRuntimeBridgeTests.swift
| XCTAssertTrue(wrapperContents.contains("\"PermissionRequest\"")) | ||
| XCTAssertTrue(wrapperContents.contains("\"matcher\": \"*\"")) | ||
| XCTAssertTrue(wrapperContents.contains("\"Notification\"")) | ||
| XCTAssertTrue(wrapperContents.contains("\"matcher\": \"permission_prompt\"")) | ||
| XCTAssertTrue(wrapperContents.contains("\"matcher\": \"elicitation_dialog\"")) |
There was a problem hiding this comment.
Assert the new hooks still map to completed.
These checks only prove the sections and matchers exist. A regression where one of the new hooks emitted started or pointed at a different command would still pass, which misses the PR’s actual behavior change.
🔍 Tighten the assertion
XCTAssertTrue(wrapperContents.contains("\"Notification\""))
XCTAssertTrue(wrapperContents.contains("\"matcher\": \"permission_prompt\""))
XCTAssertTrue(wrapperContents.contains("\"matcher\": \"elicitation_dialog\""))
+ XCTAssertEqual(
+ wrapperContents.components(
+ separatedBy: #"claudeCode \"$SHELLRAISER_SURFACE_ID\" completed"#
+ ).count - 1,
+ 4
+ )
XCTAssertFalse(wrapperContents.contains("\"SubagentStop\""))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Tests/ShellraiserTests/AgentRuntimeBridgeTests.swift` around lines 20 - 24,
The test currently only checks wrapperContents contains entries for
"PermissionRequest", "Notification", and matchers but not that those hooks map
to the completed lifecycle; update the assertions in AgentRuntimeBridgeTests
(e.g., the expectations referencing wrapperContents) to also assert the specific
mapping value is "\"state\": \"completed\"" (or the exact completed mapping used
by the product) for the new hooks—ensure you check that the PermissionRequest,
Notification, and matcher entries include the completed state rather than
started or another command so a regression will fail if they do not map to
completed.
Summary by CodeRabbit
New Features
Tests