Skip to content

fix(process): name the fixed finalization delivery grace - #6342

Merged
N0zoM1z0 merged 2 commits into
morluto:mainfrom
saimmehmood:fix/process-finalization-grace-disclosure
Nov 21, 2026
Merged

N0zoM1z0 merged 2 commits into
morluto:mainfrom
saimmehmood:fix/process-finalization-grace-disclosure

Conversation

@saimmehmood

@saimmehmood saimmehmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Finalization signal-delivery records cited a bare millisecond figure when a
delivery did not settle, without saying whether that figure is adjustable. An
agent reading exit.finalization.signals[].reason could not tell that the grace
is fixed implementation policy, and could plausibly infer that raising the
caller-selected finalization_ms would extend it.

Relates to #5910 (limit errors omit adjustment controls and leave hard-coded
ceilings unexplained).

Problem and expected behavior

Smallest trigger: run a capture with a positive finalization_ms where the
signal delivery never settles within 1000 ms (ProcessCaptureLifecycle
attempt()). The record is correctly marked delivery: "unverified", but its
reason read:

delivery did not settle within 1000 ms

Violated invariant, from #5910 success criterion 4: for a retained hard-coded
cap, the error must say that this release has no runtime override and must not
imply that an unrelated, caller-selected budget changes it.
PROCESS_FINALIZATION_DELIVERY_GRACE_MS is a module-private constant with no
environment or per-call control, and it is independent of finalization_ms
(which is the SIGTERM→SIGKILL interval, not the per-delivery settle grace).

Expected: the reason names the specific budget, states that it is fixed in this
release, and forecloses the wrong inference about finalization_ms.

Change and scope

One message string, the two assertions that pin it, and one clause in
docs/process-capture.md so the owning documentation states the same fixed bound.

The new text keeps the local register of this field. Sibling values in the same
function ("delivery had not settled when the record was published",
"delivery wait was interrupted") are lowercase fragments without trailing
periods, so the disclosure is appended as a clause rather than as a separate
capitalised sentence.

Intentionally not included:

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".

