helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: tui: fix signin on headless Linux systems

Defensively handle environments without a display server to ensure signin remains usable on headless VMs and SSH sessions.

- Skip calling xdg-open when neither DISPLAY nor WAYLAND_DISPLAY is set, preventing silent failures or unexpected browser handlers
- Render the signin URL as plain text instead of wrapping it in OSC 8 hyperlink escape sequences, which can be garbled or hidden by terminals that don't support them

Changed files:
filename: cmd/launch/models.go
patch: @@ -92,6 +92,10 @@ func OpenBrowser(url string) {
 	case "darwin":
 		_ = exec.Command("open", url).Start()
 	case "linux":
+		// Skip on headless systems where no display server is available
+		if os.Getenv("DISPLAY") == "" && os.Getenv("WAYLAND_DISPLAY") == "" {
+			return
+		}
 		_ = exec.Command("xdg-open", url).Start()
 	case "windows":
 		_ = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()

filename: cmd/tui/signin.go
patch: @@ -97,11 +97,8 @@ func renderSignIn(modelName, signInURL string, spinner, width int) string {
 
 	fmt.Fprintf(&s, "To use %s, please sign in.\n\n", selectorSelectedItemStyle.Render(modelName))
 
-	// Wrap in OSC 8 hyperlink so the entire URL is clickable even when wrapped.
-	// Padding is outside the hyperlink so spaces don't get underlined.
-	link := fmt.Sprintf("\033]8;;%s\033\\%s\033]8;;\033\\", signInURL, urlColor.Render(signInURL))
 	s.WriteString("Navigate to:\n")
-	s.WriteString(urlWrap.Render(link))
+	s.WriteString(urlWrap.Render(urlColor.Render(signInURL)))
 	s.WriteString("\n\n")
 
 	s.WriteString(lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "242", Dark: "246"}).Render(

filename: cmd/tui/signin_test.go
patch: @@ -25,22 +25,6 @@ func TestRenderSignIn_ContainsURL(t *testing.T) {
 	}
 }
 
-func TestRenderSignIn_OSC8Hyperlink(t *testing.T) {
-	url := "https://ollama.com/connect?key=abc123"
-	got := renderSignIn("test:cloud", url, 0, 120)
-
-	// Should contain OSC 8 open sequence with the URL
-	osc8Open := "\033]8;;" + url + "\033\\"
-	if !strings.Contains(got, osc8Open) {
-		t.Error("should contain OSC 8 open sequence with URL")
-	}
-
-	// Should contain OSC 8 close sequence
-	osc8Close := "\033]8;;\033\\"
-	if !strings.Contains(got, osc8Close) {
-		t.Error("should contain OSC 8 close sequence")
-	}
-}
 
 func TestRenderSignIn_ContainsSpinner(t *testing.T) {
 	got := renderSignIn("test:cloud", "https://example.com", 0, 80)
Repository: electron/electron
Pull request: fix: validate `dock_state_ `against allowlist before JS execution

Backport of #50646

See that PR for details.


Notes: none

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -12,6 +12,7 @@
 #include <utility>
 
 #include "base/base64.h"
+#include "base/containers/fixed_flat_set.h"
 #include "base/containers/span.h"
 #include "base/memory/raw_ptr.h"
 #include "base/metrics/histogram.h"
@@ -158,6 +159,13 @@ void OnOpenItemComplete(const base::FilePath& path, const std::string& result) {
 constexpr base::TimeDelta kInitialBackoffDelay = base::Milliseconds(250);
 constexpr base::TimeDelta kMaxBackoffDelay = base::Seconds(10);
 
+constexpr auto kValidDockStates = base::MakeFixedFlatSet<std::string_view>(
+    {"bottom", "left", "right", "undocked"});
+
+bool IsValidDockState(const std::string& state) {
+  return kValidDockStates.contains(state);
+}
+
 }  // namespace
 
 class InspectableWebContents::NetworkResourceLoader
@@ -392,7 +400,7 @@ void InspectableWebContents::SetDockState(const std::string& state) {
     can_dock_ = false;
   } else {
     can_dock_ = true;
-    dock_state_ = state;
+    dock_state_ = IsValidDockState(state) ? state : "right";
   }
 }
 
@@ -557,7 +565,13 @@ void InspectableWebContents::LoadCompleted() {
           pref_service_->GetDict(kDevToolsPreferences);
       const std::string* current_dock_state =
           prefs.FindString("currentDockState");
-      base::RemoveChars(*current_dock_state, "\"", &dock_state_);
+      if (current_dock_state) {
+        std::string sanitized;
+        base::RemoveChars(*current_dock_state, "\"", &sanitized);
+        dock_state_ = IsValidDockState(sanitized) ? sanitized : "right";
+      } else {
+        dock_state_ = "right";
+      }
     }
 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
     auto* api_web_contents = api::WebContents::From(GetWebContents());
Repository: ollama/ollama
Pull request: launch: disable claude attribution header to preserve KV cache

Claude Code sends an x-anthropic-billing-header that changes on every request. This is embedded in the system prompt and consequently breaks the KV cache for every request. Given the size of the prompts that Claude Code usees, this has significant performance impact.

Changed files:
filename: cmd/launch/claude.go
patch: @@ -59,6 +59,7 @@ func (c *Claude) Run(model string, args []string) error {
 		"ANTHROPIC_BASE_URL="+envconfig.Host().String(),
 		"ANTHROPIC_API_KEY=",
 		"ANTHROPIC_AUTH_TOKEN=ollama",
+		"CLAUDE_CODE_ATTRIBUTION_HEADER=0",
 	)
 
 	env = append(env, c.modelEnvVars(model)...)
Repository: ollama/ollama
Pull request: cmd/launch: check for both npm and git before installing OpenClaw

The OpenClaw installer requires git in addition to npm. Update the dependency check to detect both and provide specific install guidance for whichever dependencies are missing.

```bash
❯ ./ollama launch openclaw
Error: launching openclaw: openclaw is not installed and required dependencies are missing

Install the following first:
  npm (Node.js): https://nodejs.org/
  git: https://git-scm.com/
```

Changed files:
filename: cmd/launch/launch_test.go
patch: @@ -951,7 +951,7 @@ func TestLaunchIntegration_OpenclawInstallsBeforeConfigSideEffects(t *testing.T)
 	if err == nil {
 		t.Fatal("expected launch to fail before configuration when OpenClaw is missing")
 	}
-	if !strings.Contains(err.Error(), "npm was not found") {
+	if !strings.Contains(err.Error(), "required dependencies are missing") {
 		t.Fatalf("expected install prerequisite error, got %v", err)
 	}
 	if selectorCalled {

filename: cmd/launch/openclaw.go
patch: @@ -429,13 +429,17 @@ func ensureOpenclawInstalled() (string, error) {
 		return "clawdbot", nil
 	}
 
-	if _, err := exec.LookPath("npm"); err != nil {
-		return "", fmt.Errorf("openclaw is not installed and npm was not found\n\n" +
-			"Install Node.js first:\n" +
-			"  https://nodejs.org/\n\n" +
-			"Then rerun:\n" +
-			"  ollama launch\n" +
-			"and select OpenClaw")
+	_, npmErr := exec.LookPath("npm")
+	_, gitErr := exec.LookPath("git")
+	if npmErr != nil || gitErr != nil {
+		var missing []string
+		if npmErr != nil {
+			missing = append(missing, "npm (Node.js): https://nodejs.org/")
+		}
+		if gitErr != nil {
+			missing = append(missing, "git: https://git-scm.com/")
+		}
+		return "", fmt.Errorf("openclaw is not installed and required dependencies are missing\n\nInstall the following first:\n  %s", strings.Join(missing, "\n  "))
 	}
 
 	ok, err := ConfirmPrompt("OpenClaw is not installed. Install with npm?")
Repository: vercel/next.js
Pull request: Allow multi-level .localhost subdomains in dev origin check

## Summary

The built-in dev origin allowlist uses `*.localhost`, but `*` only matches a single subdomain level. Multi-level `.localhost` subdomains like `sub.app.localhost` are blocked even though all `.localhost` domains resolve to loopback per RFC 6761.

This changes `*.localhost` to `**.localhost` so any depth of `.localhost` subdomain is auto-allowed. The `**` glob is already supported by `matchWildcardDomain` in `csrf-protection.ts`.

- `**.localhost` matches `app.localhost` (single level, same as before)
- `**.localhost` matches `sub.app.localhost` (multi-level, previously blocked)
- Bare `localhost` is already separately in the allowlist, unaffected

Changed files:
filename: packages/next/src/server/lib/router-utils/block-cross-site-dev.ts
patch: @@ -119,7 +119,7 @@ export const blockCrossSiteDEV = (
   hostname: string | undefined
 ): boolean => {
   const allowedOrigins = [
-    '*.localhost',
+    '**.localhost',
     'localhost',
     ...(allowedDevOrigins ?? []),
   ]

filename: test/development/basic/allowed-dev-origins.test.ts
patch: @@ -248,6 +248,14 @@ describe.each(['', '/docs'])(
         })
       })
 
+      it('should allow requests from multi-level localhost subdomains', async () => {
+        const res = await requestInternalDevMiddleware(
+          next.appPort,
+          basePath,
+          'https://sub.app.localhost'
+        )
+        expect(res.status).not.toBe(403)
+      })
       it('should allow same-site requests without an origin header', async () => {
         const res = await fetchViaHTTP(
           next.appPort,
Repository: rust-lang/rust
Pull request: fix compilation of time/hermit.rs

https://github.com/rust-lang/rust/pull/154518 has broken compiling std for Hermit by unwrapping an `i32`.

This PR converts the `i32` to an `io::Result` before unwrapping.

Closes https://github.com/rust-lang/rust/issues/154626.
Closes https://github.com/hermit-os/hermit-rs/issues/965.

r? @Mark-Simulacrum

Changed files:
filename: library/std/src/sys/time/hermit.rs
patch: @@ -1,12 +1,13 @@
 use hermit_abi::{self, CLOCK_MONOTONIC, CLOCK_REALTIME};
 
 use crate::io;
+use crate::sys::cvt;
 use crate::sys::pal::time::Timespec;
 use crate::time::Duration;
 
 fn clock_gettime(clock: hermit_abi::clockid_t) -> Timespec {
     let mut t = hermit_abi::timespec { tv_sec: 0, tv_nsec: 0 };
-    unsafe { hermit_abi::clock_gettime(clock, &raw mut t) }.unwrap();
+    cvt(unsafe { hermit_abi::clock_gettime(clock, &raw mut t) }).unwrap();
     Timespec::new(t.tv_sec, t.tv_nsec.into()).unwrap()
 }
Repository: electron/electron
Pull request: fix: don't force kFitToPrintableArea scaling when custom margins are set

#### Description of Change

Fixes https://github.com/electron/electron/issues/50481

When silent printing with non-default margins (custom, no margins, or printable area margins), the kFitToPrintableArea scaling option causes double-marginalization: the custom margins define the content area, then the scaling additionally fits content to the printer's printable area.

Only apply kFitToPrintableArea when using default margins in silent mode. For non-default margins, use the same scaling as non-silent prints.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included
- [x] I have built and tested this PR
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: Fixed an issue where margins did not look as expected when printing in silent mode.

Changed files:
filename: patches/chromium/printing.patch
patch: @@ -703,7 +703,7 @@ index ac2f719be566020d9f41364560c12e6d6d0fe3d8..16d758a6936f66148a196761cfb875f6
    PrintingFailed(int32 cookie, PrintFailureReason reason);
  
 diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
-index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..1320f3b10b07b2cee90f39f406604176c7575796 100644
+index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..dd83b6cfb6e3f916e60f50402014cd931a4d8850 100644
 --- a/components/printing/renderer/print_render_frame_helper.cc
 +++ b/components/printing/renderer/print_render_frame_helper.cc
 @@ -54,6 +54,7 @@
@@ -827,7 +827,7 @@ index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..1320f3b10b07b2cee90f39f406604176
      // Check if `this` is still valid.
      if (!self)
        return;
-@@ -2394,29 +2415,43 @@ void PrintRenderFrameHelper::IPCProcessed() {
+@@ -2394,29 +2415,47 @@ void PrintRenderFrameHelper::IPCProcessed() {
  }
  
  bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame,
@@ -863,8 +863,12 @@ index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..1320f3b10b07b2cee90f39f406604176
 -                      : mojom::PrintScalingOption::kSourceSize;
 -  RecordDebugEvent(settings.params->printed_doc_type ==
 +  bool silent = new_settings.FindBool("silent").value_or(false);
-+  if (silent) {
-+    settings->params->print_scaling_option = mojom::PrintScalingOption::kFitToPrintableArea;
++  int margins_type = new_settings.FindInt(kSettingMarginsType)
++      .value_or(static_cast<int>(mojom::MarginType::kDefaultMargins));
++  if (silent &&
++      margins_type == static_cast<int>(mojom::MarginType::kDefaultMargins)) {
++    settings->params->print_scaling_option =
++        mojom::PrintScalingOption::kFitToPrintableArea;
 +  } else {
 +    settings->params->print_scaling_option =
 +        center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
Repository: facebook/react
Pull request: Add support for event information in React scheduler tracks in React Native

## Summary

This defines the same fiber configuration for RN as used in DOM, so we can expose event timing information in the React scheduler tracks in performance traces.

This was unblocked by #35913 and #35912.

## How did you test this change?

Manually compiled the renderer and tested e2e in FB infra: 
<img width="1217" height="161" alt="Screenshot 2026-03-03 at 10 10 44" src="https://github.com/user-attachments/assets/6ca1512e-dcaf-49cf-8da9-1c6ae554733a" />


Changed files:
filename: packages/react-native-renderer/src/ReactFiberConfigFabric.js
patch: @@ -422,14 +422,48 @@ export function resolveUpdatePriority(): EventPriority {
   return DefaultEventPriority;
 }
 
-export function trackSchedulerEvent(): void {}
+let schedulerEvent: void | Event = undefined;
+export function trackSchedulerEvent(): void {
+  schedulerEvent = global.event;
+}
+
+function getEventType(event: Event): null | string {
+  if (event.type) {
+    return event.type;
+  }
+
+  // Legacy implementation. RN does not define the `type` property on the event object yet.
+  // $FlowExpectedError[prop-missing]
+  const dispatchConfig = event.dispatchConfig;
+  if (
+    dispatchConfig == null ||
+    dispatchConfig.phasedRegistrationNames == null
+  ) {
+    return null;
+  }
+
+  const rawEventType =
+    dispatchConfig.phasedRegistrationNames.bubbled ||
+    dispatchConfig.phasedRegistrationNames.captured;
+  if (!rawEventType) {
+    return null;
+  }
+
+  if (rawEventType.startsWith('on')) {
+    return rawEventType.slice(2).toLowerCase();
+  }
+
+  return rawEventType.toLowerCase();
+}
 
 export function resolveEventType(): null | string {
-  return null;
+  const event = global.event;
+  return event && event !== schedulerEvent ? getEventType(event) : null;
 }
 
 export function resolveEventTimeStamp(): number {
-  return -1.1;
+  const event = global.event;
+  return event && event !== schedulerEvent ? event.timeStamp : -1.1;
 }
 
 export function shouldAttemptEagerTransition(): boolean {
Repository: electron/electron
Pull request: fix: don't force kFitToPrintableArea scaling when custom margins are set

Backport of #50615

See that PR for details.


Notes: Fixed an issue where margins did not look as expected when printing in silent mode.

Changed files:
filename: patches/chromium/printing.patch
patch: @@ -703,7 +703,7 @@ index ac2f719be566020d9f41364560c12e6d6d0fe3d8..16d758a6936f66148a196761cfb875f6
    PrintingFailed(int32 cookie, PrintFailureReason reason);
  
 diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
-index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..1320f3b10b07b2cee90f39f406604176c7575796 100644
+index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..dd83b6cfb6e3f916e60f50402014cd931a4d8850 100644
 --- a/components/printing/renderer/print_render_frame_helper.cc
 +++ b/components/printing/renderer/print_render_frame_helper.cc
 @@ -54,6 +54,7 @@
@@ -827,7 +827,7 @@ index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..1320f3b10b07b2cee90f39f406604176
      // Check if `this` is still valid.
      if (!self)
        return;
-@@ -2394,29 +2415,43 @@ void PrintRenderFrameHelper::IPCProcessed() {
+@@ -2394,29 +2415,47 @@ void PrintRenderFrameHelper::IPCProcessed() {
  }
  
  bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame,
@@ -863,8 +863,12 @@ index 60b5e83a8bc1ed07970be4cdfdc19962698bd754..1320f3b10b07b2cee90f39f406604176
 -                      : mojom::PrintScalingOption::kSourceSize;
 -  RecordDebugEvent(settings.params->printed_doc_type ==
 +  bool silent = new_settings.FindBool("silent").value_or(false);
-+  if (silent) {
-+    settings->params->print_scaling_option = mojom::PrintScalingOption::kFitToPrintableArea;
++  int margins_type = new_settings.FindInt(kSettingMarginsType)
++      .value_or(static_cast<int>(mojom::MarginType::kDefaultMargins));
++  if (silent &&
++      margins_type == static_cast<int>(mojom::MarginType::kDefaultMargins)) {
++    settings->params->print_scaling_option =
++        mojom::PrintScalingOption::kFitToPrintableArea;
 +  } else {
 +    settings->params->print_scaling_option =
 +        center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
Repository: facebook/react
Pull request: [DevTools] Add jest-cli `--reactVersion` argument

Add `--reactVersion` argument. This argument is only used in DevTools. When this is specified, run only the tests that have the `// @reactVersion` pragma that satisfies the semver version range. Otherwise, run tests as normal

Changed files:
filename: scripts/jest/jest-cli.js
patch: @@ -5,6 +5,7 @@ const chalk = require('chalk');
 const yargs = require('yargs');
 const fs = require('fs');
 const path = require('path');
+const semver = require('semver');
 
 const ossConfig = './scripts/jest/config.source.js';
 const wwwConfig = './scripts/jest/config.source-www.js';
@@ -104,6 +105,11 @@ const argv = yargs
       type: 'boolean',
       default: false,
     },
+    reactVersion: {
+      describe: 'DevTools testing for specific version of React',
+      requiresArg: true,
+      type: 'string',
+    },
   }).argv;
 
 function logError(message) {
@@ -166,11 +172,20 @@ function validateOptions() {
       logError('DevTool tests require --build.');
       success = false;
     }
+
+    if (argv.reactVersion && !semver.validRange(argv.reactVersion)) {
+      success = false;
+      logError('please specify a valid version range for --reactVersion');
+    }
   } else {
     if (argv.compactConsole) {
       logError('Only DevTool tests support compactConsole flag.');
       success = false;
     }
+    if (argv.reactVersion) {
+      logError('Only DevTools tests supports the --reactVersion flag.');
+      success = false;
+    }
   }
 
   if (isWWWConfig()) {
@@ -314,6 +329,10 @@ function getEnvars() {
     envars.VARIANT = true;
   }
 
+  if (argv.reactVersion) {
+    envars.REACT_VERSION = semver.coerce(argv.reactVersion);
+  }
+
   return envars;
 }
Repository: ollama/ollama
Pull request: runner: fix swallowed error in allocModel graph reservation

## Summary

Fixes #14839

`allocModel()` silently discards the error from the first `reserveWorstCaseGraph(true)` call by returning `nil` instead of `err`. This means a failed prompt graph reservation goes unnoticed — the model appears to load successfully but may behave unexpectedly during inference.

**Before (bug):**
```go
err = s.reserveWorstCaseGraph(true)
if err != nil {
    return nil  // error swallowed
}
```

**After (fix):**
```go
err = s.reserveWorstCaseGraph(true)
if err != nil {
    return err  // error properly propagated
}
```

The second call `reserveWorstCaseGraph(false)` already returns its error correctly, so this was likely a typo.

## Test plan

- [x] Verified the fix is a single-character change (`nil` -> `err`) with no side effects
- [ ] Existing tests continue to pass (the change only affects the error path)
- [ ] Under memory pressure, `allocModel` now correctly reports failure instead of silently proceeding

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Changed files:
filename: runner/ollamarunner/runner.go
patch: @@ -1231,7 +1231,7 @@ func (s *Server) allocModel(
 
 	err = s.reserveWorstCaseGraph(true)
 	if err != nil {
-		return nil
+		return err
 	}
 
 	return s.reserveWorstCaseGraph(false)
Repository: ollama/ollama
Pull request: cmd/launch: skip --install-daemon when systemd is unavailable

In container environments without systemd, `openclaw onboard --install-daemon` exits non-zero because it cannot create a systemd user service. This causes `ollama launch openclaw` to abort even though the gateway can be started as a foreground child process.

Only pass --install-daemon when systemd user services are reachable (Linux with /run/systemd/system present and XDG_RUNTIME_DIR set). On all other platforms the flag is still included by default.

Changed files:
filename: cmd/launch/openclaw.go
patch: @@ -66,16 +66,20 @@ func (c *Openclaw) Run(model string, args []string) error {
 		fmt.Fprintf(os.Stderr, "\n%sSetting up OpenClaw with Ollama...%s\n", ansiGreen, ansiReset)
 		fmt.Fprintf(os.Stderr, "%s  Model: %s%s\n\n", ansiGray, model, ansiReset)
 
-		cmd := exec.Command(bin, "onboard",
+		onboardArgs := []string{
+			"onboard",
 			"--non-interactive",
 			"--accept-risk",
 			"--auth-choice", "ollama",
 			"--custom-base-url", envconfig.Host().String(),
 			"--custom-model-id", model,
-			"--install-daemon",
 			"--skip-channels",
 			"--skip-skills",
-		)
+		}
+		if canInstallDaemon() {
+			onboardArgs = append(onboardArgs, "--install-daemon")
+		}
+		cmd := exec.Command(bin, onboardArgs...)
 		cmd.Stdin = os.Stdin
 		cmd.Stdout = os.Stdout
 		cmd.Stderr = os.Stderr
@@ -398,6 +402,25 @@ func patchScopes(obj map[string]any, key string, required []string) bool {
 	return added
 }
 
+// canInstallDaemon reports whether the openclaw daemon can be installed as a
+// background service. Returns false on Linux when systemd is absent (e.g.
+// containers) so that --install-daemon is omitted and the gateway is started
+// as a foreground child process instead. Returns true in all other cases.
+func canInstallDaemon() bool {
+	if runtime.GOOS != "linux" {
+		return true
+	}
+	// /run/systemd/system exists as a directory when systemd is the init system.
+	// This is absent in most containers.
+	fi, err := os.Stat("/run/systemd/system")
+	if err != nil || !fi.IsDir() {
+		return false
+	}
+	// Even when systemd is the init system, user services require a user
+	// manager instance. XDG_RUNTIME_DIR being set is a prerequisite.
+	return os.Getenv("XDG_RUNTIME_DIR") != ""
+}
+
 func ensureOpenclawInstalled() (string, error) {
 	if _, err := exec.LookPath("openclaw"); err == nil {
 		return "openclaw", nil