mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #5812] [Feature] Expose SQLite worker deadlines with precise timeout and limit recovery #3518
Closed
opened 2026-10-31 00:41:24 +00:00 by bsakaguchi
·
4 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#3518
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gensokyo-dev on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5812
Before submitting
Area
MCP or agent integration
Current limitation
Source-derived on
a5f982de8dbe4b092cc20ab89d492b7e7028b758: SQLite's owned worker always receivesSQLITE_DATABASE_LIMITS.timeoutMs = 30000. Its input contract/CLI have no supported deadline control;SqliteDatabaseFailures.tsemits generic timeout recovery with that constant. A caller cannot adjust this worker budget or identify the actual supported repair from the error. Raising the MCP client timeout alone does not change it.The worker deadline is distinct from acquisition of the frozen DB/WAL and from final reply reads/cleanup. Existing input/SQLite value/SQL/reply/heap allowances are separate safety controls, not timeout settings.
Desired outcome and success criteria
worker_timeout_ms/ CLI--worker-timeout-ms, default 30000, positive integer milliseconds within the runtime timer range.Use cases / alternatives
An agent inspecting a legitimate application database should recover from an insufficient worker deadline using the actual named contract. Exact row columns and compact schema inventory can reduce unnecessary analysis/output, but are not substitutes when the caller needs the omitted facts. Client-only timeout changes, global heap changes and repeated unchanged calls cannot repair a fixed worker budget.
Expected interaction with targets
Read existing database/WAL snapshots; launch the existing owned Node SQLite worker on private copies. No arbitrary SQL, view execution, target launch, native provider, network acquisition, repair or installation.
Verification available so far
Source investigation. Natural slow-database timeout frequency/performance: NOT_ENOUGH_INFO; no such runtime claim yet. Proposed checks are not completed results.
Verification details
Fail-before/pass-after contract and production-boundary tests; real CLI/MCP on public Chinook plus small source-owned DB/WAL, malformed and generated-large-value fixtures; actual Codex CLI selecting a corrected small deadline and completing the same question. Test supported field selection versus fixed value/reply limits and immutable input refusal. Retain cancellation/cleanup and Evidence identity coverage. Record whole-agent tokens, elapsed, CPU and sampled family RSS with cold/warm and failure limitations explicit.
@gensokyo-dev commented on GitHub (Oct 21, 2026):
Executed SQLite recovery verification (2026-10-21)
Implemented against
a5f982de8dbe4b092cc20ab89d492b7e7028b758: optional per-callworker_timeout_ms/--worker-timeout-ms, default 30000, integer range 1..2147483647. The parent owns the actual worker budget; report metadata, explicit Evidence parameters and timeout diagnostics agree. Historical missing metadata remains unknown. Worker startup/queries/reply writing are covered, not snapshot acquisition or final read/cleanup/delivery. Fixed byte/heap bounds remain fixed.Correctness and boundaries
npm run test:sqlite: 150 passed, 3 skipped, 12 files, final run 71.60 s on Linux / Node 24.18.0. Includes real compiled CLI/stdio MCP, custom budget retained through cancellation/cleanup, frozen DB/WAL identity, exact columns, fixed combined input admission and owned worker cleanup. The controlled startup-delay boundary test times out at 50 ms and completes the same database at 2000 ms.npm run check: passed typecheck, formatting, lint/module boundaries, unused-code checks, metadata and architecture guards. Existing lint warnings remain. An earlier formatting failure was corrected with the repository formatter.npm run docs:checkandnpm run verify:test-discovery: passed again after the final test additions (five README checks; all 1900 test files discovered exactly once).Actual Codex CLI behavior
Model
gpt-6.1-sol, Codex CLI 0.161.0, fresh ephemeral sessions, onlyinspect_sqlite_databaseenabled, at most six sequential calls. Prompts seed the exact first request and preserve the analytical question; no recovery procedure is supplied. No shell, installation, edits, alternate engines or arbitrary SQL are authorized.Public Chinook SQLite, SHA-256
7651ba378ac2fcd0dfc3c66fb101f7a7eed3ba39a612ec642b96e20702061f15, 3503 tracks. The task selects twoTrackId/Namerows with compact inventory. An independent Python SQLite read-only/immutable query verifies returned IDs/names; a separate verifier checks every receipt, final Evidence ID, original digest, selections, absence of mutations/unchanged failed retries and remaining owned processes.invalid_request; removes unsupported field, finishes same taskprovider_timeout; independently selects 30000 and finishes same taskinvalid_request; selects legal 30000, finishes same taskid/title, completesea24207b5Ten recorded sessions: eight reached REA, two host-discovery blockers. Seven completed answers and one legitimate fixed-input blocker. No unchanged failed retries, shell commands, unexpected tools, or surviving sampled process identities. Whole trial totals include failed host attempts: 976516 input tokens (780672 cached), 4950 output, 330.81 wall seconds, 110.95 CPU seconds. Token counts include host/tool discovery and retries, not just response bytes. No claim that this patch makes model runs faster or cheaper: the one-call before/after controls are noisy and not statistical performance evidence.
*RSS samples every 500 ms, process identity tracked by PID plus start time including observed descendants; not a kernel peak or native-memory cap. CPU from
/usr/bin/timeincludes the agent/server/worker descendants, not preparation/tests/review or the sampler. Runs use fresh processes; OS/model caches are uncontrolled, so not a cold-cache versus warm-cache benchmark. Raw prompts, JSONL, stderr, timing, reports and verification scripts are retained locally in.cache/sqlite-recovery-20261021/, not committed or publicly attached. No OOM observed; serial model sessions and bounded Node heaps were used.Limits of this evidence / follow-up
The tiny 1 ms deadline is deliberate fault injection, not a naturally slow 30-second database. The generated-value and sparse 256 MiB+1 files are source-owned resource controls, not healthy large-application qualification. macOS/Windows, other Node versions, natural slow databases, total native memory bounds and other providers are unverified here. The existing native
SQLITE_NOMEMversus JavaScript-heap classification is separate follow-up; this change does not claim to fix it. Remaining provider boundaries stay tracked in #5808.@XinwangTao commented on GitHub (Oct 21, 2026):
The success criteria are well scoped — in particular the rule that "fixed resource refusal must not suggest raising a timeout" and "changing the analytical question is not an automatic recovery" keep the guidance honest, so a caller can't paper over a genuine 256 MiB refusal by bumping the deadline. Two things I'd want covered before this lands: (1) the timeout+cleanup-failure path — per the criteria, primary facts must be retained without making cleanup retryable; worth a dedicated test where the worker times out and the subsequent cleanup also fails, asserting the timeout error stays primary; (2) the CLI/MCP parity — the per-call worker_timeout_ms and the CLI flag should resolve to the same effective budget, ideally with a test that both entry points produce the identical timeout error shape for the same deadline value. The before/after evidence with the 1 ms fault injection is a nice honest way to prove the pass-after contract without pretending it measures real-world slow databases.
@gensokyo-dev commented on GitHub (Oct 21, 2026):
Final validation and review fixes:
b58ca531f1f978a5813d3fe5b8e054171fe0466bSupersedes the initial counts in the ten-session record; raw earlier failures and sessions remain retained, not erased.
All three actionable automated findings were fixed at their owners:
f1fbd1d62; default omission, explicit selection, missing/mismatched metadata and historical parsing now have distinct coverage.provider_timeoutwith the same budget. The new provider test reproduced two serialized output copies before the fix. This is a controlled production-boundary process/cleanup fault, not a naturally slow SQLite query or a real OS permission failure.OwnedCommandFailurecleanup previously kept only serialized timeout facts. A fail-before guard proved the missingcleanupPrimary. A shared SQLite cleanup composer now preserves that typed primary and canonical captured output while keeping history metadata-only. Both paths retain exactly one output payload before and after cleanup resolution; cleanup remains non-retryable while unresolved. Related descriptor-cleanup assertions now reflect canonical outer output ownership rather than requiring another nested payload. Windows-specific assertions were source-updated but not locally executed.Final executed checks on this code:
npm run check: passed (existing warnings unchanged).npm run test:sqlite: 155 passed, 3 skipped, 12 files, 69.39 s.npm run docs:check: passed, including five README consistency checks.npm run verify:test-discovery: all 1900 test files discovered exactly once.Three additional actual Codex CLI sessions
Same model, exact-first-call prompt, restrictions and measurement method as the original record; no recovery procedure was supplied.
normal-finaltimeout-finalrepeat-final(final cleanup code)13 total recorded sessions: ten reached REA; nine completed answers and one legitimate fixed-input blocker. Three pre-REA host-discovery failures are not product recovery passes. Four distinct 1 ms timeout trials all selected 30000 and completed the unchanged requested Chinook rows. The independent receipt verifier checked exact inputs, selected columns/sample/scope, final Evidence IDs/digests/rows, and all recorded failure classifications. No unchanged failed retries, shell commands, unexpected tools or surviving sampled process identities.
Whole 13-session totals (including failed controls): 1292760 input tokens, 1022720 cached input tokens, 6559 output tokens; 420.43 wall s; 135.04 CPU s; 1121.2 MiB maximum sampled process-family RSS. Sampling is every 500 ms, not a kernel peak. Preparation/tests/reviews/sampler excluded from these task costs. Fresh processes, uncontrolled OS/model caches; no cold-versus-warm claim or statistical speedup claim. No OOM observed. Natural 30-second database workloads and total native memory bounds remain unmeasured.
The three pre-dispatch sessions contain the model's claim that the tool was unavailable, with no REA tool calls and no transport error captured in stderr. Whether this is model discovery, host registration/routing or the constrained prompt is not established. They remain unresolved agent/host-discovery failures, not product recovery passes or proven REA transport defects. A SQLite timeout message cannot repair a request that never reaches the tool. Raw receipts remain in the ignored local verification directory; no binaries, private data or credentials were committed.
CI distinction
Current-head CI/review results are recorded on #5818. On previous head
200f493d9, test shard 4 failed only incliInputSchemaRequired.test.tsfor WABTcommandTimeoutMs, not SQLite. The same failure was reproduced in the earlier WABT worktreee9cdf873c58bd32e8f43b69f8a9a6d1ceb50d645, before this SQLite change. Its test oracle checks a standalone field withundefined, which does not represent object-key omission for.exactOptional(). This is tracked in #5845 rather than changing the WABT contract or relaxing the SQLite tests in this PR. Human-review declarations are not fabricated; readiness-policy status is not represented as all green.@XinwangTao commented on GitHub (Oct 22, 2026):
Both points I raised are now directly covered: the retained-cleanup provider test exercises a real owned worker timing out at 3000 ms with cleanup deliberately denied, snapshot retained and a second inspection blocked — proving the timeout stays primary without making cleanup retryable; and the six CLI/MCP verifier pairs (default, selected 60000, 1 ms, invalid 0, exact-column, oversized-refusal) confirm both entry points resolve to the same effective budget with identical error shapes. The three actionable findings (missing-budget guard, cleanup-primary, single output owner) all being fixed at their owners closes the loop cleanly. Nice work on the honest before/after record.