Skip to content

fix(process): settle native exit and repair ownership verification - #5249

Merged
gensokyo-dev merged 28 commits into
mainfrom
audit/ci-tests-20261019-round2
Oct 19, 2026
Merged

gensokyo-dev merged 28 commits into
mainfrom
audit/ci-tests-20261019-round2

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Cleanup could reject an already exiting Linux child because its environment became unreadable or ps changed its command display before state Z. Separately, a provisional baseline identity failure could override fresh ownership facts, and the recorded-crash oracle did not consistently distinguish native ownership inventory from historical-PID access.

  • Parse native lifecycle once, including Linux PF_EXITING, terminal Z/X/x and unknown flags. Share lifecycle interpretation across ownership observation, signaling validation and retained Evidence. Exit-in-progress alone never proves cleanup: refresh only those PIDs within the existing one-second verification window, stop on unavailable/reused identity, preserve caller cancellation, and retain unresolved ownership. Initial identity/token/relation evidence stays attributable; no global table rescan per poll.
  • Let current identity/token facts settle baseline candidates. Keep unknown/current ownership fail-closed. Make the Jadx workspace fault fixture target its own workspace and enforce the cleanup stages with strict assertions.
  • Give recorded-crash trace facts one owner: exact Node/ps execution and CLONE_THREAD attribution, PID syscall selection/interpretation and explicit coverage. Require both CLI/MCP controls to decode the chosen PID, including an unassignable-PID control. Preserve main's portable schema, selective UID, native clock, setup and selected-path fixes; remove superseded schema/classifier implementations.

Executed validation

Runtime source at 3de261cc5 is identical to the validated 2026d0099 (tree equality checked), including main b44cb5bd3 and existing audit commits. Final head 33450d02ea only restores two explicit unverified coverage entries and their documentation; execution/guard behavior is unchanged:

  • 299 tests / 22 files passed, covering native identity/ownership, retained facts, cancellation, 87 trace-policy controls, nine topology controls, native baseline absence and actual SDK-converted schema validation.
  • 62 Jadx/Java subprocess controls / two files passed in an ordinary-UID PID namespace with Tini. These exercise owned test producers, not a real Jadx-engine qualification. The previously failing strict cleanup/idle-retirement scenarios pass.
  • A separate 30-child native Linux experiment observed same-generation R-state/PF_EXITING processes whose environment could not be opened, with zero start-identity mismatches; all children were reaped. A pinned-main parser comparison reproduces three lifecycle classification defects and verifies the correction. This establishes a possible native exit race, not the effective UID or exact cause of every earlier CI failure.
  • 44 real GDB 13.1/pwndbg CLI/MCP cases passed, both historical-PID controls decoded, four traces checked and cleanup verified with no descendants. Runtime build passed. npm run check:fast, npm run docs:check and the full-repository formatting check passed.

Heavy checks run serially on two CPUs, with a 3 GiB V8 heap and an 8 GiB sampled process-family guard. Build: 51.50 s wall / 80.73 s CPU / 3,060 MiB peak family RSS. Jadx controls: 49.79 s / 40.96 s / 852 MiB. Shared controls: 23.83 s / 27.57 s / 1,058 MiB. Real GDB task: 117.70 s / 129.39 s / 2,802 MiB. Final static gate: 123.42 s / 239.36 s / 4,452 MiB; docs: 25.91 s / 31.10 s / 781 MiB. Family RSS is sampled every 20 ms, can double-count shared pages and miss brief/reparented children; OS caches are uncontrolled. No speedup, model-token saving or unmeasured platform/provider qualification is claimed.

Follow-up on the final coverage declaration: 118 lifecycle/parser/policy/topology tests across four files and docs checks pass. Two CPUs; 2.85 s wall / 2.69 s CPU / 390 MiB sampled family RSS for the controls; docs 9.08 s / 10.66 s / 704 MiB.

Limits

