fix(agent): register ph-explore for shared claude sessions#1781
Merged
Conversation
Prompt To Fix All With AIThis is a comment left during a code review.
Path: packages/agent/src/adapters/claude/session/options.test.ts
Line: 23-36
Comment:
**Prefer parameterised test for rewrite registration**
The test iterates over `SUBAGENT_REWRITES` entries in a for-loop inside a single `it`, which obscures which rewrite entry is failing when the assertion fires. Using `it.each` makes each rewrite a named test case and satisfies the project's preference for parameterised tests.
```suggestion
it.each(Object.entries(SUBAGENT_REWRITES))(
'registers rewrite target "%s" → "%s" in options.agents',
(_source, target) => {
const options = buildSessionOptions(makeParams());
const registered = new Set(Object.keys(options.agents ?? {}));
expect(
registered.has(target),
`Rewrite target "${target}" is not registered in options.agents — either register the agent in DEFAULT_CLAUDE_AGENTS or remove the rewrite.`,
).toBe(true);
},
);
```
**Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(agent): register ph-explore for shar..." | Re-trigger Greptile |
joshsny
approved these changes
Apr 21, 2026
e9b0427 to
a0f6dc4
Compare
The Explore -> ph-explore rewrite hook was firing in cloud sessions where ph-explore wasn't registered, because the agent was wired up only in the desktop-specific service path. The rewrite then targeted a non-existent agent type and the run failed. Register ph-explore in the shared session options, make the rewrite hook defensive (skip + warn when the target isn't registered) and drop the duplicate desktop wiring. The agent definition is inlined in options.ts next to buildAgents so there's no extra module just for one constant.
a0f6dc4 to
d6f2b93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cloud task runs can use the shared Claude session setup, but
ph-explorewas only registered in a desktop-specific path. That meant theExplorerewrite could target an agent type that was not available for the current session, causing runs to fail when that subagent path was selected.Changes
ph-exploreagent definition into shared Claude session code so it is registered consistently across envs