feat(code,evals): GLM-5.2 harness profile - #4710
Merged
Merged
Conversation
make_graph (the create_cli_agent / dcode CLI-harness path) previously passed a hardcoded system_prompt override, so the Harbor eval never exercised the dcode production system prompt we ship. Stop overriding it; create_cli_agent now builds the real headless dcode prompt via get_system_prompt(interactive=False, cwd=...).
Also stop passing sandbox_type="harbor": with the override gone, get_system_prompt routes through get_default_working_dir("harbor"), which raises ValueError because "harbor" is not a registered dcode sandbox provider. sandbox=None means local mode, so the local-mode prompt rooted at cwd is correct.
Wire configurable.model into the prompt's Model Identity section by populating the dcode settings singleton (model_name/provider/context_limit/unsupported_modalities) from the model spec + profile, mirroring create_model. Add an autouse fixture to snapshot/restore those settings so the process singleton does not leak across tests.
The override installed a single package spec, so a run could not pin both harbor core and the harbor-langsmith plugin from a git branch at once. Parse the input as newline-separated specs and install them together in one `uv pip install`, so the plugin's `harbor` dependency binds to the core git reference given here instead of resolving from PyPI. Value is still passed via env and never interpolated into the shell; specs are split on newlines (not whitespace, since PEP 508 name @ url contains spaces) and passed as separate args. Backward compatible: a single-line value is one spec.
make_graph now injects model_kwargs={'reasoning_effort':'high'} for GLM-5.2 Fireworks models (provider default is 'max'), using the Fireworks nested-model_kwargs shape from dcode reasoning_effort. Gated on the model spec so the shared harness is unaffected for other models; an explicit configurable.model_kwargs reasoning_effort still wins.
Match the profile branch: GLM-5.2 runs use reasoning_effort=max (high underperformed on terminal-bench; the 2x agent timeout removes the need to trade reasoning depth for speed).
Split terminal-stall recovery out of the read_file media guard into a standalone `_GlmTerminalStallRecovery` middleware, wired per headless stack next to the guard so it stays runtime-model-aware under `/model` switches instead of being injected via the harness profile (which resolves once at build time from the construction model). - Detect stalls via `finish_reason == "length"` rather than an exact output token count, so a changed provider cap still triggers recovery. - Register the dcode profile explicitly from `create_cli_agent` with a collision guard that defers to any pre-existing suffix profile. - Drop the internal `glm_5p2` identifier from the prompt tag names. - Trim the prompt test to a conciseness/omission check instead of brittle exact-phrase and tag matching.
Nick Hollon (nick-hollon-lc)
requested a review
from Mason Daugherty (mdrxy)
as a code owner
July 14, 2026 03:05
The registration collision guard defers a spec to a pre-existing suffix profile (user override or built-in), but the media guard's runtime suffix transition still gated on model identity, so it appended the dcode suffix on top of the override's baked suffix — the override could not actually win. Gate the suffix transition on registry ownership: only manage the dcode suffix for a spec whose registered suffix is the dcode one. `read_file` media gating stays on model identity, since a text-only model cannot consume media regardless of which profile owns the prompt.
…e-v3 # Conflicts: # .github/workflows/harbor.yml # libs/code/deepagents_code/agent.py
…e-v3 # Conflicts: # .github/workflows/_harbor_run.yml # libs/code/tests/unit_tests/test_agent.py # libs/evals/deepagents_harbor/langgraph_project/langgraph_agent.py
…e-v3 # Conflicts: # libs/code/deepagents_code/agent.py
Nick Hollon (nick-hollon-lc)
temporarily deployed
to
evals
July 21, 2026 21:00 — with
GitHub Actions
Inactive
Nick Hollon (nick-hollon-lc)
temporarily deployed
to
evals
July 21, 2026 21:00 — with
GitHub Actions
Inactive
Nick Hollon (nick-hollon-lc)
had a problem deploying
to
evals
July 21, 2026 21:00 — with
GitHub Actions
Failure
Nick Hollon (nick-hollon-lc)
temporarily deployed
to
evals
July 21, 2026 21:03 — with
GitHub Actions
Inactive
Nick Hollon (nick-hollon-lc)
temporarily deployed
to
evals
July 21, 2026 21:03 — with
GitHub Actions
Inactive
Nick Hollon (nick-hollon-lc)
temporarily deployed
to
evals
July 21, 2026 21:04 — with
GitHub Actions
Inactive
Mason Daugherty (mdrxy)
pushed a commit
that referenced
this pull request
Jul 22, 2026
> [!CAUTION] > Merging this PR will automatically publish to **PyPI** and create a **GitHub release**. For the full release process, see [`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md). --- _Release notes preview: keep this section in sync with the package `CHANGELOG.md`. The published GitHub release body is extracted from the merged `CHANGELOG.md` by `release.yml`, not from this PR description._ --- ## [0.1.45](deepagents-code==0.1.44...deepagents-code==0.1.45) (2026-07-22) ### Features - Added the Hooks v2 execution engine and typed hooks data models ([#4880](#4880), [#4870](#4870)) - Added a filesystem tool allowlist for `dcode` with `--allow-fs-tools` ([#4635](#4635)) - Added a GLM-5.2 harness profile ([#4710](#4710)) - Added a built-in thread inspector skill ([#4769](#4769)) - Replaced Gemini 3.5 Flash with Gemini 3.6 Flash in the model switcher ([#4890](#4890)) - Show experimental mode in the splash screen and debug console ([#4863](#4863)) - Gate debug console click-to-copy behind a checkbox ([#4810](#4810)) ### Bug Fixes - Improved scratch-file handling by allowing cleanup of agent-created scratch files and safe OS-temp scratch artifacts ([#4860](#4860), [#4869](#4869)) - Skip grading during `/goal` proposals ([#4941](#4941)) - Improved MCP approval handling: Esc now aborts project MCP approval, disabled MCP servers are honored for plugins, remembered approvals are preserved with the env allowlist, and approvals are shared across Git worktrees ([#4888](#4888), [#4848](#4848), [#4889](#4889), [#4939](#4939)) - Hardened installer downloads and paths ([#4871](#4871)) - Fixed forced `dcode update` checks to bust the CDN cache ([#4862](#4862)) - Prevented failed exit setup from stranding the app ([#4913](#4913)) - Fixed routing so `ctrl+x` goes to the focused `ask_user` input ([#4926](#4926)) - Show `-m` prompts as queued immediately on startup ([#4861](#4861)) - Kept harness-profile diagnostics out of terminal output ([#4943](#4943)) - Avoid tracking inline restart callers ([#4894](#4894)) - Fixed debug console thread ID copying on click ([#4945](#4945)) ### Performance Improvements - Reduced exit latency by coordinating async shutdown teardown ([#4831](#4831)) - Sped up local context detection ([#4922](#4922)) _End release notes preview._ --- > [!NOTE] > A **New Contributors** section is appended to the GitHub release notes automatically at publish time (see [Release Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline), step 2). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
Marcelo5444
pushed a commit
to Marcelo5444/deepagents
that referenced
this pull request
Jul 30, 2026
Deep Agents Code now applies focused execution guidance when an agent is built with GLM-5.2 on Fireworks, OpenRouter, or Baseten. The guidance encourages earlier artifact creation, exact source preservation, and result-based verification. Headless Fireworks runs also get one bounded recovery attempt when GLM-5.2 reaches its output limit without calling a tool. --- Terminal-Bench exposed a recurring GLM-5.2 failure mode: the model could spend an entire response planning or explaining, reach its output limit without calling a tool, and leave no deliverable. The same runs showed weaker discipline around exact-output tasks, including changing source material beyond the requested transformation, treating a successful command as proof of correctness, and delaying artifact creation until too late in the run. This PR addresses those model-specific behaviors without changing the default prompt or runtime behavior for other models. ## GLM-5.2 execution profile Dcode registers a prompt suffix for the exact GLM-5.2 model specs exposed through Fireworks, OpenRouter, and Baseten. Registration is scoped to dcode rather than added as a global SDK default. If a user-provided or future built-in profile already owns the prompt suffix for one of those specs, dcode leaves it unchanged. The suffix asks GLM-5.2 to: - identify every required output path and translate exact, ordered, ranged, and prohibited requirements into a short checklist; - create a valid artifact early, keep it valid while refining it, and reserve the end of the run for verification; - use the exact requested source, version, tokenizer, date, or revision rather than relying on memory or a nearby substitute; - preserve source-of-truth input except for transformations the task explicitly requests; - verify the actual result, including boundary, negative, and cleanup behavior, rather than treating exit code 0 as sufficient; - preserve correctness and input bytes before optimizing, then compare repeated measurements with enough margin for noise; - keep unsupported media out of this text-only model's context by extracting needed text, metadata, or frames with a shell utility or script instead of calling `read_file` on images, PDFs, audio, or video; - retry an unavailable command once after correcting it, then change approaches instead of repeating the same failure; and - stop when the requested artifacts and assertions are complete instead of adding speculative work. The suffix is selected when the agent graph is assembled. It contains guidance only; it does not filter `read_file` tool results at runtime. ## Headless terminal-stall recovery Non-interactive dcode stacks install a recovery middleware that checks the effective model on each call. For the exact Fireworks GLM-5.2 endpoint, a response that ends with `finish_reason="length"` and no tool call is retried once with reasoning disabled, a forced tool choice, and a short instruction to create the smallest valid artifact and run one discriminating check. Recovery is deliberately limited to one retry and to the measured Fireworks endpoint. It does not activate for interactive sessions, OpenRouter, Baseten, structured responses, or responses that already contain a tool call. Dcode installs it on the main agent and the declarative subagents it builds for headless execution. ## Benchmark harness fidelity The Harbor graph now constructs the production headless dcode prompt instead of replacing it with a benchmark-only prompt. It populates the prompt's model identity, context limit, and unsupported-modality fields from the selected model, disables `ask_user` because Harbor has no resume loop, and defaults the exact GLM-5.2 specs to high reasoning effort unless the caller supplies a provider-native override. Harbor session IDs are normalized to dcode's filesystem-safe 64-character assistant ID limit. A hash of the original ID preserves disambiguation when two trial IDs normalize to the same text or share a long prefix. The reusable Harbor workflow also accepts multiple newline-separated package overrides and installs them in one `uv` resolution. This allows an evaluation to pin Harbor core and `harbor-langsmith` to the same branch so the plugin resolves against that checkout instead of the PyPI release. --------- Co-authored-by: Mason Daugherty <github@mdrxy.com> Co-authored-by: Mason Daugherty <mason@langchain.dev>
Marcelo5444
pushed a commit
to Marcelo5444/deepagents
that referenced
this pull request
Jul 30, 2026
> [!CAUTION] > Merging this PR will automatically publish to **PyPI** and create a **GitHub release**. For the full release process, see [`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md). --- _Release notes preview: keep this section in sync with the package `CHANGELOG.md`. The published GitHub release body is extracted from the merged `CHANGELOG.md` by `release.yml`, not from this PR description._ --- ## [0.1.45](langchain-ai/deepagents@deepagents-code==0.1.44...deepagents-code==0.1.45) (2026-07-22) ### Features - Added the Hooks v2 execution engine and typed hooks data models ([langchain-ai#4880](langchain-ai#4880), [langchain-ai#4870](langchain-ai#4870)) - Added a filesystem tool allowlist for `dcode` with `--allow-fs-tools` ([langchain-ai#4635](langchain-ai#4635)) - Added a GLM-5.2 harness profile ([langchain-ai#4710](langchain-ai#4710)) - Added a built-in thread inspector skill ([langchain-ai#4769](langchain-ai#4769)) - Replaced Gemini 3.5 Flash with Gemini 3.6 Flash in the model switcher ([langchain-ai#4890](langchain-ai#4890)) - Show experimental mode in the splash screen and debug console ([langchain-ai#4863](langchain-ai#4863)) - Gate debug console click-to-copy behind a checkbox ([langchain-ai#4810](langchain-ai#4810)) ### Bug Fixes - Improved scratch-file handling by allowing cleanup of agent-created scratch files and safe OS-temp scratch artifacts ([langchain-ai#4860](langchain-ai#4860), [langchain-ai#4869](langchain-ai#4869)) - Skip grading during `/goal` proposals ([langchain-ai#4941](langchain-ai#4941)) - Improved MCP approval handling: Esc now aborts project MCP approval, disabled MCP servers are honored for plugins, remembered approvals are preserved with the env allowlist, and approvals are shared across Git worktrees ([langchain-ai#4888](langchain-ai#4888), [langchain-ai#4848](langchain-ai#4848), [langchain-ai#4889](langchain-ai#4889), [langchain-ai#4939](langchain-ai#4939)) - Hardened installer downloads and paths ([langchain-ai#4871](langchain-ai#4871)) - Fixed forced `dcode update` checks to bust the CDN cache ([langchain-ai#4862](langchain-ai#4862)) - Prevented failed exit setup from stranding the app ([langchain-ai#4913](langchain-ai#4913)) - Fixed routing so `ctrl+x` goes to the focused `ask_user` input ([langchain-ai#4926](langchain-ai#4926)) - Show `-m` prompts as queued immediately on startup ([langchain-ai#4861](langchain-ai#4861)) - Kept harness-profile diagnostics out of terminal output ([langchain-ai#4943](langchain-ai#4943)) - Avoid tracking inline restart callers ([langchain-ai#4894](langchain-ai#4894)) - Fixed debug console thread ID copying on click ([langchain-ai#4945](langchain-ai#4945)) ### Performance Improvements - Reduced exit latency by coordinating async shutdown teardown ([langchain-ai#4831](langchain-ai#4831)) - Sped up local context detection ([langchain-ai#4922](langchain-ai#4922)) _End release notes preview._ --- > [!NOTE] > A **New Contributors** section is appended to the GitHub release notes automatically at publish time (see [Release Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline), step 2). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deep Agents Code now applies focused execution guidance when an agent is built with GLM-5.2 on Fireworks, OpenRouter, or Baseten. The guidance encourages earlier artifact creation, exact source preservation, and result-based verification. Headless Fireworks runs also get one bounded recovery attempt when GLM-5.2 reaches its output limit without calling a tool.
Terminal-Bench exposed a recurring GLM-5.2 failure mode: the model could spend an entire response planning or explaining, reach its output limit without calling a tool, and leave no deliverable. The same runs showed weaker discipline around exact-output tasks, including changing source material beyond the requested transformation, treating a successful command as proof of correctness, and delaying artifact creation until too late in the run.
This PR addresses those model-specific behaviors without changing the default prompt or runtime behavior for other models.
GLM-5.2 execution profile
Dcode registers a prompt suffix for the exact GLM-5.2 model specs exposed through Fireworks, OpenRouter, and Baseten. Registration is scoped to dcode rather than added as a global SDK default. If a user-provided or future built-in profile already owns the prompt suffix for one of those specs, dcode leaves it unchanged.
The suffix asks GLM-5.2 to:
read_fileon images, PDFs, audio, or video;The suffix is selected when the agent graph is assembled. It contains guidance only; it does not filter
read_filetool results at runtime.Headless terminal-stall recovery
Non-interactive dcode stacks install a recovery middleware that checks the effective model on each call. For the exact Fireworks GLM-5.2 endpoint, a response that ends with
finish_reason="length"and no tool call is retried once with reasoning disabled, a forced tool choice, and a short instruction to create the smallest valid artifact and run one discriminating check.Recovery is deliberately limited to one retry and to the measured Fireworks endpoint. It does not activate for interactive sessions, OpenRouter, Baseten, structured responses, or responses that already contain a tool call. Dcode installs it on the main agent and the declarative subagents it builds for headless execution.
Benchmark harness fidelity
The Harbor graph now constructs the production headless dcode prompt instead of replacing it with a benchmark-only prompt. It populates the prompt's model identity, context limit, and unsupported-modality fields from the selected model, disables
ask_userbecause Harbor has no resume loop, and defaults the exact GLM-5.2 specs to high reasoning effort unless the caller supplies a provider-native override.Harbor session IDs are normalized to dcode's filesystem-safe 64-character assistant ID limit. A hash of the original ID preserves disambiguation when two trial IDs normalize to the same text or share a long prefix.
The reusable Harbor workflow also accepts multiple newline-separated package overrides and installs them in one
uvresolution. This allows an evaluation to pin Harbor core andharbor-langsmithto the same branch so the plugin resolves against that checkout instead of the PyPI release.