Skip to content

improvement(workflow-code): lean agent path for source get, params and help, and typed Function results in JSON fields - #10335

Merged
waleedlatif1 merged 6 commits into
stagingfrom
improvement/workflow-code-lean-agent-path
Nov 23, 2026
Merged

waleedlatif1 merged 6 commits into
stagingfrom
improvement/workflow-code-lean-agent-path

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • workflows source get and workspaces source get no longer print the primer, which is already written atop .sim/AGENTS.md. The result names the guide and an editLoop (check, type-check, dry-run apply). --primer prints it (JSON primer field). Default result on a seeded workflow: 4,860 to 508 bytes; workspace: 6,898 to 626.
  • workflows source params <builder> prints a brief by default: an example call, required params with types, optional params by name, the gate, outputs. --full keeps the old output. Agent builder: 7,738 to 1,034 bytes (JSON). A legacy builder names its replacement (human_in_the_loop points to human).
  • Root sim --help for a detected coding agent drops the worked examples (5,573 to 4,619 bytes); the notes and sim cli search banner stay, and human help is unchanged.
  • JSON-splice safety: a Function's result.<field> is now typed by what its JavaScript certainly returns (also .slice/.concat on a known string or array), so a text field is stored quoted at compile and printed back as the bare reference instead of warning W_JSON_REF_UNTYPED and breaking the JSON at run time. Fields the compiler cannot type still warn. The runtime splice is unchanged: a bare token outside a string is spliced raw on purpose (a string holding JSON text nests as JSON), and the text is not valid JSON until the splice, so the resolver cannot tell where to encode.

Type of Change

  • Improvement

Testing

  • workflow-code: json-fields and print round-trip tests fail on the pre-change json-fields.ts (6 red) and pass with it.
  • sim-cli: get tests (default omits the primer and names the loop; --primer restores it), params tests (brief default, --full, legacy replacement), agent help test.
  • Local gate: lint, type-check, check:audits, check:migrations, goldens, docs compatibility, unit and integration suites. The realtime file-doc-capabilities afterAll timeout fails the same way on pristine staging.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…d help, and typed Function results in JSON fields
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 23, 2026 2:56pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 27 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR shortens CLI output and uses known Function return types to quote references in JSON fields.

  • Workflow and workspace gets show an edit loop instead of repeating the primer.
  • Builder parameter lookups show a short brief with an option for full details.
  • Detected coding agents see root help without the worked examples.
  • Function text results are recognized when workflow code builds JSON fields.

All three previous threads are addressed: receiver checks reject the reported custom methods and shadowed built-ins, brief builder output retains core signatures, and strict array checks now recognize the reported split and map chains. No new actionable issues were found.

Reviews (6) · Last reviewed commit: "fix(workflow-code): prove an array throu..." · Reviewed by Greptile

…nd built-ins the code proves, and keep the core signature in the brief params
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 27 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

…d reject a shadowed Object in array inference
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 27 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

4 issues found across 27 files

Confidence score: 3/5

  • isArray in function-returns.ts treats any .map() call as array-producing, even when the receiver is a custom object. That can leave a bare JSON reference able to splice raw text; check the receiver before classifying the result.
  • isBuiltin in function-returns.ts misses NUMBER_FUNCTIONS, BOOLEAN_FUNCTIONS, and Math, so shadowed or imported names like parseInt and isNaN can be inferred as numeric built-ins. Extend the guard to cover these names.
  • The receiver-kind guard in function-returns.ts rejects String and Boolean calls to toLocaleString(), leaving their text results untyped and allowing a bare JSON reference to splice raw text. Accept these known receiver kinds.
  • The guard in function-returns.ts also rejects new Date().toString(), leaving the text result untyped and allowing a bare JSON reference to splice raw text. Accept receivers proven by isDate.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/workflow-code/src/compile/function-returns.ts">

<violation number="1" location="packages/workflow-code/src/compile/function-returns.ts:282">
P2: The new `isBuiltin` guard covers `String` and `STATIC_KINDS` but not `NUMBER_FUNCTIONS`, `BOOLEAN_FUNCTIONS`, or `Math` in the same `call()` method. A local or imported `parseInt`/`isNaN`/`Math` still infers a number or boolean kind. Apply the same `isBuiltin` check to these names.</violation>

<violation number="2" location="packages/workflow-code/src/compile/function-returns.ts:298">
P2: `isArray` treats every call named `.map()` as array-producing without checking its receiver, so `({ map: () => 'text' }).map().slice(0)` is classified `typed`. That bare JSON reference can splice raw text and produce invalid JSON; require a proven array receiver before using this result.</violation>

<violation number="3" location="packages/workflow-code/src/compile/function-returns.ts:318">
P2: `new Date().toString()` returns text, but this guard excludes it even though `isDate` proves the built-in receiver. It now remains untyped and can leave a bare JSON reference; accept `this.isDate(receiver)`.</violation>

<violation number="4" location="packages/workflow-code/src/compile/function-returns.ts:322">
P2: `String.prototype.toLocaleString()` and `Boolean.prototype.toLocaleString()` return text, but this guard rejects their known receiver kinds. The result stays untyped, so a bare JSON reference can splice raw text; include `string` and `boolean`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 27 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 27 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 05c8216 into staging Nov 23, 2026
87 checks passed

This branch was previously deployed

1 inactive deployment
Preview — d9c0658b Deployed Nov 23, 2026 by vercel[bot]
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