The trace report explicitly leaves legacy cwd-relative paths, symlink aliases, unlisted PID interfaces and same-Node-thread stat/status purpose unverified; it is not universal kernel containment. No local macOS, Windows or live Ghidra qualification is claimed. Required CI lanes and token retry counts remain unchanged; permission errors and unresolved identities still fail cleanup.

Author readiness

Human owner: @gensokyo-dev

The owner explicitly delegated these declarations and authorized opening ready, following CI/review and merging in this session. Codex reviewed the final diff and stated evidence; independent human review was not observed.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Use the pre-launch baseline only to select candidates for current native
identity/token validation. Preserve confirmed absence and verified foreign
generations instead of carrying a premature baseline identity failure.

Exercise the real Linux enumeration/exit race and retain countercontrols for
unknown identities and live token-owned processes.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T17:49:00.533942Z 33450d0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[Medium impact] The changes reach process cleanup and recorded-crash verification workflows.

Fix the lost-child ownership case before merging.

Findings

  1. P1 Cleanup forgets a live child ▶
  2. P2 Shutdown repeats exit waits ▶
Fix with agent prompt
### Issue 1
src/process/ProcessOwnershipObservation.ts:630-635
When a detached, token-owned helper exits during polling, this replaces its readable post-token identity with `absent`. If its child was first observed in another group with a cleared or different token, `ProcessOwnershipEvidenceOwner` loses the verified parent that tied the child to the run. The child is not retained, so verification can return `cleaned: true` while it remains alive.

Keep the original identity/token/identity facts for ownership tracking and record the later exit observation separately.

### Issue 2
src/process/ProcessOwnershipObservation.ts:549
Each call starts a fresh one-second wait, but `createOwnedCleanupPlan` checks each process group separately. With several groups stuck in `PF_EXITING`, cleanup waits about one second per group, even after the initial sweep has already waited for those same processes. Signaling starts only after the whole plan finishes, so other owned groups keep running during these repeated waits.

Share the deadline across the cleanup attempt or settle all selected PIDs together.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR separates native exit progress from confirmed exit and centralizes recorded-crash trace checks.

  • Process cleanup waits for native proof before treating an exiting child as gone.
  • Recorded-crash traces check historical PID access in CLI and MCP runs.
  • The base64 schema test checks large inputs against its projected form.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read native identity] --> B[Read run token]
  B --> C[Read native identity again]
  C --> D{Exit in progress?}
  D -- No --> F[Build ownership facts]
  D -- Yes --> E[Poll only selected PIDs]
  E --> F
  F --> G[Reconcile retained ownership]
  G --> H[Validate each process group]
  H --> I[Signal verified groups]
  I --> J[Verify remaining ownership]
Loading

Reviews (15) · Last reviewed commit: "fix(ci): retain trace coverage limits af..." · Reviewed by Greptile

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Added follow-up b32ce58 for the required recorded-crash oracle failure. It permits only exact Node/thread stat inventory for the live collision and adds a second unassignable historical-PID recording that rejects every lookup through CLI and MCP. Eight controls, an actual strace/Node worker read, static checks, docs and discovery pass; the body records the local home-permission gap and unavailable full debugger qualification. New-head CI 39260522926 has started. The previous-head CI 39258168652 was already completed, so there was no still-running old CI to cancel. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b32ce58c3a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Final fixture qualification is in b82ae19: both traced adapters must decode the selected historical PID before the syscall result can qualify. New-head CI 39262144887 is running; superseded run 39260522926 is confirmed cancelled. The preceding head passed both real recorded-crash container lanes. No further changes are planned absent an actionable review/CI defect. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b82ae1962f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: d34c8514a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Classify producer-decoded FD/path pairs once instead of limiting failed relative
lookup detection to openat on /proc. This preserves attempted readlinkat, statx
and newfstatat accesses with no returned descriptor.

