Skip to content

fix(integrations): bound managed config reads and writes - #7017

Closed
luvs01 wants to merge 4 commits into
lidge-jun:devfrom
luvs01:codex/upstream-managed-config-bounds-6da27743-20261013
Closed

luvs01 wants to merge 4 commits into
lidge-jun:devfrom
luvs01:codex/upstream-managed-config-bounds-6da27743-20261013

Conversation

@luvs01

@luvs01 luvs01 commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Read managed integration configurations through a bounded regular-file descriptor, rejecting final symlinks, special files and files larger than 4 MiB before parsing. Apply the same write limit to merged configurations and Cline recovery markers, and clean up unused snapshots through the owning state store when a size refusal precedes mutation.
  • Allocate small-file buffers from the observed size while retaining bounded growth and the limit-plus-one overflow probe. Preserve current upstream registrations and the independent layout fixture.
  • The three test-only follow-ups record generation-child import/readiness phases, bounded stdout/stderr and exit state, and reap created children on failure. They separate unconditional oversized-file coverage from permission-dependent Windows symlink coverage, and align tray-probe fixture startup/readiness with production without changing the 10-second generation or 250ms maintenance bounds.

Verification

  • Current head: 23b4333ca39eb18b42d8dfe200820f0f583169ac, based on upstream dev 6da2774369aa32552e318e333902499683d053bc. Normal fast-forward from the previous 560e0f4c5f6b7af740c467886fb5f4f9fde2644a; the production source is unchanged by the three follow-ups.
  • Final changed-file contents on Linux, pinned Bun 1.4.3: generation suite 15 passed, reader suite 10 passed, layout/ratchet guards 28 passed. A simulated Windows symlink-denial control reported 8 passed / 2 skipped / 0 failed, with the oversized check still executed; the skips are the symlink case and the pre-existing Windows FIFO exclusion. This is fault injection, not native Windows execution.
  • bun run typecheck, bun run privacy:scan, bun run structure:check, the repository file-size ratchet and parent-relative git diff --check passed. The Linux tray suite reported 28 passes, but its native PowerShell branches do not execute on Linux; those are not claimed as native lifecycle coverage.
  • Historical feature validation: isolated candidate 0632248daecbcc0c88702292fddf019538fdd6a1 passed 570 tests across 20 reader/writer/state/journal/Cline/Aside/client-synchronization and boundary files. Its docs build passed for 569 pages and 79,369 links. Production source, scripts, structure, docs, GUI, skills and dependency-lock inputs are unchanged; the follow-up changes four test/fixture files. The intervening upstream version-only change passed version consistency and its single selected regression; nine unrelated cases were intentionally filtered.
  • Previous-head Windows 6/9 failed before generation children published readiness, and Windows 8/9 failed the tray fixture's maintenance-timing assertion. The old generation log omitted child output/exit evidence, so its startup cause remains unconfirmed. The current-head Cross-platform CI is being checked; no new-head Windows pass or resolution is claimed yet.
  • Full local suite and test:changed were not repeated under the repository's resource exception. Native macOS/Windows and GUI/application execution remain unrun locally. Independent review remains outstanding and this PR stays in draft.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Refuse oversized and non-regular managed configuration inputs, apply the same 4 MiB write bound before target mutation, and retain committed or uncertain snapshots.

Read small files into initialized size-proportional buffers while preserving growth and overflow probes. Preserve store-owned cleanup for unused snapshots and all current upstream test registrations.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 13, 2026
Drain bounded stdout and stderr from generation-race children, identify exits before readiness, and report per-child missing files and import phases. Reap owned children in a finally block when readiness or outcome collection fails.

Keep the 10-second readiness and child deadlines and the exact-one-callback generation assertions unchanged. Add real-child regressions for early exit, bounded capture, and cleanup. This records evidence for the Windows startup timeout; it does not claim that timeout is fixed.
Separate oversized-file rejection from final-symlink rejection. Probe file-symlink creation on Windows and mark only that test skipped for EPERM/EACCES; preserve other errors and execute the rejection check when creation succeeds.

The oversized assertion already preceded link creation, but an unavailable link privilege failed the combined test. Keep byte-boundary coverage unconditional and record actual symlink skips.

luvs01 commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Preserve child-startup evidence before classifying the Windows race timeout.

The Windows 6/9 failure is at codex-config-generation.test.ts:67,289, before the parent writes race-release. It therefore fails at child readiness, before the competing callbacks are released. waitForPaths lists both a.ready and b.ready even if only one is missing, never checks child exit/signal state, and throws before collectGuardRaceChild reads stdout/stderr. The existing log cannot tell an import error, an exited child, a pending import, or a ready-file write failure apart.

A different upstream Windows run passed the exact case in 1.72s; two other inspected Windows controls passed in 1.16s and 1.47s. Linux candidate and dev controls also pass. These comparisons do not establish an infrastructure-only cause or justify rerunning unchanged CI.

A local diagnostic follow-up now continuously captures bounded output tails, records config-import/readiness phases and each child's exit/signal and ready-file state, and reaps created children in finally. A real-child negative control confirmed that the original helper reports an already exited child as a generic ready-file timeout. The follow-up's generation suite passes 15/15, including early exit, bounded output and cleanup controls; layout/ratchet adds 28/28. The 10-second bounds and exact-one-callback assertions remain intact. This patch is still local and does not claim to fix the native Windows timeout; a diagnostic Windows execution is the remaining required evidence.

Separate local follow-ups for the other observed test boundaries.

  • Windows 8/9 also failed the tray-probe test at windows-tray.test.ts:615: BadgeOffline measured 350ms against the unchanged 250ms maintenance bound. Its fixture directly launched the badge probe before its first tray tick, whereas production initializes the reader and runs the initial tick before ordinary maintenance. The prepared fixture correction follows that launch order and waits for the actual child PID readiness signal instead of a fixed sleep. It retains the 250ms/reaping assertions. This is independent of the generation readiness failure; the native PowerShell paths remain unexecuted in this Linux environment.
  • The reader fixture's oversized assertion already runs before link creation. A denied-link control confirmed that EPERM fails the combined test afterward. The local follow-up separates the checks and skips only the symlink test when a Windows capability probe gets EPERM/EACCES; Linux gives 10/10, and simulated denial gives 8 pass/2 explicit skips, including the pre-existing FIFO exclusion. The byte-limit check still executes.

These changes remain local; no Windows result for the combined new candidate or resolution of the generation startup cause is claimed.

Carry the validated two-file fixture correction from a7b9af8. Perform production initialization and its initial launch tick before measuring maintenance, then wait for the actual child PID readiness signal instead of a fixed sleep. Retain the 250 ms maintenance bound, process reaping assertions, and delayed Online readiness coverage.

The production tray script and fixture dependencies are byte-identical to the source whose native Windows case passed. Local Linux checks do not execute the native PowerShell paths; new-head Windows CI remains required.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
lidge-jun added a commit that referenced this pull request Oct 13, 2026
Based on #7017 by @luvs01.

Co-authored-by: Epinephrine <27862058+luvs01@users.noreply.github.com>
@lidge-jun

Copy link
Copy Markdown
Owner

Thank you @luvs01! This landed through #7029 (squash d934632), which carries your two in-scope commits unchanged with your authorship and a Co-authored-by trailer.

I left out the two test-hardening commits (generation-child startup diagnostics and the Windows tray probe readiness change) only to keep the PR on one topic. They look useful, so please feel free to open them as a separate PR. Closing this one as superseded.

@lidge-jun lidge-jun closed this Oct 13, 2026
lidge-jun added a commit that referenced this pull request Oct 13, 2026
…ss (#7038)

* test(config): preserve generation child startup diagnostics

Drain bounded stdout and stderr from generation-race children, identify exits before readiness, and report per-child missing files and import phases. Reap owned children in a finally block when readiness or outcome collection fails.

Keep the 10-second readiness and child deadlines and the exact-one-callback generation assertions unchanged. Add real-child regressions for early exit, bounded capture, and cleanup. This records evidence for a startup timeout; it does not claim that timeout is fixed.

Reconstruct the test-only follow-up from #7017 on current dev.
Source-commit: 3e76357
Co-authored-by: Epinephrine <27862058+luvs01@users.noreply.github.com>

* test(windows): align tray probe readiness with production startup

Perform production initialization and its initial launch tick before measuring maintenance, then wait for the actual child PID readiness signal instead of a fixed sleep. Retain the 250 ms maintenance bound, process reaping assertions, and delayed Online readiness coverage.

Reconstruct the test-only follow-up from #7017 on current dev. Native Windows validation of this new candidate is still required; prior source-commit CI is not evidence for this candidate.
Source-commit: 23b4333
Co-authored-by: Epinephrine <27862058+luvs01@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Epinephrine <27862058+luvs01@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: bitkyc08-arch <bitkyc08@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants