helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: launch: hide vs code

Hide VS Code integration for now while leaving it accessible through `ollama launch vscode`

Changed files:
filename: cmd/launch/registry.go
patch: @@ -33,7 +33,7 @@ type IntegrationInfo struct {
 	Description string
 }
 
-var launcherIntegrationOrder = []string{"vscode", "opencode", "droid", "pi", "cline"}
+var launcherIntegrationOrder = []string{"opencode", "droid", "pi", "cline"}
 
 var integrationSpecs = []*IntegrationSpec{
 	{
@@ -136,6 +136,7 @@ var integrationSpecs = []*IntegrationSpec{
 		Runner:      &VSCode{},
 		Aliases:     []string{"code"},
 		Description: "Microsoft's open-source AI code editor",
+		Hidden:      true,
 		Install: IntegrationInstallSpec{
 			CheckInstalled: func() bool {
 				return (&VSCode{}).findBinary() != ""

filename: cmd/tui/tui.go
patch: @@ -60,9 +60,6 @@ var mainMenuItems = []menuItem{
 	{
 		integration: "openclaw",
 	},
-	{
-		integration: "vscode",
-	},
 }
 
 var othersMenuItem = menuItem{
@@ -142,7 +139,6 @@ func otherIntegrationItems(state *launch.LauncherState) []menuItem {
 		"claude":   true,
 		"codex":    true,
 		"openclaw": true,
-		"vscode":   true,
 	}
 
 	var items []menuItem
Repository: huggingface/transformers
Pull request: CI] Small T5 expectations updated

This is a small T5 expectations update. 
It is the same for both AMD and NVIDIA A10 GPUs.

Changed files:
filename: tests/models/t5/test_modeling_t5.py
patch: @@ -1058,7 +1058,7 @@ def test_small_v1_1_integration_test(self):
         loss = model(input_ids.to(torch_device), labels=labels.to(torch_device)).loss
         mtf_score = -(labels.shape[-1] * loss.item())
 
-        EXPECTED_SCORE = -40.1645
+        EXPECTED_SCORE = -59.0293
         torch.testing.assert_close(
             mtf_score,
             EXPECTED_SCORE,
@@ -1087,7 +1087,7 @@ def test_small_byt5_integration_test(self):
         loss = model(input_ids.to(torch_device), labels=labels.to(torch_device)).loss
         mtf_score = -(labels.shape[-1] * loss.item())
 
-        EXPECTED_SCORE = -44.6276
+        EXPECTED_SCORE = -60.7397
         torch.testing.assert_close(
             mtf_score,
             EXPECTED_SCORE,
Repository: nodejs/node
Pull request: repl: fix flaky test-repl-programmatic-history

## Summary

Fixes flaky test `test/parallel/test-repl-programmatic-history.js`.

## Problem

The test was flaky because the FileHandle for the history file could be garbage collected before being explicitly closed, causing `ERR_INVALID_STATE` errors when the handle was already closed by the GC finalizer.

## Solution

- Added an explicit `closeHandle()` method to `ReplHistory` class
- Modified `REPLServer.close()` to wait for the history file handle to be properly closed before completing the close operation
- This ensures deterministic cleanup regardless of GC timing

## Verification

Verified with `python3 tools/test.py --repeat 1000 test/parallel/test-repl-programmatic-history.js` - all 1000 runs passed with 0 failures.

Refs: https://github.com/nodejs/reliability/issues/1450

Changed files:
filename: lib/internal/repl/history.js
patch: @@ -58,6 +58,7 @@ const kResolveHistoryPath = Symbol('_kResolveHistoryPath');
 const kReplHistoryMessage = Symbol('_kReplHistoryMessage');
 const kFlushHistory = Symbol('_kFlushHistory');
 const kGetHistoryPath = Symbol('_kGetHistoryPath');
+const kCloseHandle = Symbol('_kCloseHandle');
 
 class ReplHistory {
   constructor(context, options) {
@@ -393,15 +394,29 @@ class ReplHistory {
     }
     this[kContext].off('line', this[kOnLine].bind(this));
 
+    await this[kCloseHandle]();
+  }
+
+  async [kCloseHandle]() {
     if (this[kHistoryHandle] !== null) {
+      const handle = this[kHistoryHandle];
+      this[kHistoryHandle] = null;
       try {
-        await this[kHistoryHandle].close();
+        await handle.close();
       } catch (err) {
         debug('Error closing history file:', err);
       }
     }
   }
 
+  /**
+   * Closes the history file handle.
+   * @returns {Promise<void>}
+   */
+  closeHandle() {
+    return this[kCloseHandle]();
+  }
+
   [kReplHistoryMessage]() {
     if (this[kHistory].length === 0) {
       ReplHistory[kWriteToOutput](

filename: lib/repl.js
patch: @@ -1039,12 +1039,18 @@ class REPLServer extends Interface {
     this[kBufferedCommandSymbol] = '';
   }
   close() {
-    if (this.terminal && this.historyManager.isFlushing && !this._closingOnFlush) {
+    if (this.terminal && this.historyManager?.isFlushing && !this._closingOnFlush) {
       this._closingOnFlush = true;
-      this.once('flushHistory', () => super.close());
+      this.once('flushHistory', () => this.close());
 
       return;
     }
+    // Ensure the history file handle is closed before completing
+    if (this.terminal && this.historyManager?.closeHandle && !this._historyHandleClosed) {
+      this._historyHandleClosed = true;
+      this.historyManager.closeHandle().then(() => super.close());
+      return;
+    }
     process.nextTick(() => super.close());
   }
   createContext() {
Repository: ollama/ollama
Pull request: mlxrunner: schedule periodic snapshots during prefill

Add periodic snapshots every 8k tokens and near the end of the prompt so that long prompts can be partially restored and thinking/generation can be retried without full reprocessing.

Changed files:
filename: x/mlxrunner/cache/recurrent.go
patch: @@ -18,32 +18,20 @@ type RecurrentCache struct {
 	headKDim  int
 }
 
-func (c *RecurrentCache) setStateRaw(old, v *mlx.Array) *mlx.Array {
+func (c *RecurrentCache) setState(old, v *mlx.Array, contiguous bool) *mlx.Array {
 	if v == nil || !v.Valid() {
 		return old
 	}
 
-	mlx.Pin(v)
-	mlx.Unpin(old)
-
-	return v
-}
-
-func (c *RecurrentCache) setStateDetached(old, v *mlx.Array, ensureContiguous bool) *mlx.Array {
-	if v == nil || !v.Valid() {
-		return old
-	}
-
-	root := v
-	if ensureContiguous {
-		root = mlx.Contiguous(v, false)
+	if contiguous {
+		v = mlx.Contiguous(v, false)
 	}
-	detached := root.Clone()
+	v = v.Clone()
 
-	mlx.Pin(detached)
+	mlx.Pin(v)
 	mlx.Unpin(old)
 
-	return detached
+	return v
 }
 
 func NewRecurrentCache(convTail, convDim, numVHeads, headVDim, headKDim int32) *RecurrentCache {
@@ -70,10 +58,10 @@ func (c *RecurrentCache) ensure(batch int, dtype mlx.DType) {
 	}
 
 	if needConv {
-		c.convState = c.setStateRaw(c.convState, mlx.Zeros(dtype, batch, c.convTail, c.convDim))
+		c.convState = c.setState(c.convState, mlx.Zeros(dtype, batch, c.convTail, c.convDim), false)
 	}
 	if needDelta {
-		c.deltaState = c.setStateRaw(c.deltaState, mlx.Zeros(dtype, batch, c.numVHeads, c.headVDim, c.headKDim))
+		c.deltaState = c.setState(c.deltaState, mlx.Zeros(dtype, batch, c.numVHeads, c.headVDim, c.headKDim), false)
 	}
 }
 
@@ -83,7 +71,7 @@ func (c *RecurrentCache) ConvState(batch int, dtype mlx.DType) *mlx.Array {
 }
 
 func (c *RecurrentCache) SetConvState(v *mlx.Array) {
-	c.convState = c.setStateDetached(c.convState, v, true)
+	c.convState = c.setState(c.convState, v, true)
 }
 
 func (c *RecurrentCache) DeltaState(batch int, dtype mlx.DType) *mlx.Array {
@@ -92,7 +80,7 @@ func (c *RecurrentCache) DeltaState(batch int, dtype mlx.DType) *mlx.Array {
 }
 
 func (c *RecurrentCache) SetDeltaState(v *mlx.Array) {
-	c.deltaState = c.setStateDetached(c.deltaState, v, false)
+	c.deltaState = c.setState(c.deltaState, v, false)
 }
 
 func (c *RecurrentCache) Advance(n int) {
@@ -147,8 +135,8 @@ func (c *RecurrentCache) Restore(snapshot Snapshot, target int) bool {
 		return false
 	}
 
-	c.convState = c.setStateRaw(c.convState, snap.convState)
-	c.deltaState = c.setStateRaw(c.deltaState, snap.deltaState)
+	c.convState = c.setState(c.convState, snap.convState, false)
+	c.deltaState = c.setState(c.deltaState, snap.deltaState, false)
 	c.offset = snap.offset
 
 	return true
Repository: ollama/ollama
Pull request: mlx: fix KV cache snapshot memory leak

mlx.Copy shares the backing buffer with its source (via copy_shared_buffer) rather than allocating independent storage. When used to snapshot a slice of the KV cache, the snapshot array holds the entire original cache buffer alive through the shared data pointer — even after eval detaches the computation graph.

Replace Copy with Contiguous in Snapshot and Split. Contiguous allocates a compact buffer when the source buffer is significantly larger than the logical slice (Contiguous::eval checks buffer_size > nbytes + 16384), which is always the case for KV cache slices.

Changed files:
filename: x/mlxrunner/cache/cache.go
patch: @@ -109,8 +109,8 @@ func (c *KVCache) Snapshot(fromOffset int) Snapshot {
 
 	kSlice := c.keys.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(from, to), mlx.Slice())
 	vSlice := c.values.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(from, to), mlx.Slice())
-	kCopy := mlx.Copy(kSlice)
-	vCopy := mlx.Copy(vSlice)
+	kCopy := mlx.Contiguous(kSlice, false)
+	vCopy := mlx.Contiguous(vSlice, false)
 	mlx.Pin(kCopy, vCopy)
 	mlx.AsyncEval(kCopy, vCopy)
 
@@ -196,10 +196,10 @@ func (c *KVCache) Split(snapshot Snapshot, at int) (Snapshot, Snapshot) {
 		return snapshot, nil
 	}
 
-	pk := mlx.Copy(snap.keys.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(0, splitIdx), mlx.Slice()))
-	pv := mlx.Copy(snap.values.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(0, splitIdx), mlx.Slice()))
-	ck := mlx.Copy(snap.keys.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(splitIdx, seqLen), mlx.Slice()))
-	cv := mlx.Copy(snap.values.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(splitIdx, seqLen), mlx.Slice()))
+	pk := mlx.Contiguous(snap.keys.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(0, splitIdx), mlx.Slice()), false)
+	pv := mlx.Contiguous(snap.values.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(0, splitIdx), mlx.Slice()), false)
+	ck := mlx.Contiguous(snap.keys.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(splitIdx, seqLen), mlx.Slice()), false)
+	cv := mlx.Contiguous(snap.values.Slice(mlx.Slice(), mlx.Slice(), mlx.Slice(splitIdx, seqLen), mlx.Slice()), false)
 	mlx.Pin(pk, pv, ck, cv)
 	mlx.AsyncEval(pk, pv, ck, cv)
 

filename: x/mlxrunner/mlx/array.go
patch: @@ -262,9 +262,11 @@ func LogArrays() {
 		return arrays[i].NumBytes() > arrays[j].NumBytes()
 	})
 
+	var total int
 	for _, t := range arrays {
 		nb := t.NumBytes()
+		total += nb
 		logutil.Trace(fmt.Sprintf("tensor %-60s %5s %5s pinned=%d %v", t.name, t.DType(), PrettyBytes(nb), t.pinned, t.Dims()))
 	}
-	logutil.Trace(fmt.Sprintf("tensors total: %d, size: %s", len(arrays), PrettyBytes(ActiveMemory())))
+	logutil.Trace(fmt.Sprintf("tensors total: %d, size: %s, active: %s", len(arrays), PrettyBytes(total), PrettyBytes(ActiveMemory())))
 }

filename: x/mlxrunner/mlx/ops_extra.go
patch: @@ -494,15 +494,6 @@ func Collect(v any) []*Array {
 	return arrays
 }
 
-func Copy(a *Array) *Array {
-	if a == nil || !a.Valid() {
-		return a
-	}
-	out := New("COPY")
-	C.mlx_copy(&out.ctx, a.ctx, DefaultStream().ctx)
-	return out
-}
-
 func collect(v reflect.Value, arrays *[]*Array, seen map[uintptr]bool) {
 	if !v.IsValid() {
 		return
Repository: ollama/ollama
Pull request: ggml: force flash attention off for grok

By default, ollama supports FA for grok,  but llama.cpp [disables it](https://github.com/ollama/ollama/blob/4fda69809a3fecf73d0f71657ef50f8f7e8f43f7/llama/llama.cpp/src/llama-context.cpp#L2418).  If KV cache quantization has been set this causes the runner to crash.

Fixes: #15043

Changed files:
filename: fs/ggml/ggml.go
patch: @@ -874,7 +874,7 @@ func (f GGML) SupportsFlashAttention() bool {
 		return true
 	}
 
-	if slices.Contains([]string{"gemma2"}, arch) {
+	if slices.Contains([]string{"gemma2", "grok"}, arch) {
 		return false
 	}
Repository: huggingface/transformers
Pull request: skip 2 invalid test cases for voxtral_realtime model

@vasqu This PR skipped 2 invalid test cases:
```
tests/models/voxtral_realtime/test_modeling_voxtral_realtime.py::VoxtralRealtimeForConditionalGenerationModelTest::test_generate_with_quant_cache
tests/models/voxtral_realtime/test_modeling_voxtral_realtime.py::VoxtralRealtimeForConditionalGenerationModelTest::test_flash_attn_2_fp32_ln
```
pls help review, thx!

Changed files:
filename: tests/models/voxtral_realtime/test_modeling_voxtral_realtime.py
patch: @@ -231,6 +231,12 @@ def test_custom_4d_attention_mask(self):
     def test_flash_attn_2_from_config(self):
         pass
 
+    @unittest.skip(
+        reason="This test does not apply to VoxtralRealtime since input_features must be provided along input_ids"
+    )
+    def test_flash_attn_2_fp32_ln(self):
+        pass
+
     @unittest.skip(
         reason="This test does not apply to VoxtralRealtime since input_features must be provided along input_ids"
     )
@@ -291,6 +297,12 @@ def test_left_padding_compatibility(self):
     def test_multi_gpu_data_parallel_forward(self):
         pass
 
+    @unittest.skip(
+        reason="VoxtralRealtime only supports static and offloaded_static cache implementations, not quantized cache"
+    )
+    def test_generate_with_quant_cache(self):
+        pass
+
 
 @require_torch
 class VoxtralRealtimeForConditionalGenerationIntegrationTest(unittest.TestCase):
Repository: nodejs/node
Pull request: tools: unlock ngtcp2 version updates

It was pinned to 1.15.1 in https://github.com/nodejs/node/pull/59946 without explanation.


Changed files:
filename: tools/dep_updaters/update-ngtcp2.sh
patch: @@ -10,20 +10,19 @@ DEPS_DIR="$BASE_DIR/deps"
 # shellcheck disable=SC1091
 . "$BASE_DIR/tools/dep_updaters/utils.sh"
 
-NEW_VERSION="1.15.1"
-# NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
-# const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases',
-#   process.env.GITHUB_TOKEN && {
-#     headers: {
-#       "Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
-#     },
-#   });
-# if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
-# const releases = await res.json()
-# const { tag_name } = releases.at(0);
-# console.log(tag_name.replace('v', ''));
-# EOF
-# )"
+NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
+const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases',
+  process.env.GITHUB_TOKEN && {
+    headers: {
+      "Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
+    },
+  });
+if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
+const releases = await res.json()
+const { tag_name } = releases.at(0);
+console.log(tag_name.replace('v', ''));
+EOF
+)"
 
 NGTCP2_VERSION_H="$DEPS_DIR/ngtcp2/ngtcp2/lib/includes/ngtcp2/version.h"
Repository: rust-lang/rust
Pull request: add regression test for EII declaration conflicting with constructor

<!-- homu-ignore:start -->
<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r? <reviewer name>
-->
<!-- homu-ignore:end -->
fixs: rust-lang/rust#152893

add regression test

Changed files:
filename: tests/ui/eii/duplicate/eii-declaration-conflicts-with-constructor.rs
patch: @@ -1,11 +1,17 @@
 #![feature(extern_item_impls)]
 
 // Regression test for <https://github.com/rust-lang/rust/issues/153502>:
+// Regression test for <https://github.com/rust-lang/rust/issues/152893>:
 
 struct Foo(i32);
+struct Bar;
 
 #[eii]
 pub fn Foo(x: u64) {}
 //~^ ERROR the name `Foo` is defined multiple times
 
+#[eii]
+pub fn Bar(x: u64) {}
+//~^ ERROR the name `Bar` is defined multiple times
+
 fn main() {}

filename: tests/ui/eii/duplicate/eii-declaration-conflicts-with-constructor.stderr
patch: @@ -1,5 +1,5 @@
 error[E0428]: the name `Foo` is defined multiple times
-  --> $DIR/eii-declaration-conflicts-with-constructor.rs:8:1
+  --> $DIR/eii-declaration-conflicts-with-constructor.rs:10:1
    |
 LL | struct Foo(i32);
    | ---------------- previous definition of the value `Foo` here
@@ -9,6 +9,17 @@ LL | pub fn Foo(x: u64) {}
    |
    = note: `Foo` must be defined only once in the value namespace of this module
 
-error: aborting due to 1 previous error
+error[E0428]: the name `Bar` is defined multiple times
+  --> $DIR/eii-declaration-conflicts-with-constructor.rs:14:1
+   |
+LL | struct Bar;
+   | ----------- previous definition of the value `Bar` here
+...
+LL | pub fn Bar(x: u64) {}
+   | ^^^^^^^^^^^^^^^^^^ `Bar` redefined here
+   |
+   = note: `Bar` must be defined only once in the value namespace of this module
+
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0428`.
Repository: huggingface/transformers
Pull request: add use_deterministic to guarantee the consistency for youtu-llm model

@IlyasMoutawwakil Hi, can you help review? Thx!

Changed files:
filename: tests/models/youtu/test_modeling_youtu.py
patch: @@ -20,6 +20,7 @@
 from transformers import AutoTokenizer, is_torch_available
 from transformers.testing_utils import (
     cleanup,
+    require_deterministic_for_xpu,
     require_torch,
     require_torch_accelerator,
     slow,
@@ -93,6 +94,7 @@ class YoutuIntegrationTest(unittest.TestCase):
     def tearDown(self):
         cleanup(torch_device, gc_collect=False)
 
+    @require_deterministic_for_xpu
     @require_torch_accelerator
     def test_dynamic_cache(self):
         NUM_TOKENS_TO_GENERATE = 40
@@ -116,6 +118,7 @@ def test_dynamic_cache(self):
         dynamic_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
         self.assertEqual(EXPECTED_TEXT_COMPLETION, dynamic_text)
 
+    @require_deterministic_for_xpu
     @require_torch_accelerator
     def test_static_cache(self):
         NUM_TOKENS_TO_GENERATE = 40
@@ -141,6 +144,7 @@ def test_static_cache(self):
         static_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
         self.assertEqual(EXPECTED_TEXT_COMPLETION, static_text)
 
+    @require_deterministic_for_xpu
     @slow
     @require_torch_accelerator
     @pytest.mark.torch_compile_test
Repository: ollama/ollama
Pull request: ci: fix windows cgo compiler error

cmake calls generate, but without the env vars set, winds up trying to use an absolute compiler path with spaces and gets confused.

Changed files:
filename: .github/workflows/test.yaml
patch: @@ -64,6 +64,7 @@ jobs:
             container: nvidia/cuda:13.0.0-devel-ubuntu22.04
             extra-packages: libcudnn9-dev-cuda-13 libopenblas-dev liblapack-dev liblapacke-dev git curl
             flags: '-DCMAKE_CUDA_ARCHITECTURES=87 -DBLAS_INCLUDE_DIRS=/usr/include/x86_64-linux-gnu -DLAPACK_INCLUDE_DIRS=/usr/include/x86_64-linux-gnu'
+            install-go: true
     runs-on: linux
     container: ${{ matrix.container }}
     steps:
@@ -90,6 +91,12 @@ jobs:
           fi
         env:
           DEBIAN_FRONTEND: noninteractive
+      - if: matrix.install-go
+        name: Install Go
+        run: |
+          GO_VERSION=$(awk '/^go / { print $2 }' go.mod)
+          curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz" | tar xz -C /usr/local
+          echo "/usr/local/go/bin" >> $GITHUB_PATH
       - uses: actions/cache@v4
         with:
           path: /github/home/.cache/ccache

filename: x/imagegen/mlx/CMakeLists.txt
patch: @@ -101,12 +101,25 @@ file(COPY ${_mlx_c_hdrs} DESTINATION "${CMAKE_SOURCE_DIR}/x/mlxrunner/mlx/includ
 # Regenerate Go/C shim wrappers from the (possibly updated) headers.
 find_program(GO_EXECUTABLE go REQUIRED)
 message(STATUS "Regenerating MLX Go wrappers")
+
+# Go's cgo splits CC on whitespace, so a CC like "C:/Program Files/…/cl.exe"
+# (set by cmake on Windows) breaks with "C:/Program" not found.  Clear CC
+# when it contains spaces so cgo falls back to its default (gcc).
+if(WIN32 AND "$ENV{CC}" MATCHES " ")
+    set(_SAVE_CC "$ENV{CC}")
+    set(ENV{CC} "")
+endif()
+
 execute_process(
     COMMAND ${GO_EXECUTABLE} generate ./x/...
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
     COMMAND_ERROR_IS_FATAL ANY
 )
 
+if(DEFINED _SAVE_CC)
+    set(ENV{CC} "${_SAVE_CC}")
+endif()
+
 # For local dev builds, override MLX_VERSION with git describe output
 if(TARGET mlx_version AND DEFINED FETCHCONTENT_SOURCE_DIR_MLX)
     execute_process(
Repository: ollama/ollama
Pull request: mlxrunner: support partial match on pure transformer caches

Previously, a partial match within a node's edge would truncate the path to the parent snapshot - effectively making all cache types behave as recurrent caches. Caches with only transformer layers can rewind to arbitrary boundary so this restores this capability to improve cache hits

Changed files:
filename: x/mlxrunner/cache/recurrent.go
patch: @@ -22,14 +22,9 @@ func (c *RecurrentCache) setStateRaw(old, v *mlx.Array) *mlx.Array {
 	if v == nil || !v.Valid() {
 		return old
 	}
-	if old == v {
-		return old
-	}
 
 	mlx.Pin(v)
-	if old != nil && old != v {
-		mlx.Unpin(old)
-	}
+	mlx.Unpin(old)
 
 	return v
 }
@@ -38,9 +33,6 @@ func (c *RecurrentCache) setStateDetached(old, v *mlx.Array, ensureContiguous bo
 	if v == nil || !v.Valid() {
 		return old
 	}
-	if old == v {
-		return old
-	}
 
 	root := v
 	if ensureContiguous {
@@ -49,9 +41,7 @@ func (c *RecurrentCache) setStateDetached(old, v *mlx.Array, ensureContiguous bo
 	detached := root.Clone()
 
 	mlx.Pin(detached)
-	if old != nil && old != detached {
-		mlx.Unpin(old)
-	}
+	mlx.Unpin(old)
 
 	return detached
 }

filename: x/mlxrunner/mlx/array.go
patch: @@ -137,6 +137,9 @@ func Unpin(s ...*Array) {
 	for _, t := range s {
 		if t != nil {
 			t.pinned--
+			if t.pinned < 0 {
+				panic(fmt.Sprintf("mlx.Unpin: negative pin count on array %q", t.name))
+			}
 		}
 	}
 }
@@ -261,7 +264,7 @@ func LogArrays() {
 
 	for _, t := range arrays {
 		nb := t.NumBytes()
-		logutil.Trace(fmt.Sprintf("tensor %-60s %5s %5s %v", t.name, t.DType(), PrettyBytes(nb), t.Dims()))
+		logutil.Trace(fmt.Sprintf("tensor %-60s %5s %5s pinned=%d %v", t.name, t.DType(), PrettyBytes(nb), t.pinned, t.Dims()))
 	}
 	logutil.Trace(fmt.Sprintf("tensors total: %d, size: %s", len(arrays), PrettyBytes(ActiveMemory())))
 }
Repository: vercel/next.js
Pull request: Skip CI for agent/editor config directory changes

## Summary
- Add `.agents`, `.claude`, and `.cursor` to the `docs` group in `CHANGE_ITEM_GROUPS` in `scripts/run-for-change.mjs`
- Changes to these directories (agent skill definitions, editor configs) don't affect Next.js build/runtime/tests, so CI should skip for them — same as docs-only changes
- Both `build_and_deploy.yml` and `build_and_test.yml` already use `run-for-change.mjs --not --type docs` to detect non-docs changes; this extends that behavior to agent/editor config files

Changed files:
filename: scripts/run-for-change.mjs
patch: @@ -7,6 +7,9 @@ const exec = promisify(execOrig)
 
 const CHANGE_ITEM_GROUPS = {
   docs: [
+    '.agents',
+    '.claude',
+    '.cursor',
     'bench',
     'docs',
     'apps/docs',