Repository navigation
Conversation
Slack installs resolve their bot token from the encrypted slack_oauth_credentials row. upsertSlackInstallation writes the platform_integrations.metadata object with non-secret workspace identifiers only, requires the credential-store write to complete before returning, and every server read path (connection test, uninstall cleanup, and the bot requester-info permalink lookup) obtains the token through the credential store. The maintenance script writes the credential row for each existing integration and then rewrites its metadata object to contain only the non-secret fields; an integration whose credential row cannot be written keeps its metadata unchanged and appears in the run report so the script can be repeated.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change is the merge of Assumptions: Verification Notes
Files Reviewed (6 files)
Previous Review Summaries (6 snapshots, latest commit fa219c7)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit fa219c7)Status: No Issues Found | Recommendation: Merge Executive SummaryThe only change since the prior review is the merge of Assumptions: Files Reviewed (6 files)
Previous review (commit 9bd9453)Status: No Issues Found | Recommendation: Merge Executive SummaryThe only commit since the last review is a mechanical rename of the maintenance script's scrub pass to a normalization pass, applied consistently across flags, counters, log lines, and the Assumptions: Files Reviewed (6 files)
Previous review (commit 1227e52)Status: No Issues Found | Recommendation: Merge Executive SummaryThe incremental commit only aligns documentation comments and report labels with the already-reviewed credential-store cutover, plus a test title; no functional code changed and no new issues were found. Files Reviewed (5 files)
Previous review (commit a65b846)Status: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change wraps the maintenance script's credential lookup so a read failure is reported per row instead of aborting the run, logs ineligible rows by integration ID, and skips the comparison when metadata no longer holds a plaintext token; both prior suggestions are resolved and no new issues were found. Overview
Files Reviewed (1 file changed in this increment)
Previous review (commit c53e5d0)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe atomic install write and mismatch-aware scrub resolve the prior findings; two error-handling and reporting gaps remain in the backfill script. Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit ad4bfc2)Status: 5 Issues Found | Recommendation: Address before merge Executive SummaryThe cutover to the encrypted credential store is directionally right, but the required credential write is not atomic with the Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (5 files)
Reviewed by deepseek-flash-latest · Input: 95.9K · Output: 18.3K · Cached: 1.6M Review guidance: REVIEW.md from base branch |
Slack installs now perform the platform integration write and the credential-store write in one database transaction, so both complete or neither does. The credential store accepts a caller-provided transaction. The maintenance script removes the token key from metadata with a targeted jsonb update and rewrites a row only when its stored credential decrypts to the row's current metadata token; any other row keeps its metadata and appears in the run report. The connection test also covers failures reading the credential row, and the test suite exercises the unreadable-credential path including its error report.
The maintenance script's credential comparison covers lookup failures alongside read failures, so a database error during the run is reported per row instead of aborting the run. Rows whose stored credential does not match, or cannot be read, are logged with their integration id, and rows whose metadata already lacks the token key skip the comparison so repeat runs do not count them as ineligible.
Update the maintenance script's header, summary labels, and code comments, the credential store and keyset doc comments, and one test name so they describe the finished behavior: eligibility for the metadata rewrite, the counters an operator reads, and the install path requiring the credential write to succeed.
…l-store-cutover # Conflicts: # apps/web/src/lib/integrations/platforms/slack/credential-store.ts # apps/web/src/lib/integrations/slack-service.test.ts # apps/web/src/lib/integrations/slack-service.ts
Evidence
Evidence: demonstrated — on head 24c0e8d, against a local development Postgres with owned test fixtures: the maintenance script's dry run listed two eligible rows, the execute run wrote both credential rows and rewrote both integration rows to workspace-field metadata, a repeat execute wrote nothing further, the install path re-authorized a suspended row in place, and the read path returned the installed value and a backfilled value from the credential store while a row with no credential returned null. The Slack service, credential-store, callback, install-conflict, and bot suites, web typecheck, and lint pass on the same head.
Slack installs resolve their bot token through the encrypted
slack_oauth_credentialscredential store, completing that store's rollout.upsertSlackInstallationcompletes the credential-store write before the installfinishes, and the connection test, uninstall cleanup, and bot requester-info
lookup obtain the token through the store. The metadata object written for each
install holds the workspace's identifiers and model policy, and the maintenance
script rewrites existing rows to the same shape, reporting any row it could not
update.
The install path accepts a caller-provided transaction. A caller that already
holds one — the Slack OAuth callback's workspace-installation lock — gets the
integration row and its credential row inside that transaction; otherwise the
install opens its own, so the two rows commit together either way.
Merge-by-human: database and integration credential change.
Changed
apps/web/src/lib/integrations/slack-service.ts: install writes resolve throughthe credential store; the integration row and credential row commit in one
transaction, joined to a caller-provided one when present; read paths
(connection test, uninstall cleanup) use the store; unused
sendMessageexportand metadata-reading helper removed.
apps/web/src/lib/bot/platforms/slack.tsx: requester-info lookup uses the store.apps/web/src/scripts/d2026-08-07_backfill-slack-oauth-credentials.ts: writescredential rows for existing integrations, then rewrites eligible rows with a
targeted jsonb update; a row is rewritten only when its stored credential
decrypts to the row's current value, and rows it cannot update are reported with
their integration id so the script can be repeated.
apps/web/src/lib/integrations/platforms/slack/credential-store.ts: accepts acaller-provided transaction.
apps/web/src/lib/integrations/platforms/slack/credential-test-keyset.ts: test-onlyenvelope keyset for suites that run the real store.
integration row carries workspace fields only plus its credential row.
Verification
pnpm --filter web exec jest --runInBand src/lib/integrations/slack-service.test.ts src/lib/integrations/slack-service.reinstall.db.test.ts src/lib/integrations/platforms/slack src/app/api/integrations/slack/callback/route.test.ts src/app/api/integrations/oauth-install-conflict.test.ts src/lib/integrations/oauth/platforms/slack-callback.test.ts src/lib/bot/platforms— 12 suites, 131 tests passedpnpm --filter web typecheck— exit 0pnpm exec oxlint --config .oxlintrc.json <changed files>— passand one skipped row;
--executewrote both credential rows and left{ model_slug, bot_user_id }and{ bot_user_id }in metadata; a repeat--executewrote nothing and kept both credentials at their existing versions.active, suspension cleared, metadata
{ bot_user_id, model_slug }, one credentialrow, and
getSlackBotTokenreturning the installed value.getSlackBotTokenreturned the installed valueand the backfilled value, each decrypted from its credential row, and null for an
integration with no credential row.
Production prerequisites
SLACK_CREDENTIAL_KEYSET_JSONmust be configured in the web deployment's environment.--executeafter this change deploys, in the same release window.Proxy answers
The owner's proxy gave these answers in the owner's place.
Answer: Fail the install (Recommended)
Confidence: 0.50
Answer: Skip and report (Recommended)
Confidence: 0.65
Answer: Delete sendMessage
Confidence: 0.80
Answer: Cutover first, scrub after (Recommended)
Confidence: 0.80
Answer: Report to Sentry too
Confidence: 0.50
Answer: Also capture to Sentry
Confidence: 0.50
Answer: Same run (Recommended)
Confidence: 0.60
Answer: Minimal neutral body (Recommended)
Confidence: 0.85
Answer: Keep the section in the body with neutral question summaries
Confidence: 0.60
Answer: Toggle the pull request to draft and back to ready
Confidence: 0.66