Contract and boundary impact

  • Semantic owner and earliest changed stage: process capture finalization,
    src/process/capture/ProcessCaptureLifecycle.ts — the producing boundary that
    records a finalization signal's delivery result.
  • Contribution scope fit and linked maintainer decision: not applicable;
    ordinary fix inside an existing boundary, no new provider or capability.
  • CLI and MCP/tool-catalog contract: unchanged. signals[].reason is already
    z.string().min(1).optional() with no maximum length; only the text differs.
    No catalog or schema regeneration.
  • Provider, bridge, target-format, or platform compatibility: none; the string is
    platform-independent.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged. The
    reason still accompanies delivery: "unverified", which
    processCaptureFinalizationSchema requires (a reason is permitted only for an
    unverified delivery). "Unverified" continues to mean delivery was not
    confirmed, not that it failed.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not
    applicable; no change to signalling, ownership, or cleanup.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: the documentation change needs no new test; the two existing assertions in
    src/process/capture/ProcessCaptureLifecycle.test.ts that pin this reason
    (stops waiting for a hung delivery once the exit is observed, and
    stops waiting when the escalation delivery never settles and no exit arrives)
    are updated to the new text. Both already exercise the unsettled-delivery path.

  • Base reproduction or other evidence: executed. Reverting only the source
    file to the parent revision while keeping the updated assertions fails the
    regression as expected:

    × stops waiting for a hung delivery once the exit is observed 1125ms
    

    The reason is compared by exact equality through toMatchObject, so the
    coverage catches a silent revert of the disclosure. The source file was
    restored afterwards and the committed diff is unchanged.

  • User-visible CLI/MCP output (if applicable): the reason field of an unverified finalization
    signal record now reads:

    delivery did not settle within REA's fixed 1000 ms signal-delivery grace; this release has no runtime override and a larger finalization_ms does not extend it

  • Remaining proof gaps:

    • No real process capture was driven end to end to observe this message in
      live MCP output; the unsettled-delivery path is exercised through the
      suite's fake terminal, as the pre-existing tests do.
    • npm ci in this environment resolved vite 8.3.2 → 8.3.5 as a peer
      dependency and rewrote package-lock.json; that drift was reverted and is
      not part of this PR, but the test run therefore used vite 8.3.5 rather than
      the locked version.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/process/capture/ProcessCaptureLifecycle.test.ts —
    1 file passed, 25/25 tests passed (6.98s), including both updated
    assertions.
  • npx vitest run --project process-boundary tests/boundary/process/processCaptureLifecycle.test.ts
    — 1 file passed, 24/24 tests passed (24.2s). Verified against the parent
    revision as well, which also passes 24/24, so this change leaves the real
    process-capture boundary behaviour unchanged.
  • Base-revision regression check (source reverted, assertions kept) —
    failed as intended, 1 test failing; see Evidence above.
  • npm run check:fast (turbo typecheck + lint) — 2 successful, 2 total,
    exit 0.
  • npm run lint — 4645 files, 0 errors, 2239 pre-existing repo-wide
    warnings. The 9 diagnostics touching
    src/process/capture/ProcessCaptureLifecycle.ts are pre-existing structural
    warnings (max-lines 1585, complexity 38, max-params, and
    max-lines-per-function); this change replaces one line with one line and
    does not alter them.
  • npm run verify:module-boundaries — checked 2704 source files, passed.
  • npm run format:check (oxfmt) — no issues in either changed file.
  • Documentation: docs/process-capture.md now says the bound is fixed, has no
    runtime override, and is not extended by finalization_ms (source-derived
    wording check against PROCESS_FINALIZATION_DELIVERY_GRACE_MS; no test covers
    prose).
  • grep -rn 'did not settle within 1000 ms' . — no matches outside the two
    changed files; no stale assertions, snapshots, fixtures, or docs embed the old
    text.
  • Exact-equality check between the source template (constant substituted) and
    both test literals — both match byte-for-byte.
  • The full process-boundary project (12 files, including JADX/Java integration)
    was not cleanly established in this environment: interrupted earlier runs
    left orphaned process state that produced spurious failures, and some files
    need external provider tools. Only the file covering this change was run to a
    clean, repeated result. CI coverage is needed for the rest.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. The field is an optional
    human-readable string, not an enum or a stable identifier. Any consumer
    matching this reason by exact text would need updating, but the text is not
    part of a documented contract.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; no provider or
    platform interaction changes.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none. No new data is
    disclosed; the message names a constant already visible in public source.

Author readiness

Human owner: @saimmehmood

  • 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.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@saimmehmood
saimmehmood marked this pull request as ready for review October 22, 2026 16:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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 ⚠️ Failed 2026-10-22T16:17:26.056165Z
We couldn’t complete this review. Comment @codex review to try again.
8b308d7 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@saimmehmood

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[Low impact] The PR changes wording in one process-capture record.

The runtime change appears safe, but the existing test-guide violation must be fixed before merging.

Findings

  1. P2 Harmless wording breaks tests ▶
Fix with agent prompt
### Issue 1
src/process/capture/ProcessCaptureLifecycle.test.ts:421-422
Both updated assertions, here and at line 493, require the entire explanatory sentence to match. The repository's test guide requires checking facts and guidance delivery instead of freezing explanatory prose. Harmless wording changes now require editing three copies.

Compare against an owning formatter or constant, while keeping independent checks for the budget and delivery behavior. This repository requirement must be satisfied before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

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

Summary

Clarifies that the 1000 ms signal-delivery grace is fixed, has no runtime override, and is independent of finalization_ms.

  • Unverified signal records explain that their delivery grace is fixed.

Reviews (4) · Last reviewed commit: "docs(process): state the finalization de..." · Reviewed by Greptile

@CassieFox23 CassieFox23 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR: Main still has the old message, and I found no problem in the fix itself. The main CI workflow has not run on this head, so no tests have run in CI yet. The body leaves out parts of the template, and the docs still describe the 1000 ms bound without saying it is fixed.

