Sync v0.0.1-rc.9 release to main - #7
Conversation
- Updated node capacity checks to use dynamic values from the VM structure instead of fixed constants. - Enhanced memory allocation for nodes, attributes, and children to utilize VM's capacity settings. - Introduced a tooling runtime profile that allocates larger capacities for nodes and bytes arenas. - Added new opcode for value kind classification and integrated it into the VM execution flow. - Implemented tests for tooling profile behavior, ensuring correct allocation and memory management. - Adjusted garbage collection policies to prevent unnecessary compaction under observational pressure. - Improved diagnostics and exit handling in the CLI and WASM runner examples. - Added integration tests for process exit lifecycle and ensured proper exit codes are returned.
- Added string interning support to improve memory efficiency for repeated string values. - Introduced AivmNodeBuilder for constructing nodes with attributes and children. - Updated runtime profile limits to include string arena capacity for tooling. - Enhanced memory management in the VM to accommodate new string and node builder features. - Added tests to validate string interning and node builder operations, ensuring correct behavior and memory management. - Updated opcode definitions to include new operations related to node builders.
- Added a new map data structure to the VM, allowing for string-to-int mappings. - Implemented operations for creating and manipulating maps, including: - `MAP_BUILDER_NEW`: Create a new map builder. - `MAP_BUILDER_PUT_STRING_INT`: Insert a key-value pair into the map. - `MAP_BUILDER_FINISH`: Finalize the map and make it immutable. - `MAP_COUNT`: Retrieve the number of entries in the map. - `MAP_HAS_STRING`: Check for the existence of a key in the map. - `MAP_GET_STRING_INT_OR`: Retrieve a value by key with a fallback option. - Updated the VM's internal structures to support map records and operations. - Enhanced memory management for map growth and ensured safe point collection during operations. - Added unit tests for map functionality and performance benchmarks for new opcodes.
…er and update test for output verification
- Introduced dynamic allocation for program constants in `aivm_program_constants.c`. - Updated `AivmProgram` structure to include `allocated_constant_storage` and `constant_capacity`. - Modified constant handling in `aivm_program.c` to utilize new dynamic storage. - Enhanced error reporting for memory allocation failures in program loading. - Added new error codes for memory allocation issues in `RESOURCE_LIMITS.md`. - Implemented unit tests for dynamic constants in `test_dynamic_constants.c`. - Adjusted existing tests to accommodate changes in constant management.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 479319ef43
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| group->batch_bytes = (uint8_t*)malloc(batch.bytes_value.length); | ||
| group->payload_offsets = (size_t*)calloc(payload_count, sizeof(size_t)); | ||
| group->payload_lengths = (size_t*)calloc(payload_count, sizeof(size_t)); | ||
| group->task_handles = (int64_t*)calloc(payload_count, sizeof(int64_t)); |
There was a problem hiding this comment.
Bound logical tasks before allocating batch metadata
Reject batches that exceed a profile-controlled logical-task and input-byte ceiling before these allocations. A valid batch may consist entirely of four-byte zero-length frames, so the 16 MiB tooling arena can produce roughly 4.2 million entries and allocate about 96 MiB across these three arrays; up to 256 such workload groups can be accepted while only the first window is materialized. This bypasses the intended bounded worker accounting and makes host OOM behavior depend on available memory rather than deterministic admission.
AGENTS.md reference: AGENTS.md:L34-L34
Useful? React with 👍 / 👎.
| result |= include_capability(worker_mask, | ||
| AIVM_WORKER_CAPABILITY_FILESYSTEM, AIVM_SYSCALL_CAPABILITY_FILESYSTEM); |
There was a problem hiding this comment.
Isolate filesystem host state before granting worker access
Do not grant concurrent worker invocations filesystem capability until the CLI filesystem binding is made per-invocation or synchronized. Workers run on multiple scheduler threads, but airun_fs_host.inc shares g_native_file_bytes_scratch, its capacity, and the file-handle table globally without locking; two filesystem-capable workers can concurrently overwrite or realloc the scratch buffer while materialize_syscall_result copies from it, causing nondeterministic bytes, data races, or use-after-free.
AGENTS.md reference: AGENTS.md:L34-L35
Useful? React with 👍 / 👎.
| if ((ch >= (unsigned char)'a' && ch <= (unsigned char)'z') || | ||
| (ch >= (unsigned char)'A' && ch <= (unsigned char)'Z') || | ||
| (ch >= (unsigned char)'0' && ch <= (unsigned char)'9') || | ||
| ch == (unsigned char)'.' || |
There was a problem hiding this comment.
Reject traversal app IDs in local storage
Reject . and .. as sanitized app IDs rather than preserving them. For example, sys.storage.local.set("..", "key", value) constructs .../storage/local/../key.txt, escaping the per-app local/<app-id> directory and allowing that caller to read, overwrite, or delete files in the parent storage namespace.
Useful? React with 👍 / 👎.
| result |= include_capability(worker_mask, | ||
| AIVM_WORKER_CAPABILITY_ENVIRONMENT, AIVM_SYSCALL_CAPABILITY_HOST); |
There was a problem hiding this comment.
Map the environment worker bit to environment syscalls
Map AIVM_WORKER_CAPABILITY_ENVIRONMENT to the capability used by environment targets instead of HOST. The only HOST contract is sys.host.openDefault, while sys.process.env.get and sys.process.cwd are classified as PROCESS; consequently, a worker declaring only the environment bit is denied the environment calls it requested and is unexpectedly authorized for opening host-default handlers.
Useful? React with 👍 / 👎.
Syncs the corrected bounded worker task runtime release from develop to main. Validated locally with all 35 AiVM tests, syscall contract checks, worker scheduler/runtime/task tests, storage traversal coverage, performance smoke tests, the shared core-source manifest, hardened descriptor-based recursive deletion, and complete WebAssembly parity. Published tag: v0.0.1-rc.9.