Skip to content

Commit 2f31d93

Browse files
committed
Fix clearing of codegen session
This regressed recently in a refactor.
1 parent 03ae5a7 commit 2f31d93

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

apps/desktop/src/components/StackView.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@
330330
const isStackActiveQuery = $derived(claudeCodeService.isStackActive(projectId, stackId));
331331
const isStackActive = $derived(isStackActiveQuery?.response || false);
332332
const events = $derived(claudeCodeService.messages({ projectId, stackId }));
333+
const sessionId = $derived(rulesService.aiSessionId(projectId, stackId));
333334
const hasRulesToClear = $derived(rulesService.hasRulesToClear(projectId, stackId));
334335
const permissionRequests = $derived(claudeCodeService.permissionRequests({ projectId }));
335336
const attachments = $derived(attachmentService.getByBranch(branchName));
@@ -678,6 +679,7 @@
678679
permissionRequests={permissionRequests.response || []}
679680
onSubmit={sendMessage}
680681
onChange={(prompt) => messageSender?.setPrompt(prompt)}
682+
sessionId={sessionId.response}
681683
{isStackActive}
682684
{hasRulesToClear}
683685
/>

apps/desktop/src/lib/rules/rulesService.svelte.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,24 @@ export default class RulesService {
6161
);
6262
}
6363

64+
aiSessionId(projectId: string, stackId?: string) {
65+
return this.api.endpoints.listWorkspaceRules.useQuery(
66+
{ projectId },
67+
{
68+
transform: (result) => {
69+
const allRules = workspaceRulesSelectors.selectAll(result);
70+
const rule = allRules.find(
71+
(r) => isAiRule(r) && r.action.subject.subject.target.subject === stackId
72+
);
73+
const sessionId = rule?.filters.at(0)?.subject;
74+
if (typeof sessionId === 'string') {
75+
return sessionId;
76+
}
77+
}
78+
}
79+
);
80+
}
81+
6482
async fetchListWorkspaceRules(projectId: string) {
6583
return await this.api.endpoints.listWorkspaceRules.fetch(
6684
{ projectId },

0 commit comments

Comments
 (0)