openclaw/src/shared
Vincent Koc 5a2200b280
fix(sessions): harden recycled PID lock recovery follow-up (#31320)
* fix: detect PID recycling in session write lock staleness check

The session lock uses isPidAlive() to determine if a lock holder is
still running. In containers, PID recycling can cause a different
process to inherit the same PID, making the lock appear valid when
the original holder is dead.

Record the process start time (field 22 of /proc/pid/stat) in the
lock file and compare it during staleness checks. If the PID is alive
but its start time differs from the recorded value, the lock is
treated as stale and reclaimed immediately.

Backward compatible: lock files without starttime are handled with
the existing PID-alive + age-based logic. Non-Linux platforms skip
the starttime check entirely (getProcessStartTime returns null).

* shared: harden pid starttime parsing

* sessions: validate lock pid/starttime payloads

* changelog: note recycled PID lock recovery fix

* changelog: credit hiroki and vincent on lock recovery fix

---------

Co-authored-by: HirokiKobayashi-R <hiroki@rhems-japan.co.jp>
2026-03-01 21:42:22 -08:00
..
net fix(ssrf): unify ipv6 special-use blocking 2026-02-26 03:43:42 +01:00
text Web UI: strip relevant-memories scaffolding 2026-02-28 13:20:50 -08:00
avatar-policy.test.ts fix(security): harden avatar validation and size limits 2026-02-22 08:35:32 +01:00
avatar-policy.ts fix(security): harden avatar validation and size limits 2026-02-22 08:35:32 +01:00
chat-content.ts refactor(shared): reuse chat content extractor for assistant text 2026-02-17 00:53:44 +00:00
chat-envelope.ts fix(tui): strip inbound metadata blocks from user messages (clean rewrite) (#22345) 2026-02-20 23:52:43 -05:00
config-eval.test.ts refactor(agents): dedupe config and truncation guards 2026-02-22 17:54:51 +00:00
config-eval.ts refactor(agents): dedupe config and truncation guards 2026-02-22 17:54:51 +00:00
device-auth.ts refactor(device-auth): share store types + normalization 2026-02-15 04:22:44 +00:00
entry-metadata.ts refactor(status): share emoji/homepage resolver 2026-02-15 13:01:39 +00:00
entry-status.ts refactor: extract shared dedupe helpers for runtime paths 2026-02-23 05:43:43 +00:00
frontmatter.ts refactor(core): dedupe shared config and runtime helpers 2026-02-16 14:59:30 +00:00
gateway-bind-url.ts refactor: de-duplicate channel runtime and payload helpers 2026-02-23 21:25:28 +00:00
model-param-b.ts refactor(models): share param-B inference 2026-02-15 05:12:49 +00:00
node-list-parse.test.ts refactor(shared): reuse node list parsers across cli and tools 2026-02-18 23:34:15 +00:00
node-list-parse.ts refactor(shared): reuse node list parsers across cli and tools 2026-02-18 23:34:15 +00:00
node-list-types.ts refactor: extract shared install and embedding utilities 2026-02-18 04:49:22 +00:00
node-match.ts iOS/Gateway: harden pairing resolution and settings-driven capability refresh (#22120) 2026-02-20 18:57:04 +00:00
operator-scope-compat.test.ts Gateway: allow operator admin scope for pairing and approvals 2026-02-21 19:37:04 -08:00
operator-scope-compat.ts Gateway: allow operator admin scope for pairing and approvals 2026-02-21 19:37:04 -08:00
pid-alive.test.ts fix(sessions): harden recycled PID lock recovery follow-up (#31320) 2026-03-01 21:42:22 -08:00
pid-alive.ts fix(sessions): harden recycled PID lock recovery follow-up (#31320) 2026-03-01 21:42:22 -08:00
process-scoped-map.ts refactor: dedupe process-scoped lock maps 2026-02-17 00:45:02 +00:00
requirements.test.ts fix: redact config values in skills status 2026-02-14 17:35:16 +01:00
requirements.ts refactor(shared): reuse requirement remote context type 2026-02-18 17:48:02 +00:00
shared-misc.test.ts iOS/Gateway: harden pairing resolution and settings-driven capability refresh (#22120) 2026-02-20 18:57:04 +00:00
string-normalization.test.ts refactor(shared): centralize @/# slug normalization 2026-02-18 23:34:15 +00:00
string-normalization.ts refactor(shared): centralize @/# slug normalization 2026-02-18 23:34:15 +00:00
subagents-format.ts refactor(subagents): share token usage formatting 2026-02-15 07:06:54 +00:00
tailscale-status.ts refactor: de-duplicate channel runtime and payload helpers 2026-02-23 21:25:28 +00:00
text-chunking.ts refactor(shared): reuse outbound text chunking core 2026-02-19 07:01:54 +00:00
usage-aggregates.ts refactor: dedupe shared helpers across ui/gateway/extensions 2026-02-15 03:34:14 +00:00