Skip to content

An open-source, faster Devin alternative

TypeScript

feat(cli): golden fixture for C4 lockstep + CLI-reference docs (flue)

Igor Zalutski0ae273ba36db
diff --git a/cmd/oc/internal/filesetdigest/fixture_test.go b/cmd/oc/internal/filesetdigest/fixture_test.go
new file mode 100644
index 00000000..7f499cf4
--- /dev/null
+++ b/cmd/oc/internal/filesetdigest/fixture_test.go
@@ -0,0 +1,82 @@
+package filesetdigest
+
+import (
+ "compress/gzip"
+ "encoding/base64"
+ "encoding/json"
+ "io"
+ "os"
+ "strings"
+ "testing"
+)
+
+// goldenFixture mirrors testdata/golden-fileset.json — the SHARED cross-language
+// golden vector for contract 4. The same file is consumed by the sessions-api and
+// oc-runtimes test suites; computeFilesetDigest(files) must equal `digest` in all
+// three. Regenerate with scratch gen-fixture.mjs (reference JS) if the vector changes.
+type goldenFixture struct {
+ Digest string `json:"digest"`
+ Files []struct {
+ Path string `json:"path"`
+ Mode int `json:"mode"`
+ ContentBase64 string `json:"contentBase64"`
+ } `json:"files"`
+ CanonicalTarGzBase64 string `json:"canonicalTarGzBase64"`
+}
+
+func loadFixture(t *testing.T) goldenFixture {
+ t.Helper()
+ raw, err := os.ReadFile("testdata/golden-fileset.json")
+ if err != nil {
+ t.Fatalf("read fixture: %v", err)
+ }
+ var fx goldenFixture
+ if err := json.Unmarshal(raw, &fx); err != nil {
+ t.Fatalf("parse fixture: %v", err)
+ }
+ return fx
+}
+
+// TestGoldenFixtureDigest is the C4 lockstep assertion: our Digest over the
+// fixture's fileset equals the fixture's digest (the value the TS suites also
+// assert). Also cross-checks the in-code golden constant against the file.
+func TestGoldenFixtureDigest(t *testing.T) {
+ fx := loadFixture(t)
+ if fx.Digest != goldenDigest {
+ t.Fatalf("fixture digest %s != in-code goldenDigest %s", fx.Digest, goldenDigest)
+ }
+ files := make([]File, len(fx.Files))
+ for i, f := range fx.Files {
+ content, err := base64.StdEncoding.DecodeString(f.ContentBase64)
+ if err != nil {
+ t.Fatalf("decode %q content: %v", f.Path, err)
+ }
+ files[i] = File{Path: f.Path, Mode: f.Mode, Content: content}
+ }
+ if got := Digest(files); got != fx.Digest {
+ t.Fatalf("Digest(fixture files) = %s, want %s", got, fx.Digest)
+ }
+}
+
+// TestGoldenFixtureTarballInterop proves the SERVER verify path works on a
+// FOREIGN-produced bundle: unpack the reference (JS)-produced canonical tar.gz
+// with our ustar reader and recompute the digest. Cross-language bundle interop.
+func TestGoldenFixtureTarballInterop(t *testing.T) {
+ fx := loadFixture(t)
+ tarGz, err := base64.StdEncoding.DecodeString(fx.CanonicalTarGzBase64)
+ if err != nil {
+ t.Fatalf("decode tar.gz: %v", err)
+ }
+ // sanity: it really is gzip
+ if zr, err := gzip.NewReader(strings.NewReader(string(tarGz))); err == nil {
+ _, _ = io.Copy(io.Discard, zr)
+ _ = zr.Close()
+ }
+ files, err := parseTarGz(tarGz)
+ if err != nil {
+ t.Fatalf("parse reference tar.gz: %v", err)
+ }
+ if got := Digest(files); got != fx.Digest {
+ t.Fatalf("digest of reference tarball = %s, want %s", got, fx.Digest)
+ }
+}
diff --git a/cmd/oc/internal/filesetdigest/testdata/golden-fileset.json b/cmd/oc/internal/filesetdigest/testdata/golden-fileset.json
new file mode 100644
index 00000000..9c4b567f
--- /dev/null
+++ b/cmd/oc/internal/filesetdigest/testdata/golden-fileset.json
@@ -0,0 +1,27 @@
+{
+ "note": "Shared golden vector for the OpenComputer bundle fileset digest (flue-slice.md contract 4). computeFilesetDigest(files) MUST equal `digest` in all three implementations: cmd/oc filesetdigest (Go), sessions-api skill-bundle-canonical.ts, oc-runtimes adapter-core skills.ts. `mode` is decimal (0o644=420, 0o755=493); `content` is base64 UTF-8. `canonicalTarGzBase64` is a reference-produced canonical tar.gz — gzip framing is implementation-specific and NOT a byte-level golden; use it only to verify parseTar(gunzip(x)) recomputes `digest`.",
+ "digest": "sha256:1fe94fec330dfaf6deef0774e2fd55cfc2f29ba8fb37f03db13e21cd49cfe5ba",
+ "files": [
+ {
+ "path": "artifact.json",
+ "mode": 420,
+ "contentBase64": "eyJlbnRyeSI6Im9jLmpzIiwicHJvZmlsZV92ZXJzaW9uIjoxfQo="
+ },
+ {
+ "path": "oc.js",
+ "mode": 420,
+ "contentBase64": "ZXhwb3J0IGNvbnN0IHggPSAxOwo="
+ },
+ {
+ "path": "skills/triage/SKILL.md",
+ "mode": 420,
+ "contentBase64": "LS0tCm5hbWU6IHRyaWFnZQotLS0KaGVsbG8K"
+ },
+ {
+ "path": "bin/run.sh",
+ "mode": 493,
+ "contentBase64": "IyEvYmluL3NoCmVjaG8gaGkK"
+ }
+ ],
+ "canonicalTarGzBase64": "H4sIAAAAAAACE+2WTU7DMBBGvc4pjNmSZJxfKYgDILrjAMgEF7u4dmW7qAhxd5SyQERCrGKhdt5mrNnMZt7nET7qtRhjsQnOkmUAAOia5lgBYF4Bmu77PfU5NHVLKJAE7EMUnkCSWf+QdyZt9G9sYG4sNoFdsZ13a23kw6v0QTvLBv6REeREedS29HtbBLXcjEnqvm1/97+qfvoPfddW6H8KLi/KaQWCyuSoHFUaXT8rjqm/8Iw///+qmfnf9QDofwrkYed8pKOzIdIDvaH8GhPgjAgv2phQRq/Fsyzv725Xq2L7lNj/up7d/7zneP8nIc/zzIqtHOjXCmRTQ0ljHMYAgiDIKfMJy71XdQAUAAA="
+}
diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdx
index 5226c51c..d1e6131b 100644
--- a/docs/agent-sessions/repos.mdx
+++ b/docs/agent-sessions/repos.mdx
@@ -283,6 +283,13 @@ Authorization: Bearer $OPENCOMPUTER_API_KEY
}
```
+```bash CLI
+# --source owner/repo[@ref] — repeatable; ref defaults to HEAD (the repo's default branch)
+oc session create --agent issue-fixer \
+ --input "Review this pull request." \
+ --source acme/agents@refs/pull/42/head
+```
+
</CodeGroup>
- **`ref`** (required) — the fetch ref (a branch or `refs/pull/N/head`); a private SHA
@@ -292,7 +299,8 @@ Authorization: Bearer $OPENCOMPUTER_API_KEY
at create); **required for inline sources**.
You can also reference `"owner/repo"` directly instead of a registered id. A session can
-list several immutable sources, such as a PR's base and head.
+list several immutable sources, such as a PR's base and head. On the CLI, repeat
+`--source owner/repo[@ref]` for each — a missing `@ref` resolves to the repo's default branch.
## Check source status
diff --git a/docs/agent-sessions/revisions.mdx b/docs/agent-sessions/revisions.mdx
index 5ed335a1..1c13bd79 100644
--- a/docs/agent-sessions/revisions.mdx
+++ b/docs/agent-sessions/revisions.mdx
@@ -149,6 +149,17 @@ oc agent deploy --no-activate # stage instead of activate
Same as a repo push — handy for CI that isn't GitHub, or trying a change before you commit.
+### Flue framework agents
+
+A [Flue](/agent-sessions/flue) agent (`[runtime] family = "flue"` in `agent.toml`) has no `prompt.md` or `skills/` — its behavior lives in code — so `oc agent deploy` builds and ships an artifact instead:
+
+```bash CLI
+oc agent create support-triage --runtime flue --model anthropic/claude-sonnet-5 # --prompt not needed
+oc agent deploy # build → upload → verify → activate
+```
+
+Deploy runs the app's own build (`oc-flue-build`), uploads the content-addressed artifact, boot-verifies it in a scratch sandbox, then activates a revision — the same staging and rollback model as any other agent. See [Run Flue agents](/agent-sessions/flue).
+
## Roll back and promote
Rollback and promote are the **same primitive** — set the active revision. Re-activate any earlier revision (rollback) or a staged one (promote):