@straiffi/archon 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Archon</title>
8
- <script type="module" crossorigin src="/assets/index-vramqRal.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-D3G9pPr9.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-BhQzJS4j.css">
10
10
  </head>
11
11
  <body>
@@ -878,6 +878,16 @@ const bundlePullRequestDiscoveryErrorTimestamps = new Map();
878
878
  const bundlePullRequestSyncInFlight = new Map();
879
879
  const bundlePullRequestSyncErrorTimestamps = new Map();
880
880
  const getBundlePullRequestDiscoveryKey = (projectId, bundleId) => `${projectId}:${bundleId}`;
881
+ const startPassiveGitHubWork = (label, callback) => {
882
+ setImmediate(() => {
883
+ try {
884
+ callback();
885
+ }
886
+ catch (error) {
887
+ console.warn(`[integrations] github passive work failed ${label}`, error);
888
+ }
889
+ });
890
+ };
881
891
  const isBundlePullRequestDiscoveryCoolingDown = (timestamps, key, cooldownMs) => {
882
892
  const lastAttemptAt = timestamps.get(key);
883
893
  if (lastAttemptAt === undefined) {
@@ -2102,15 +2112,23 @@ app.get('/tickets/:id', async (req, res) => {
2102
2112
  if (!matchesTicketProjectContext(ticket, req)) {
2103
2113
  return res.status(404).json({ error: 'Not found' });
2104
2114
  }
2115
+ let passivePullRequestContext = null;
2105
2116
  if (ticket.project_id && ticket.worktree_bundle_id) {
2106
2117
  const project = getProjectById(ticket.project_id);
2107
2118
  const bundle = project ? getBundle(ticket.worktree_bundle_id, project.id) : null;
2108
2119
  if (project && bundle) {
2120
+ passivePullRequestContext = { project, bundle };
2121
+ }
2122
+ }
2123
+ res.json(ticket);
2124
+ if (passivePullRequestContext) {
2125
+ const { project, bundle } = passivePullRequestContext;
2126
+ startPassiveGitHubWork('ticket-open-pr-sync', () => {
2109
2127
  startTrackedBundlePullRequestSyncIfNeeded(project, bundle);
2110
2128
  startBundlePullRequestDiscoveryIfNeeded(project, bundle);
2111
- }
2129
+ });
2112
2130
  }
2113
- return res.json(ticket);
2131
+ return;
2114
2132
  });
2115
2133
  app.get('/tickets/:id/review-findings', (req, res) => {
2116
2134
  const ticket = getTicketRouteContext(req.params.id);
@@ -2186,12 +2204,13 @@ app.get('/bundles', async (req, res) => {
2186
2204
  timing.mark('ensure_project_root_bundle');
2187
2205
  const bundles = listBundles(result.project.id);
2188
2206
  timing.mark('list_bundles');
2189
- startProjectBundlePullRequestSyncIfNeeded(result.project, bundles);
2190
- timing.mark('start_pr_sync');
2191
2207
  const serializedBundles = bundles.map(bundle => serializeBundleRow(result.project.id, bundle));
2192
2208
  timing.mark('serialize_bundles');
2193
2209
  timing.end({ count: serializedBundles.length });
2194
2210
  res.json(serializedBundles);
2211
+ startPassiveGitHubWork('project-bundle-pr-sync', () => {
2212
+ startProjectBundlePullRequestSyncIfNeeded(result.project, bundles);
2213
+ });
2195
2214
  });
2196
2215
  app.get('/bundles/:id/details', async (req, res) => {
2197
2216
  const result = getRequiredProject(req);
@@ -2215,9 +2234,11 @@ app.get('/bundles/:id/conversation', (req, res) => {
2215
2234
  if (!bundle) {
2216
2235
  return res.status(404).json({ error: 'Bundle not found' });
2217
2236
  }
2218
- startBundlePullRequestDiscoveryIfNeeded(result.project, bundle);
2219
2237
  const payload = serializeBundleConversationDetails(result.project, bundle);
2220
2238
  res.json(payload);
2239
+ startPassiveGitHubWork('bundle-conversation-pr-discovery', () => {
2240
+ startBundlePullRequestDiscoveryIfNeeded(result.project, bundle);
2241
+ });
2221
2242
  });
2222
2243
  app.get('/bundles/:id/review-findings', (req, res) => {
2223
2244
  const result = getRequiredProject(req);