Commit fee45e2
authored
fix(atlassian): share one cached, retrying cloudId resolver across Jira, Confluence, and JSM (#6541)
* fix(atlassian): share one cached, retrying cloudId resolver across Jira, Confluence, and JSM
Every Jira, Confluence, and JSM tool re-resolved its site `cloudId` from
`accessible-resources` on each invocation, so a run touching several Atlassian
blocks paid a round trip per block and failed outright if any one of them caught
a transient fault. A single Atlassian 500 took down a production run this way:
the shared retry predicate covers 429/502/503/504 but not 500, so the call was
never replayed.
Four hand-rolled copies of that lookup now read through one memoized resolver. It
caches the promise rather than the value, so concurrent callers join a lookup
already in flight and a rejection is evicted instead of pinned for the TTL. Only
an exact domain match is retained — a single-site fallback is a property of the
calling token, not of the domain, so it answers its own caller without answering
the next one.
Discovery is an idempotent GET, so it replays transient 5xx. That is scoped here
rather than widened into the shared predicate, which also guards non-idempotent
writes; it also keeps the failure out of a whole-block replay, which would re-run
a write a JSM block had already performed. The budget is tighter than the shared
~31s default — four attempts across ~3.5s — and the request carries a timeout so
a wedged fetch cannot strand the callers joined to it.
Two defects fall out of the consolidation. `getConfluenceCloudId` never checked
the response status, so a 500 parsed as JSON, failed the array check, and
surfaced as `No Confluence resources found` — pointing at site permissions rather
than the transient fault. `getAssetsWorkspaceId` used a bare fetch with no retry
and no cache, leaving the Assets path with two uncached discovery hops.
* fix(atlassian): key discovery answers by credential and retry timeouts
Review round 1. Three fixes.
The cache keyed on the normalized domain alone, so a caller joining a lookup
already in flight inherited whichever credential started it — taking that token's
authorization failure, or its single-site fallback pointing at a different site.
Retaining only exact matches closed that for settled entries but not for the
in-flight window, which is where it actually bites. Keys now carry a digest of
the access token, so an answer is only ever reused by the credential that earned
it. That also removes the reason the cache needed a `retain` channel.
The request's own `AbortSignal.timeout` rejects with a `TimeoutError` that has no
status and no message the shared predicate matches, so a slow site failed on the
first attempt despite the retry budget. It is now explicitly retryable — only
`TimeoutError`, since an `AbortError` means a caller cancelled — and the per-
request timeout drops to 5s so four attempts stay bounded.
Jira bulk read had been pointed at the cached resolver, but the tool's own
configured request IS the discovery call and `transformResponse` only runs on a
2xx. It was therefore re-issuing a request whose answer it already held. It now
matches against that payload through the shared selector, so the matching logic
stays in one place without a second round trip.
* fix(jira): treat an empty bulk-read cloudId as missing
The consolidation replaced a truthiness check with `??`, so an empty-string
`cloudId` counted as supplied and bulk read skipped discovery entirely, building
its request URL around an empty id. Back to `||`, matching every sibling tool.1 parent 6fdb145 commit fee45e2
6 files changed
Lines changed: 519 additions & 130 deletions
File tree
- apps/sim
- lib/atlassian
- tools
- confluence
- jira
- jsm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
0 commit comments