Edit (27 Oct): You rebased this, and the code is unchanged. I ran its tests on the new head here. The docs and body points below still stand.

Findings

Should fix

  • docs/process-capture.md still says an unverified reason can name "delivery that did not settle within the bound (1000 ms)". It does not say the bound is fixed or that finalization_ms does not change it. The body ticks this box: "Owning docs, contracts, and generated metadata are updated where needed". One added clause there would match the new message.
  • The body does not keep the template as written. Seven of the eight "Expected effects" boxes are gone. Only "Documentation or usability only" is left. The "Generated metadata" label is shortened. A leftover HTML comment under "Author readiness" says the boxes are left unchecked. It also says the PR is a draft. But the boxes are ticked, and the PR is not a draft. Please restore the template text.

Nit

  • The issue behind this change is #5910. It asks that a retained fixed cap also give a reason. It also asks for a supported alternative or blocker (its success criterion 4). The new message says the value is fixed and that finalization_ms does not extend it. It gives no reason. This is optional, and the issue is already closed.

Looks good

  • Main (46217c6) still has the bug. The old template string is still at line 885 of ProcessCaptureLifecycle.ts on main, and I found no other fix for it on main.
  • The new wording is accurate. PROCESS_FINALIZATION_DELIVERY_GRACE_MS is a literal 1_000 with no environment or per-call control. finalization_ms only sets the wait between SIGTERM and SIGKILL, in the interval check and in the docs.
  • Main already words the adb deadline the same way as the phrase "this release has no runtime override", in AdbCommand.ts.
  • The two updated assertions in ProcessCaptureLifecycle.test.ts (line 422 and line 493) are the only other places that quoted the old string. Also, the schema keeps reason as a plain non-empty string.
  • Neither changed file has changed on main since the merge base (3d472bd), so I saw no conflict.
  • Greptile scored it 5/5 and left no threads. The Codex review failed on its usage limit, so it gave no result either way.

Not run

  • No build and no tests. This is a read-only review of the diff against main.
  • The test counts, the revert check and the lint and format results in the body are the author's own. I did not rerun or confirm them.
  • The CI workflow for this head did not run, so there are no hosted test results to rely on. Run 39811889876 shows action_required with zero jobs, and the PR title runs show the same. Only PR readiness and Greptile have passed, and GitHub reports the merge state as blocked. I did not check why. A common cause is this. A common cause is a first-time author, whose runs a maintainer must OK. This is general GitHub behaviour, and I did not verify it here. Nothing in the diff needs to change for this.

Thanks, saimmehmood, for the fix and for pinning the new text in both tests.

Test setup

🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI-assisted review traced the delivery race, escalation timer and observed/unobserved exit recording. The new reason accurately separates the fixed per-signal 1,000 ms delivery grace from finalization_ms; it preserves unverified delivery and does not assert target exit or alter signaling/ownership. The two existing producer-path tests retain their exit/finalization assertions and now pin this disclosure.

No source defect found. I authorized the zero-job CI/title workflows; approval requires their completed required results. No local lifecycle suite/live process-capture pass is claimed. The prior suggestion to label the same fixed limit explicitly in the owning docs remains useful; body hygiene is not proof of human review or its absence.

@saimmehmood
saimmehmood force-pushed the fix/process-finalization-grace-disclosure branch from 8b308d7 to 1360da2 Compare October 25, 2026 18:06

@CassieFox23 CassieFox23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR: You rebased onto main, and the code is the same as what I reviewed on 22 Oct. Its test file passes on Node 22, 24 and 26 in a VM. The docs and body points from my last review still stand.

This follows my last review. git range-diff shows the one commit matches the one I reviewed, patch for patch: 8b308d7 is now 1360da2.

Still open from last time:

  • docs/process-capture.md still says "delivery that did not settle within the bound (1000 ms)". It doesn't say the bound is fixed, or that finalization_ms doesn't change it. One clause would match your new message.
  • The template's Expected effects boxes are still gone. The "Generated metadata" label is still cut short. The comment that says the PR "is opened as a draft" is still there, but it isn't a draft now.