Three regression cases fail against the previous policy and all 33 controls
pass with the shared pathname interpretation.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 804caa2cb2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/verify/recorded-crash/trace.mjs Resolved
@gensokyo-dev gensokyo-dev changed the title fix(process): classify baseline cleanup with current ownership facts fix(ci): repair cleanup and historical PID verification Oct 19, 2026
Report the historical-PID access surfaces actually checked and explicitly mark
legacy cwd-relative pathname calls unverified. The existing tracer does not
provide their cwd identity, and a blanket rejection also rejects legitimate
GDB build-ID metadata queries.

Retain every committed access guard and document the preexisting limit without
claiming absence from missing path evidence. The complete real 44-case CLI/MCP
recorded-crash qualification passes with the coverage declaration.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
# Conflicts:
#	docs/recorded-crashes.md
strace renders non-ASCII pathname bytes as C octal escapes, not JSON strings.
Keep those components opaque when resolving literal ASCII path separators and
proc PID selectors, matching the existing absolute-path interpretation.

Two controls fail before the correction and all 35 pass afterward. An actual
strace observation independently reproduces the rejection of an unrelated
Chinese filename and verifies the corrected classification.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8dd8ca0804

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/verify/recorded-crash/trace.mjs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c49e7a24c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Confirmed both resource/scheduler findings with controls on the current integrated head. A real owned Python sentinel reproduces prlimit64 query/same-value update and sched_getaffinity/same-affinity set: the prior oracle accepts all four, the local policy rejects them, and sentinel limits/affinity remain unchanged. The follow-up covers the complete sched PID-first family plus prlimit64, with distinct PID and self-selector controls. Publishing after focused/static and real CLI/MCP qualification; leaving these two threads open until that commit is reviewable.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Current-head shard 5 exposes a deterministic main baseline conflict: main 49b4e... introduced look-around into CANONICAL_BASE64_PATTERN to avoid large-input V8 stack exhaustion, while advertisedPatternsVMode requires RE2/Rust-compatible advertised schemas. Five outputSchema patterns fail that gate. I am preserving both requirements (canonical/large inputs and portable schemas), without weakening the gate. Current Windows failure is separately a 30s CLI help/removed-command timeout; the log is retained and no product defect or fix is claimed for that timeout.

Retain main’s provider-independent registration fixtures and stronger native lifecycle controls. The earlier shared-host EACCES failure remains recorded; no permission error is suppressed.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review head 2a42096e1510320fae71a3605247dcf716514f63, integrated with main 0e62094b6. All final local gates pass, including 332 tests and the complete 44-case real GDB qualification. This retains main’s fixture isolation for the previous shared-host registration failure; no permission failure or check is suppressed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 2a42096e15

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Adopt main’s selected-path versus artifact-identity test correction and Rizin plain-output update. Product ownership and recorded-crash qualification code are unchanged from the locally and remotely verified 2a42096 implementation.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review final integrated head 54e971a14850371f16785a934932d1284f8a107c with main b44cb5bd3. The 71 affected JavaScript Evidence/Rizin cases and full static/docs/discovery checks pass. Cleanup and recorded-crash code are unchanged from the 332-case / 44-case real GDB verification at 2a42096; main now fixes both preceding parity-test failures.

@gensokyo-dev gensokyo-dev changed the title fix(ci): reconcile ownership cleanup and recorded-crash verification fix(process): settle native exit and repair ownership verification Oct 19, 2026
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 3de261cc5e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Restore explicit unverified symlink aliases and same-Node stat/status purpose in the shared coverage contract and guide. The native-exit and trace-attribution integration does not establish those properties. Preserve both limitations rather than silently broadening the reported qualification.

Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review 33450d02ea09926128e939cc976596f60c81c3fc. This only restores the symlink-alias and same-Node-thread-purpose limitations lost during integration; docs and the shared report now match. Runtime/guard behavior is unchanged from 3de261c / validated tree 2026d00. Follow-up:118 lifecycle/parser/policy/topology controls and docs pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 33450d02ea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants