fix(cloud-agent-next): refresh generic git credentials#3919
Open
eshurakov wants to merge 1 commit into
Open
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of commit Incremental changes reviewed
All previously-verified properties remain intact: shell injection fix, credential containment, marker-based idempotency, and atomic storage writes. Files Reviewed (10 files)
Reviewed by claude-4.6-sonnet-20260217 · 805,380 tokens Review guidance: REVIEW.md from base branch |
3523c6a to
432852a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Generic Git repositories such as App Builder use short-lived credentials that can rotate between follow-up messages.
sendMessageV2accepted the refreshedgitTokenbut discarded it, so the Durable Object and workspace could keep using an expired credential and fail later clones or Git operations. Refreshing the credential at durable message admission gives queued work a consistent token without changing the server-managed GitHub and GitLab credential paths.What was done
gitTokenvalues into a transient generic repository credential update while continuing to ignore caller-provided GitHub credentials.originfor warm direct and wrapper-bootstrap workspaces.High-level architecture
sequenceDiagram participant Client as App Builder / legacy client participant API as sendMessageV2 participant DO as CloudAgentSession DO participant Store as Durable Object storage participant Runtime as Workspace runtime Client->>API: Follow-up message + fresh gitToken API->>DO: Submitted turn + transient credential update DO->>DO: Validate turn, model, and queue capacity alt Generic Git repository DO->>Store: Update repository metadata, message pointer, and temporary marker end DO->>Store: Persist message intent and admission state without credential DO->>Store: Remove temporary credential marker DO-->>API: Admission acknowledgement API-->>Client: Queued or sent result rect rgb(245, 245, 245) Note over DO,Runtime: When queued work prepares its workspace DO->>Runtime: Prepare execution from current session metadata alt Cold workspace Runtime->>Runtime: Clone with current credential else Warm workspace Runtime->>Runtime: Refresh origin with current credential end endArchitecture decision
Decision: Treat generic Git credential rotation as a transient, validated session-metadata mutation at durable message admission rather than as part of the immutable queued message intent.
Context: Cloud Agent can resolve managed GitHub and GitLab credentials through the shared token service, but it cannot independently refresh credentials for arbitrary Git providers. Admission retries and existing drain alarms also require the metadata update to be ordered with queue visibility.
Rationale: The Durable Object already owns session metadata and queue coordination, so it can apply the latest generic credential before work is observable while keeping the secret out of message persistence and delivery contracts. A durable current-message pointer plus temporary non-secret markers preserves ordering across partial failures and retries.
Alternatives considered:
Consequences: Generic Git follow-ups can safely rotate credentials for both cold and warm workspaces, while GitHub and managed GitLab remain server-resolved. The trade-off is additional Durable Object admission bookkeeping and an intentionally narrow compatibility contract where only non-empty
gitTokenvalues affect generic Git repositories.Verification
Visual Changes
N/A
Reviewer Notes