Skip to content

feat: add non-interactive prism exec - #31

Merged
ygpark80 merged 1 commit into
mainfrom
feat/prism-exec
Aug 26, 2026
Merged

feat: add non-interactive prism exec#31
ygpark80 merged 1 commit into
mainfrom
feat/prism-exec

Conversation

@ygpark80

@ygpark80 ygpark80 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add prism exec with chat, completions, responses, and messages API mappings for shell and CI requests.
  • Support stdin or file JSON bodies, model/provider overrides, JSON/text/stream-json output, and stable exit codes.
  • Preserve long-running streams with connect/first-byte and idle timeout handling.
  • Document cvlt-backed CIRCLES_AUTH_TOKEN usage without embedding credentials.

Verification

  • go test -mod=vendor ./...
  • go test -mod=vendor -race ./...
  • go vet -mod=vendor ./...
  • Built CLI: profile-less real Prism Chat Completions and Responses stream-json requests succeeded.

Closes #30

@codeant-ai

codeant-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 22cfa8c Aug 26, 2026 · 11:41 11:44

@codeant-ai

codeant-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 919e952b-7d2c-4415-b933-f0c741672e19


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.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Aug 26, 2026
Comment thread internal/cli/run.go
Comment on lines +77 to +80
if hasOption(args[1:], "--help") || hasOption(args[1:], "-h") {
printExecHelp(stdout)
return nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The dispatch scans for help flags before parseExecOptions, so any invocation containing --help or -h bypasses validation and exits successfully. For example, prism exec --api chat --help --unknown prints help instead of returning the documented usage error. Parse the arguments first, or only short-circuit for a standalone help invocation. [incorrect condition logic]

Severity Level: Major ⚠️
- ❌ Malformed exec commands can exit successfully.
- ⚠️ CI scripts may skip expected usage-error handling.
- ⚠️ Unknown options are hidden by help output.

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** internal/cli/run.go
**Line:** 77:80
**Comment:**
	*Incorrect Condition Logic: The dispatch scans for help flags before `parseExecOptions`, so any invocation containing `--help` or `-h` bypasses validation and exits successfully. For example, `prism exec --api chat --help --unknown` prints help instead of returning the documented usage error. Parse the arguments first, or only short-circuit for a standalone help invocation.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread internal/cli/exec.go
return inferenceHTTPError(response)
}

payload, err := readResponseIdle(ctx, response.Body, api.InferenceIdleTimeout)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: stream-json does not actually stream output to stdout because the entire response is first accumulated by readResponseIdle and only then parsed and written. A long-lived SSE request therefore withholds already-received events until the server closes the connection, defeating the documented one-object-per-event behavior and causing unbounded memory usage for large streams. [api mismatch]

Severity Level: Critical 🚨
- ❌ stream-json consumers receive no incremental events.
- ⚠️ Long-running streams accumulate the entire response in memory.
- ❌ Large streams can exhaust the CLI process memory.

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** internal/cli/exec.go
**Line:** 140:140
**Comment:**
	*Api Mismatch: `stream-json` does not actually stream output to stdout because the entire response is first accumulated by `readResponseIdle` and only then parsed and written. A long-lived SSE request therefore withholds already-received events until the server closes the connection, defeating the documented one-object-per-event behavior and causing unbounded memory usage for large streams.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread internal/cli/exec.go
Comment on lines +372 to +375
results <- result{data: chunk}
}
if err != nil {
results <- result{err: err}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The response reader goroutine can leak after cancellation or an idle timeout. If the result channel already contains one chunk, the goroutine can block forever sending the next chunk or its final error after the caller returns; closing the response body does not unblock that channel send. Use a cancellation-aware send or otherwise wait for the reader goroutine to terminate before returning. [resource leak]

Severity Level: Major ⚠️
- ⚠️ Interrupted SSE executions can leak reader goroutines.
- ⚠️ Repeated stream cancellations increase process resource usage.
- ❌ Long-running CLI automation can eventually become unstable.

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** internal/cli/exec.go
**Line:** 372:375
**Comment:**
	*Resource Leak: The response reader goroutine can leak after cancellation or an idle timeout. If the result channel already contains one chunk, the goroutine can block forever sending the next chunk or its final error after the caller returns; closing the response body does not unblock that channel send. Use a cancellation-aware send or otherwise wait for the reader goroutine to terminate before returning.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@ygpark80
ygpark80 merged commit e878096 into main Aug 26, 2026
1 check passed
@ygpark80
ygpark80 deleted the feat/prism-exec branch August 26, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add prism exec for non-interactive API calls

1 participant