Skip to content

refactor: share daemon command and teardown budgets - #2307

Merged
thymikee merged 4 commits into
mainfrom
refactor/managed-command-budgets
Sep 6, 2026
Merged

refactor: share daemon command and teardown budgets#2307
thymikee merged 4 commits into
mainfrom
refactor/managed-command-budgets

Conversation

@thymikee

@thymikee thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Shares request timeout calculation through the existing command policy module. The client resolves registry policy and calculates its envelope synchronously from neutral inputs, making the same calculation available to managed admission.

Ordinary teardown requires an existing session; managed recording reservation belongs to #2308. Arithmetic, cleanup behavior, and ordinary/provider behavior are preserved.

Twelve files: eleven within timing/teardown, plus one fixture correction in a separate commit. That fixture intercepts session prewarm before its deferred runner import. Tests move beside their owners and reuse session fixtures. No standalone docs or skills changed for this internal refactor.

Validation

Rebased onto requested main snapshot 80997b6bf1dda30ca57d74dc42036f6b447e16ad. All four commits are unchanged by range-diff from the previously reviewed head; there were no conflicts. Tested head: 97f4e7057f3c4d6dead9df39a6a7645063c877e4.

  • Fresh exact-head pnpm check:affected --run passed: 3,227 tests / 429 files. The focused suite passed 482 tests, including all 418 eager-closure checks against the exact main snapshot. Host-wide gate serialization was used.
  • Existing red/green evidence is preserved: removing positional margin fails at 180000 versus 210000; the overlapping-import probe reproduces forbidden runner startup cleanup before the fixture fix and passes afterward. Its single-import negative control passes. No diagnostic instrumentation or guard changes remain.
  • Independent adversarial review of the final restack is READY: no actionable findings.

Prior iOS attempts failed before device smoke in toolchain preparation. Replacement-head Coverage, Integration, and native checks will be rechecked against this main snapshot; its smoke fixes are not assumed to pass.

@thymikee thymikee changed the title refactor(daemon): share command and teardown budgets refactor: share daemon command and teardown budgets Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.48 MB 4.48 MB -9 B
Package (unpacked) 4.48 MB 4.48 MB -9 B
Package (download) 1.33 MB 1.33 MB -34 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.6 ms 28.1 ms +0.5 ms
CLI --help 81.3 ms 80.6 ms -0.7 ms

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Sentinel review at 5c4b003, independently reviewed. The budget arithmetic and shutdown behavior are preserved, with tests moved alongside their owners and recording reservation covered. One blocker: the new static import from daemon-client.ts to request-timeout.ts grows the CLI eager closure from 381 to 382 modules; Coverage run 33984965827 fails the enforced gate on that exact path. Reuse the shared resolver through a lazy boundary in the asynchronous client path (or another owning construction that preserves the closure), then prove the eager-closure gate and exact-head Coverage pass. Do not raise the baseline for this extraction. No live device evidence is required for the behavior-preserving prerequisite itself. No readiness label applied.

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Addressed the blocker from the Sentinel review in 327c2e8. The shared resolver now loads inside the already-async sendToDaemon path. Its synchronous API and timeout policy are unchanged; no baseline was raised.

The CLI eager closure is back to 381 modules. The failure was reproduced against the CI comparison commit a90d95a before the fix. After the fix, all 418 exact-base closure checks and the focused timing/client/shutdown tests pass (465 tests total). The required affected checks also pass (805 tests).

Exact-head Coverage is still running: https://github.com/callstack/agent-device/actions/runs/33986043196/job/101359591847. The requested CI proof remains pending; this is not yet a merge-ready claim.

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Exact-head Coverage is green for 327c2e86439674ac680bc2c0aea1ff50712d5f05: Coverage job. This completes the remaining evidence request in the Sentinel review.

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Sentinel re-review at 327c2e8: code clean, independently confirmed. Moving the shared timeout resolver import inside sendToDaemon resolves the eager-closure finding; Coverage passes. Merge readiness is still blocked by Android Smoke (automation-alert-result selector missing) and iOS Smoke (truncated AX capture cannot prove absence). These logs do not establish a regression from the import-only delta; require successful exact-head device lanes before merging. No ready-for-human label while checks fail.

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Sentinel at 9a83035: coordinator + independent Terra/high code review clean. Request-envelope arithmetic and existing-session teardown budgets are preserved; the unit fixture now intercepts prewarm at its owning seam. Coverage and Integration pass. NOT merge-ready: iOS job https://github.com/callstack/agent-device/actions/runs/33991468607/job/101374350976 fails before device smoke: shallow base fetch makes the changed-path diff report no merge base, then installed bridge preparation times out xcrun --sdk iphonesimulator --show-sdk-version at 10s. This is outside the modified request-timeout path, not proof of a source regression or a proven host flake. Next action: obtain a green exact-head iOS run; workflow guard repair belongs to its owner. No readiness label.

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Follow-up to the current Sentinel review: one focused rerun of the failed iOS job on unchanged head 9a83035da4c0829b7181fc05ecd94a482c8bf88a also failed before device smoke.

Attempt 2 again reports no merge base in the changed-path diff. Installed snapshot bridge preparation then times out xcodebuild -version at 10,000 ms; attempt 1 timed out the SDK-version query. This does not establish a request-envelope regression or prove a host flake. No workflow/native source change was made here.

The local exact-head gate remains green. Downstream restacking continues from this published prerequisite without waiting for CI; merge readiness still requires the missing exact-head iOS evidence.

@thymikee
thymikee force-pushed the refactor/managed-command-budgets branch from 9a83035 to 97f4e70 Compare September 5, 2026 21:30
@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Rebased the complete timing layer onto requested main snapshot 80997b6bf1dda30ca57d74dc42036f6b447e16ad and published 97f4e7057f3c4d6dead9df39a6a7645063c877e4.

All four commits are unchanged by range-diff; no conflicts or additional timing/native changes were introduced. Independent adversarial re-review is READY. The fresh exact-head affected gate passed 3,227 tests across 429 files, and 482 focused checks passed, including all 418 eager-closure cases against that exact main snapshot. Prior red/green margin and fixture evidence remains preserved in the unchanged commits.

Replacement-head CI and iOS are running. Android failed during scenario setup: its screenshot and snapshot show a “System UI isn't responding” dialog over the correctly opened Automation lab. The explicit 10-second wait expired; orientation cleanup was refused by the same system dialog, while session close succeeded. This did not exhaust the daemon request envelope. One focused retry was dispatched; the underlying ANR cause is unproven.

The verified published prerequisite is already handed downstream; CI does not delay the remaining restack. No merge-readiness claim.

@thymikee

thymikee commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Sentinel: clean coordinator + independent Terra/high review at 97f4e70. All four commits are range-diff equivalent after the rebase; shared command/teardown budget ownership and existing behavior remain intact. Exact-head runnable checks now pass, including iOS/Android smoke and coverage/integration, resolving the earlier CI blocker. Ready for human review/merge; land before dependent stack layers. No merge performed.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 5, 2026
@thymikee
thymikee merged commit 9b5b245 into main Sep 6, 2026
18 of 19 checks passed
@thymikee
thymikee deleted the refactor/managed-command-budgets branch September 6, 2026 06:11
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-06 06:11 UTC

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

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants