# Launch the selected GCC frontend with isolated event and control pipes Task ID: T-GCC-LEAF-009 Role: astra_implementer Status: READY ## 1. Context and baseline Shared /home/faumaray/Projects/VoidLanguageServer feat/implement-roadmap, baseline ca04975. User D-030 approved isolated GCC16 prototype and versioned hooks. T-PLAN-GCC-008 and T-PREFLIGHT-GCC-008 independently approved this launcher slice. Verified GCC 16.2 unmodified cc1plus at build/gcc-gate/unmodified/cc1plus; currently patched build under build/gcc-gate/compiler-build/gcc/. Root owns make and repository build files. ## 2. Objective and deliverables Implement the fixed-fixture private frontend leaf in C++ using VoidLibrary SHA/process-compatible FDs and OS limits. It must execute exactly the approved ELF bytes while providing distinct control, events and diagnostics streams. ## 3. Scope and non-goals Leaf process setup and dedicated test harness only. The supervisor launches its own trusted executable /proc/self/exe with a private --leaf mode and Void::Process. No production LSP hook, selecting tools from metadata, general-purpose flag forwarding, parent control/state machine or policy reconfiguration. ## 4. Files to inspect Read compiler-patches/gcc-16.2.0/0001-evaluator-events.patch, T-GCC-EVALUATOR-017 and T-PREFLIGHT-GCC-008 (wire), build/voidlibrary/current/include/Void/{System/{Types,Process},Crypto/Crypto}.hpp and generated src/System/Process.cpp; actual sibling source is read-only. See include/Void/LanguageServer/Support/RegularFile.hpp for Linux bounded regular capture. Source scratch receives the single reviewed fixture as input.cpp. ## 5. Write ownership and coordination Write scope: experiments/frontend/gcc-worker/Leaf.hpp; experiments/frontend/gcc-worker/Leaf.cpp; tests/native/GccLeaf.py These three paths are exclusively yours. Use own ignored build/gcc-leaf-tests for isolated artifacts and witness program. Root owns normal executable main, architecture and build registration. No sibling or shared build-tree edits, staging/commits, further agents or user messages. ## 6. Implementation or investigation approach Implement vls::gcc::run_leaf(std::filesystem::path compiler, std::string_view expected_sha256, std::string_view nonce, bool stepping) returning 126 for setup failure, noreturn-by-exec on success; a diagnostic on stderr is bounded. Parent supplies cwd as private fixture directory. Consume stdin/control and stdout/events pipes from parent. dup to FD3 control, FD4 event before opening/moving checked compiler ELF to fd>=5, isolate compiler stdin/stdout on /dev/null, preserve stderr. Restrict raw FD and environment leakage. Validate pipes/nonce/SHA and regular binary. Bind digest to immutable bytes even if a developer recompiles in place (e.g. copy checked file into sealed memfd, verify SHA actual transferred bytes, set write/grow/shrink/seal and execveat AT_EMPTY_PATH). Report unsupported kernels/permissions explicitly. Preserve ELF loader semantics. On Linux, impose real RLIMIT_AS, RLIMIT_CPU, RLIMIT_CORE, bounded output/descriptor setup; avoid applying a file-size limit before copying the compiler. Spawn no shell/wrapper. FD and signal lifetime must be verifiable; failure never invokes a different binary. ## 7. Interfaces and data contracts Fixed compiler args: -quiet -std=c++26 -freflection -fsyntax-only -nostdinc -o /dev/null -fvls-observe, optionally -fvls-step, then input.cpp. C locale, empty PATH, VLS_GCC_NONCE exactly 32 lower-case hexadecimal, own explicit env only. No compiler flags, paths or shell spelling from project settings. Compiler protocol uses fd3/4. The SHA-256 (64 lower-case hex) is selected explicitly by trusted prototype parent; no implicit path-based trust. Keep worker and VLS project license deferred as authorized. ## 8. Dependencies and integration Root supplies main's --leaf mode + parent under disjoint paths. A direct private harness main in your ignored build can call run_leaf (report how). Root will integrate source and real cc1plus. Coordinate expected exit statuses for setup errors, wait/cancel and limits. Dedicated debugger worker is opt-in standalone, never advertise operations to LSP during this slice. ## 9. Edge cases security and performance Address fd3/4 collisions, CLOEXEC, files replaced while being read, non-ELF/script/nonregular input, inherited environment, empty/damaged digest, oversize compiler, symlinks and kernel refusing executable memfd. Use measured hard bounds allowing ~100MB test compiler. Avoid reading source bytes or home data in launcher. Parent owns subreaper/group cleanup; process-local error unwinding should release temporary descriptors. Bounded diagnostic text. ## 10. Acceptance criteria Run a real harmless compiled witness that verifies child FD3/control and FD4/event, raw stdout isolated and separate stderr. Verify exact args/nonce and parent env exclusion. Wrong SHA, nonregular/script, corrupted/truncated candidate, invalid nonce and FD setup must exit before execution. Test binary identity if named path replaced, verify AS/CPU/CORE limits. With private real cc1plus if ready, execute a hello and known fixture controls. Never use a mock to claim the real frontend ran. ## 11. Verification commands and evidence Use git status --short --branch, dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only experiments/frontend/gcc-worker/Leaf.cpp. Build standalone harness under build/gcc-leaf-tests and run python3 tests/native/GccLeaf.py using that harness. Run clang-format --dry-run --Werror (dev cpp) on your C++ files. Report actual results and returned signals/status. ## 12. Constraints and stop conditions After two unsuccessful attempts with the same diagnosis return exact errors and a changed hypothesis to root. Stop for need to change subprocess authority, prototype license or global machine limits. Do not make an unverified fallback to pathname exec. ## 13. Authorization and decisions User D-030 authorizes this local leaf and prototype. GPT-6.2 Astra Max. Independent reviewer approved launcher with explicit immutable execution and fd-before-open amendments. ## 14. Return format T-GCC-LEAF-009 DONE/PARTIAL/BLOCKED, paths, API/witnesses, exact limits, commands and results, real-vs-harness evidence and root wiring.