refactor: remove sessionRepositories and activitySinks maps; add issueTrackers TODOs (CYPACK-968)#992
refactor: remove sessionRepositories and activitySinks maps; add issueTrackers TODOs (CYPACK-968)#992cyrusagent wants to merge 6 commits intomainfrom
Conversation
…K-968) Delete the redundant sessionRepositories: Map<string, string> from EdgeWorker, replacing all ~14 usage sites with direct reads from session.repositories[0]?.repositoryId. The reverse-lookup in repo deletion now uses session.repositories.some() which is more correct for multi-repo sessions. Also adds TODO comments documenting: - activitySinks multi-workspace limitation for cross-workspace sessions - issueTrackers composite key needed for multi-platform support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…PACK-968) Change activitySinks from Map<repoId, sink> to Map<workspaceId, sink>. This eliminates redundant sink instances (one per workspace instead of one per repo), decouples the lookup from which repo is "primary", and makes the data model honest about what it represents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LinearActivitySink is a thin, stateless wrapper around IIssueTrackerService. Instead of maintaining a pre-built map, create sinks on-the-fly at session registration time via createActivitySink() helper. Falls back to NoopActivitySink when no issue tracker is available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| const allActiveSessions = this.agentSessionManager.getActiveSessions(); | ||
| const activeSessions = allActiveSessions.filter( | ||
| (s) => this.sessionRepositories.get(s.id) === repo.id, | ||
| const activeSessions = allActiveSessions.filter((s) => | ||
| s.repositories.some((r) => r.repositoryId === repo.id), | ||
| ); |
There was a problem hiding this comment.
This is also wrong now that CYPACK-911 has been merged. There is no longer a requirement for sessions to be linked to repos, now that we have support for surfaces like Slack. This will also need to be changed once multi-repo support is added
| const repoId = this.sessionRepositories.get(childSessionId); | ||
| const childSession = | ||
| this.agentSessionManager.getSession(childSessionId); | ||
| const repoId = childSession?.repositories[0]?.repositoryId; |
There was a problem hiding this comment.
This will need to change once multi-repo session support is added. handleResumeParentSession should not require the repo now that CYPACK-911 has been merged. I presume it's needed to build the allowed tools for the session, but the repo config itself should not be passed to this method.
| const repoId = this.sessionRepositories.get(sessionId); | ||
| const repoId = session.repositories[0]?.repositoryId; |
There was a problem hiding this comment.
Same thing with this.
| const repoId = this.sessionRepositories.get(sessionId); | ||
| const repoId = session.repositories[0]?.repositoryId; |
|
@cyrusagent look at the comments left on this PR as review and address them |
|
This repository is not configured with Cyrus. Please add it at https://app.atcyrus.com/repos to start using Cyrus here. |
1 similar comment
|
This repository is not configured with Cyrus. Please add it at https://app.atcyrus.com/repos to start using Cyrus here. |
|
I can't connect to your local environment because the Cyrus process isn't running. Run |
|
This repository is not configured with Cyrus. Please add it at https://app.atcyrus.com/repos to start using Cyrus here. |
1 similar comment
|
This repository is not configured with Cyrus. Please add it at https://app.atcyrus.com/repos to start using Cyrus here. |
…internally (CYPACK-968) Move repo resolution out of event handler callbacks and into the handler methods themselves via a new resolveSessionRepo helper. This removes the requirement for sessions to be linked to repos at the call site, aligning with CYPACK-911 where sessions can exist without repos (e.g. Slack surfaces). Also adds multi-repo TODOs for removeDeletedRepositories and the helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pushed. Here's a summary of the changes addressing all 4 review comments:
All changes use a new |
| @@ -363,21 +346,12 @@ export class EdgeWorker extends EventEmitter { | |||
| this.agentSessionManager.on( | |||
| "validationLoopIteration", | |||
| async ({ sessionId, session, fixerPrompt, iteration, maxIterations }) => { | |||
| const repoId = this.sessionRepositories.get(sessionId); | |||
Summary
sessionRepositories: Map<string, string>from EdgeWorker — it was a lossy cache ofsession.repositories[0].repositoryIdthat only stored the primary repoactivitySinks: Map<string, IActivitySink>entirely —LinearActivitySinkis a stateless wrapper aroundIIssueTrackerService, so sinks are now created on-the-fly viacreateActivitySink()helper at session registration timeissueTrackers(in both EdgeWorker.ts and CLAUDE.md) noting composite key needed for multi-platform supportImplementation approach
sessionRepositories removal
Each
sessionRepositories.get(sessionId)call was replaced based on context:sessionfrom the event payload directlythis.agentSessionManager.getSession(id)to fetch the session firstfirstSession.repositories[0]?.repositoryIds.repositories.some()for correct multi-repo matchingactivitySinks deletion
createActivitySink(workspaceId)helper that looks up issueTracker and createsLinearActivitySinkon-the-fly, falling back toNoopActivitySinkcreateActivitySink()instead of map lookupTesting
Links