Test setup
  • Where: Fedora 44 VM (4 vCPUs, 8 GB, kernel 7.2.11) on my Nobara 44 box, offline
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
  • Head / base: 1360da2 / 4ed33ef (merge base; main was 40b9c03)
Commands

All of these ran in the VM.

Command Exit Result
npm ci --offline (Node 24.22.1) 0
npm run test:prepare (Node 24.22.1) 0
npm run test:focused -- src/process/capture/ProcessCaptureLifecycle.test.ts on Node 24.22.1 0 25 of 25 passed
the same on Node 22.23.4 0 25 of 25 passed
the same on Node 26.12.1 0 25 of 25 passed

🤖 Written and tested with Claude Code (Opus 5.5), posted with my OK 🦊

Comment on lines +421 to +422
reason:
"delivery did not settle within REA's fixed 1000 ms signal-delivery grace; this release has no runtime override and a larger finalization_ms does not extend it",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Harmless wording breaks tests

Both updated assertions, here and at line 493, require the entire explanatory sentence to match. The repository's test guide requires checking facts and guidance delivery instead of freezing explanatory prose. Harmless wording changes now require editing three copies.

Compare against an owning formatter or constant, while keeping independent checks for the budget and delivery behavior. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/process/capture/ProcessCaptureLifecycle.test.ts
Line: 421-422

Comment:
**Harmless wording breaks tests**

Both updated assertions, here and at line 493, require the entire explanatory sentence to match. The repository's test guide requires checking facts and guidance delivery instead of freezing explanatory prose. Harmless wording changes now require editing three copies.

Compare against an owning formatter or constant, while keeping independent checks for the budget and delivery behavior. This repository requirement must be satisfied before merging.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@CassieFox23

Copy link
Copy Markdown
Contributor

Thanks, saimmehmood, for the docs line and the body fix. I read 5eda453 against my review above. Both should-fix points are closed:

  • docs/process-capture.md now says the 1000 ms bound is fixed, and that a larger finalization_ms does not extend it (lines 432 to 434).
  • The body has all eight "Expected effects" boxes again. The "Generated metadata" label is whole, and the stale draft note is gone.

That commit only touches the doc, so my 27 Oct test run still covers the code. GitHub now shows the branch conflicting with main, so it needs a merge of main.

🤖 Written with Claude Code (Opus 5.5), posted with my OK 🦊

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Reopening to get CI against current main: the earlier runs were created when this branch was pushed, so they tested an older main. The failures in them (javascriptIndirectLoaderOwners, ciPrHealth, sourcePublicationComposed) pass on current main and are unrelated to this change.

@N0zoM1z0 N0zoM1z0 closed this Nov 21, 2026
@N0zoM1z0 N0zoM1z0 reopened this Nov 21, 2026

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified: PROCESS_FINALIZATION_DELIVERY_GRACE_MS is a fixed 1000 ms constant with no runtime override on main. Merged onto current main, the lifecycle tests pass (19). Thanks.

saimmehmood and others added 2 commits November 21, 2026 21:11
An unsettled finalization signal delivery reported a bare millisecond
figure, without saying whether that grace is adjustable. An agent could
infer that raising the caller-selected finalization_ms would extend it.

PROCESS_FINALIZATION_DELIVERY_GRACE_MS is module-private with no runtime
control, and is independent of finalization_ms (the SIGTERM-to-SIGKILL
interval). State both in the reason, keeping the lowercase fragment
register used by the sibling reasons on this field.

Relates to morluto#5910.
@gensokyo-dev
gensokyo-dev force-pushed the fix/process-finalization-grace-disclosure branch from 5eda453 to 21c488d Compare November 21, 2026 21:11
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Rebased onto current main (no conflicts) so CI runs against it. The diff is unchanged.

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified: the delivery grace is a fixed constant with no override; rebased cleanly and fresh CI is green. Thanks.

@N0zoM1z0
N0zoM1z0 merged commit 2d71c5c into morluto:main Nov 21, 2026
49 checks passed
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 23, 2026
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.

6 participants