@halcyonlabs/app 0.47.0-halcyon.428 → 0.47.0-halcyon.429

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halcyonlabs/app",
3
- "version": "0.47.0-halcyon.428",
3
+ "version": "0.47.0-halcyon.429",
4
4
  "description": "bb app launcher for npx",
5
5
  "keywords": [
6
6
  "bb",
@@ -105,7 +105,7 @@
105
105
  "node": "^22.19.0 || ^24.0.0 || ^26.0.0"
106
106
  },
107
107
  "moonletRelease": {
108
- "summary": "fix(orbit): bound dispatch wait reasons (#449)"
108
+ "summary": "Retry scheduler reads across atomic receipt replacement (#451)"
109
109
  },
110
110
  "license": "SEE LICENSE IN LICENSE"
111
111
  }
@@ -1,12 +1,12 @@
1
1
  {
2
- "commit": "80db8ae3018d0be4911704d423c1354c01b60f8f",
2
+ "commit": "acfe0cf8d2997b37824fea8912c232ccfe2c5312",
3
3
  "file": "orbit-deploy",
4
4
  "platform": "linux-x64",
5
5
  "provenance": {
6
- "artifactId": 14497652097,
7
- "artifactName": "linux-bundle-80db8ae3018d0be4911704d423c1354c01b60f8f",
6
+ "artifactId": 14500472215,
7
+ "artifactName": "linux-bundle-acfe0cf8d2997b37824fea8912c232ccfe2c5312",
8
8
  "repository": "matt0x6F/personalassistant",
9
- "runId": 44452824557,
9
+ "runId": 44458829966,
10
10
  "workflow": ".github/workflows/moonlet-linux-bundle.yml"
11
11
  },
12
12
  "schema": 1,
@@ -1 +1 @@
1
- 80db8ae3018d0be4911704d423c1354c01b60f8f
1
+ acfe0cf8d2997b37824fea8912c232ccfe2c5312
@@ -1078,18 +1078,38 @@ def directory(parent, name):
1078
1078
  raise
1079
1079
  return fd
1080
1080
 
1081
+ def read_text(path, parent, limit, reason, persist=False):
1082
+ for attempt in range(8):
1083
+ try:
1084
+ fd = os.open(path, (os.O_RDWR if persist else os.O_RDONLY) | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=parent)
1085
+ except FileNotFoundError:
1086
+ if attempt:
1087
+ raise RuntimeError("The saved check data disappeared while being read")
1088
+ return None
1089
+ with os.fdopen(fd) as source:
1090
+ info = os.fstat(source.fileno())
1091
+ if not stat.S_ISREG(info.st_mode) or info.st_uid != os.getuid() or info.st_size > limit:
1092
+ raise RuntimeError(reason)
1093
+ if info.st_nlink == 0:
1094
+ replacement = os.stat(path, dir_fd=parent, follow_symlinks=False)
1095
+ if (replacement.st_dev, replacement.st_ino) == (info.st_dev, info.st_ino):
1096
+ raise RuntimeError(reason)
1097
+ continue
1098
+ if info.st_nlink != 1:
1099
+ raise RuntimeError(reason)
1100
+ value = source.read(limit + 1)
1101
+ if len(value.encode("utf-8")) > limit:
1102
+ raise RuntimeError(reason)
1103
+ if persist:
1104
+ os.fsync(source.fileno())
1105
+ return value
1106
+ raise RuntimeError("The saved check data kept changing while being read")
1107
+
1081
1108
  def read(path, persist=False):
1082
- try:
1083
- fd = os.open(path, (os.O_RDWR if persist else os.O_RDONLY) | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=receipts)
1084
- except FileNotFoundError:
1109
+ text = read_text(path, receipts, 12_100_000, "Invalid saved check result", persist)
1110
+ if text is None:
1085
1111
  return None
1086
- with os.fdopen(fd) as source:
1087
- info = os.fstat(source.fileno())
1088
- if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1 or info.st_uid != os.getuid() or info.st_size > 12_100_000:
1089
- raise RuntimeError("Invalid saved check result")
1090
- value = json.load(source)
1091
- if persist:
1092
- os.fsync(source.fileno())
1112
+ value = json.loads(text)
1093
1113
  if value.get("execution") != sys.argv[4] or value.get("state") not in ("running", "finished") or type(value.get("code")) is not int or not isinstance(value.get("output"), str) or len(value["output"]) > 4000:
1094
1114
  raise RuntimeError("Invalid saved check result")
1095
1115
  if value.get("events") is not None and (not isinstance(value["events"], str) or len(value["events"].encode("utf-8")) > 2_000_000):
@@ -1097,15 +1117,7 @@ def read(path, persist=False):
1097
1117
  return value
1098
1118
 
1099
1119
  def inbox_events():
1100
- try:
1101
- fd = os.open("inbox-events.jsonl", os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=state)
1102
- except FileNotFoundError:
1103
- return None
1104
- with os.fdopen(fd) as events:
1105
- info = os.fstat(events.fileno())
1106
- if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1 or info.st_size > 2_000_000 or info.st_uid != os.getuid():
1107
- raise RuntimeError("Inbox events exceed the saved-result limit")
1108
- return events.read(2_000_000)
1120
+ return read_text("inbox-events.jsonl", state, 2_000_000, "Inbox events exceed the saved-result limit")
1109
1121
 
1110
1122
  def acknowledge_inbox(saved):
1111
1123
  fd = os.open("inbox-check.json.lock", os.O_WRONLY | os.O_APPEND | os.O_CREAT | os.O_NOFOLLOW | os.O_NONBLOCK, 0o600, dir_fd=state)