Skip to content

Runtime autonomy release-candidate branch#5

Open
ProfRandom92 wants to merge 9 commits into
fusion/ctxt-runtime-onlyfrom
experiment/runtime-autonomy
Open

Runtime autonomy release-candidate branch#5
ProfRandom92 wants to merge 9 commits into
fusion/ctxt-runtime-onlyfrom
experiment/runtime-autonomy

Conversation

@ProfRandom92

Copy link
Copy Markdown
Owner

Summary

This draft PR isolates the runtime-autonomy release-candidate work on top of fusion/ctxt-runtime-only.

It adds deterministic runtime-contract coverage and release-readiness hardening without enabling provider calls, network behavior, external agent execution, production MCP support, or crates.io publishing.

Changes

  • Align DSL validation to the local-fixture-v1 subset.
  • Add deterministic validation matrix documentation.
  • Add encode JSON shape smoke coverage.
  • Add clean trace heuristic smoke coverage.
  • Clean up release-readiness blockers:
    • clippy warning
    • Cargo package metadata
    • package exclusions for local-only artifacts
    • README MCP wording
  • Align RELEASE_NOTES_v0.1.0.md with the current local runtime scope.

Boundaries

  • No crates.io publish.
  • No production MCP support claim.
  • No full MCP compliance claim.
  • No provider gateway.
  • No network runtime.
  • No external agent execution.
  • No proposal/review auto-apply.

Local validation

Local validation passed:

  • cargo fmt --check
  • cargo check
  • cargo test
  • cargo clippy -- -D warnings
  • cargo package --list --allow-dirty
  • cargo test --release

Observed local timing:

  • cargo test --release: 36.15s
  • cargo clippy -- -D warnings: 2.73s

Review intent

Draft/experiment PR for visibility and review only.
Do not merge into main directly.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refines the local-first runtime contract of the ctxt CLI. It updates the DSL validator to reject legacy executable blocks (such as tools and tasks) while adding support for local-only syntax, updates documentation with a deterministic validation matrix, and introduces several smoke tests. The review feedback highlights two valuable improvement opportunities in src/runtime.rs: using strip_prefix instead of trim_start_matches to avoid repeatedly stripping prefixes, and optimizing the legacy block check to prevent unnecessary string allocations by performing case-insensitive checks in-place.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/runtime.rs
Comment on lines +548 to +551
fn valid_use_directive(line: &str) -> bool {
let name = line.trim_start_matches("use:");
valid_identifier_body(name)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using trim_start_matches with a string literal prefix like "use:" can be error-prone and misleading, as it repeatedly strips the prefix if it appears multiple times (e.g., "use:use:abc" becomes "abc").

To ensure the prefix is stripped exactly once and in a more idiomatic Rust fashion, use strip_prefix combined with map_or.

Suggested change
fn valid_use_directive(line: &str) -> bool {
let name = line.trim_start_matches("use:");
valid_identifier_body(name)
}
fn valid_use_directive(line: &str) -> bool {
line.strip_prefix("use:")
.map_or(false, valid_identifier_body)
}

Comment thread src/runtime.rs
Comment on lines +583 to +593
fn looks_like_block_legacy_semantic(line: &str) -> bool {
let lower = line.to_ascii_lowercase();
lower.starts_with("oauth")
|| lower.starts_with("provider")
|| lower.starts_with("shell ")
|| lower.starts_with("exec ")
|| lower.starts_with("run ")
|| lower.starts_with("http://")
|| lower.starts_with("https://")
|| lower.starts_with("resource://")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Calling to_ascii_lowercase() on every line during DSL validation allocates a new String each time, which introduces unnecessary memory overhead.

We can perform case-insensitive prefix checks without any allocations by using line.get(..prefix.len()) and eq_ignore_ascii_case.

fn looks_like_block_legacy_semantic(line: &str) -> bool {
    let starts_with_ignore_case = |prefix: &str| {
        line.get(..prefix.len())
            .map_or(false, |sub| sub.eq_ignore_ascii_case(prefix))
    };
    starts_with_ignore_case("oauth")
        || starts_with_ignore_case("provider")
        || starts_with_ignore_case("shell ")
        || starts_with_ignore_case("exec ")
        || starts_with_ignore_case("run ")
        || starts_with_ignore_case("http://")
        || starts_with_ignore_case("https://")
        || starts_with_ignore_case("resource://")
}

@ProfRandom92 ProfRandom92 marked this pull request as ready for review June 16, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant