Skip to content

computer: Tell code to send Artifacts tokens in a header - #346

Open
scuffi wants to merge 2 commits into
mainfrom
computer/artifacts-description
Open

scuffi wants to merge 2 commits into
mainfrom
computer/artifacts-description

Conversation

@scuffi

@scuffi scuffi commented Nov 25, 2026

Copy link
Copy Markdown
Member

The description the model reads for codemode:artifacts says share() "returns a clone-ready URL with a token embedded". A model that takes it at its word clones from that URL with codemode:git, and git saves a clone's URL in .git/config, token and all, so the token stays in the Workspace after the run and any later code can read it.

The docs already say how to do it: clone and push with the git module, passing the repository's remote as the URL and the token from createToken() in an Authorization header, and keep share()'s URL for git in a shell command, passed through env rather than in the command text. This puts that in the description:

createToken(name, scope?, ttl?) mints a git token ("read" by default): to clone or push with the git module, pass get(name)'s remote as the URL and the token's plaintext in headers: { Authorization: "Bearer <plaintext>" }, not in the URL, which git saves in .git/config. share(name, { scope?, ttl? }) returns the remote URL with a token embedded, for git in a shell command: pass it in env, not in the command text. Tokens and shared URLs are credentials, so never print or return them.

It names "the git module" rather than codemode:git, so it stays right under a backend's scheme.

Testing

artifacts.test.ts checks that the description tells code to send the token in a header and no longer calls the URL clone-ready.

The `codemode:artifacts` description called `share()`'s URL
clone-ready. Code that took it at its word cloned from a URL with a
token in it, and git saves a clone's URL in `.git/config`, so the
token stayed in the Workspace after the run. The docs already say to
clone and push with the git module and the token in an
`Authorization` header, and to pass `share()`'s URL to a shell command
through `env`.

Say the same in the description the model reads.
@changeset-bot

changeset-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 053835e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@cloudflare/computer Patch
@cloudflare/dofs Patch
@cloudflare/computer-rpc Patch
@cloudflare/computerd Patch
@cloudflare/remote-exec Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@cloudflare/computer@346

commit: 03f1148

@scuffi
scuffi marked this pull request as ready for review November 27, 2026 10:48
devin-ai-integration[bot]

This comment was marked as resolved.

A token's plaintext ends in an `?expires=` hint that isn't part of
the credential, as credentialURL() already knows. The description and
the docs example sent the whole plaintext as a bearer token, so a
clone or push following them would fail to authenticate. Tell code to
cut the hint off first, and link the docs from the changeset.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

"@cloudflare/computer": patch
---

`codemode:artifacts` tells code to clone and push with a token in a header, as [the docs](https://github.com/cloudflare/computer/blob/main/docs/17_isolate_javascript.md#codemodeartifacts) do, rather than calling `share()`'s URL clone-ready: git saves a clone's URL, token and all, in `.git/config`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Release link misses header example

The release note links to codemode:artifacts, which shows the shell URL workflow. The header example sits above that anchor under codemode:git.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants