compile_actor() drops graph-level system_prompt — not threaded into CompiledActor #6
Closed
opened 2026-05-21 08:50:00 +00:00 by hurui200320
·
2 comments
No Branch/Tag Specified
Labels
Clear labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Needs Feedback
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
PR blocked by an open issue dependency. Operator must close the dep (or remove the dependency link) before the merge driver can act. Auto-cleared by merge_drive when no open deps remain.
Most recent merge cycle hit CI timeout. Driver excludes this PR while last merge_cycle row is < 30 min old; label persists thereafter as visible history.
Currently being processed by an implementer worker.
Currently being processed by the merge driver.
Currently being processed by a reviewer worker.
Merge driver heartbeat stale; pipeline halted. Closed automatically on next clean tick.
Detected master commit violating the strict merge invariant. Tracked as an issue (not a PR label); kept here for label completeness.
In-cycle escalation: most recent attempt ran at the Tier 0 slot (`tier-0`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 1 slot (`tier-1`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 2 slot (`tier-2`). Slot's model defined in .opencode/models/tiers.yaml. Gated behind IMPLEMENTER_ESCALATION_TIER2_ENABLED.
In-cycle escalation: most recent attempt ran at the Tier -1 slot (`tier-min`). Slot's model defined in .opencode/models/tiers.yaml. Suffix is ``-min`` (not ``--1``) so the Forgejo UI reads naturally.
Tracking issues used by the AI Automation system for agents to communicate and report.
Rebase conflict needs LLM conflict-resolver.
Failing CI needs implementer attention.
Documenting a driver incident or rollback.
Reviewer has APPROVED this PR and no later REQUEST_CHANGES is outstanding. The merge driver requires this label to even consider a PR for merging. Set by the reviewer worker on APPROVE; cleared on REQUEST_CHANGES.
Train repeatedly lost master-tempo races. Driver excludes via merge_cycle until cooldown elapses; label persists as visible history.
Revert PR backing out an invariant violation. Fast-tracked through the merge driver.
Sentinel PR duplicated from upstream into a personal fork by tools/duplicate_prs_to_fork.py for pipeline testing. Lives only in the fork; the canonical pipeline never sees it.
No implementer activity for N days. Flagged for human review. Auto-cleared on next push to head branch.
Repeatedly fails on current master (>= 3 ci-fail-on-rebased-sha releases in 12 h). Excluded from driver until human triage.
A ticket in a blocked state and unable to complete until some other task is completed first.
Bounty
$100
A bounty of $100 for any open-source contributor who provides a MR that solves this issue
Bounty
$1000
A bounty of $1000 for any open-source contributor who provides a MR that solves this issue
Bounty
$10000
A bounty of $10000 for any open-source contributor who provides a MR that solves this issue
Bounty
$20
A bounty of $20 for any open-source contributor who provides a MR that solves this issue
Bounty
$2000
A bounty of $2000 for any open-source contributor who provides a MR that solves this issue
Bounty
$250
A bounty of $250 for any open-source contributor who provides a MR that solves this issue
Bounty
$50
A bounty of $50 for any open-source contributor who provides a MR that solves this issue
Bounty
$500
A bounty of $500 for any open-source contributor who provides a MR that solves this issue
Bounty
$5000
A bounty of $5000 for any open-source contributor who provides a MR that solves this issue
Bounty
$750
A bounty of $750 for any open-source contributor who provides a MR that solves this issue
MoSCoW
Could have
Could have feature in order to satisfy the epic/legendary.
MoSCoW
Must have
Must have feature in order to satisfy the epic/legendary.
MoSCoW
Should have
Should have feature in order to satisfy the epic/legendary.
There are questions in the ticket that can not be completed until the project owner provides clarity.
Points
1
1 man-hours worth of work for an expert with no learning curve.
Points
13
13 man-hours worth of work for an expert with no learning curve.
Points
2
2 man-hours worth of work for an expert with no learning curve.
Points
21
21 man-hours worth of work for an expert with no learning curve.
Points
3
3 man-hours worth of work for an expert with no learning curve.
Points
34
34 man-hours worth of work for an expert with no learning curve.
Points
5
5 man-hours worth of work for an expert with no learning curve.
Points
55
55 man-hours worth of work for an expert with no learning curve.
Points
8
8 man-hours worth of work for an expert with no learning curve.
Points
88
88 man-hours worth of work for an expert with no learning curve.
Priority
Backlog
This ticket has backlogged priority and is not to be worked on yet
Priority
CI Blocker
Critical priority issue that blocks CI/CD pipeline and prevents PR merges
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
A ticket for learning a tool or technology that is needed to be able to do future planning and design.
State
Completed
The ticket has been fully implemented, completed, and merged with the source code. This label should only be applied once a ticket is closed.
State
Duplicate
A ticket that represents the same content as an existing ticket.
State
In Progress
A ticket that is actively being developed.
State
In Review
A ticket that has had some code completed to implement but is waiting to pass peer review and is not yet merged in.
State
Paused
This ticket's work started but wasn't finished. It's on hold (likely in a feature branch) and will be resumed later, either due to a blocker or a delay.
State
Unverified
All new tickets start in this state. A developer may set it to show the ticket is unverified. This means we haven't agreed to work on it. It will either move to a verified state or be closed as wontdo.
State
Verified
The issue has been verified by a developer as legitimate. It will be worked on and verified tickets are now considered part of the backlog.
State
Wont Do
This ticket has been decided it wont be done. This may mean the bug has been determined to not be real (cant verify) or the feature is one we have decided we dont want to adopt.
Type
Automation
Any edits or discussion about the AI automated coding system.
Type
Bug
Something that doesnt work as intended.
Type
Discussion
Anytime a ticket represents a discussion about a subject and doesnt fall into one of the other categories.
Type
Documentation
An error or improvement needed in the documentation.
Type
Epic
Any first tier epic. That is, an epic which contains only issues as children and will not have sub-epics.
Type
Feature
Some new functionality not present.
Type
Legendary
A type of Epic which will contain other Epics.
Type
Refactor
A code change that restructures existing code without changing its external behavior.
Type
Support
Someone needs help using the project.
Type
Task
A generic task that doesnt fit into the other type categories.
Type
Testing
Work exclusively focusing on fixing or expanding testing.
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
aditya (Aditya Chhabra)
aleenaumair (Aleena Umair)
brent.edwards (Brent Edwards)
CoreRasurae (Luis Mendes)
drew (Drew Morris)
eugen.thaci (Eugen Thaci)
freemo (Jeffrey Phillips Freeman)
HAL9000 (HAL 9000)
HAL9001 (HAL9001)
hamza.khyari (Hamza Khyari)
hurui200320 (Rui Hu)
justin.morris
khird (Kyle Hird)
org.cleveragents
Clear assignees
No Assignees
hurui200320
Notifications
Due Date
No due date set.
Blocks
Depends on
#77 Epic: LLM Agent Runtime Stabilization — reliability, resource enforcement & correctness hardening
cleveragents/cleveractors-core
#7 fix(compiler): thread actor-level system_prompt into graph node metadata
cleveragents/cleveractors-core
Reference: cleveragents/cleveractors-core#6
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
compile_actor()silently drops the actor-levelsystem_promptfield fortype: graphactors. TheCompiledActorcontains no trace of it, forcing host applications to keep the rawActorConfigSchemain scope alongside the compiled bundle as a workaround.Metadata
fix(compiler): thread actor-level system_prompt into graph node metadatafix/compiler-thread-system-promptDetails
What the spec says
docs/reference/actors_schema.md(line 92) explicitly documentssystem_promptas:The word "default" places it in the same category as
providerandmodel: actor-level fields that serve as fallback defaults for all AGENT nodes in the graph.What the code does
actor/compiler.py:_map_node()already implements the default-threading pattern forproviderandmodel:_map_node()is never givenactor_system_promptand never writes it tomerged_meta. Aftercompile_actor()returns,system_promptis inaccessible fromCompiledActor.Additionally,
Node._execute_agent()mergesstate.metadatainto the context dict that reachesagent.process_message(), but it never includesself.config.metadata.get("system_prompt"). Even after the threading fix is applied to the compiler, hosts cannot read the system prompt from withinprocess_message()unless this second gap is also addressed.Impact
type: graphactors with a top-levelsystem_promptsilently lose it after compilation. The compiled bundle is incomplete relative to the schema.ActorConfigSchemain scope as a workaround, which defeats the purpose of storing a compiled bundle.Fix
Three targeted additions across two files:
actor/compiler.py—_map_node(): accept and threadactor_system_promptactor/compiler.py—compile_actor(): passconfig.system_promptthroughlanggraph/nodes.py—_execute_agent(): expose it in the context dictThe last change allows the host's
Agent.process_message()to readcontext.get("system_prompt")without needing a direct reference toNodeConfig. No changes toProviderRegistryPort.get()are required.Definition of Done
_map_node()accepts and threadsactor_system_promptinto AGENT nodemetadataviasetdefaultcompile_actor()passesconfig.system_promptto_map_node()Node._execute_agent()addsmetadata["system_prompt"]to the context dict when presentsystem_prompt→ compiledNodeConfig.metadatacontainssystem_promptprocess_message()receivessystem_promptin context dictdocs/reference/actor_compiler.mdupdated to document thatsystem_promptis threaded into node metadata alongsideproviderandmodelImplementation Notes
Branch:
fix/compiler-thread-system-promptRoot cause
actor/compiler.py:_map_node()already threadedproviderandmodelfrom the actor-level config into each AGENT node'smerged_metadict viasetdefault. Thesystem_promptfield was simply never added to the same pattern — a three-line omission.A second, independent gap in
langgraph/nodes.py:Node._execute_agent()meant that even after the compiler fix thesystem_promptvalue would not appear in the context dict passed toagent.process_message().Files changed
src/cleveractors/actor/compiler.py—_map_node()andcompile_actor()actor_system_prompt: str | None = Noneparameter to_map_node().merged_meta.setdefault("system_prompt", actor_system_prompt)inside theif node.type == NodeType.AGENT:block, directly after the existingprovider/modelsetdefault calls.compile_actor()to passactor_system_prompt=config.system_promptin the_map_node()call.setdefaultsemantics preserve any per-nodeconfig.system_promptoverride, exactly matching howproviderandmodelwork.src/cleveractors/langgraph/nodes.py—Node._execute_agent()node_system_prompt = self.config.metadata.get("system_prompt")before thecontext.update(state.metadata)call.context["system_prompt"] = node_system_promptso the host agent can read it fromcontext.get("system_prompt")without referencing the rawActorConfigSchema.state.metadataupdate so per-execution overrides viastate.metadata["system_prompt"]still take precedence.docs/reference/actor_compiler.md— Node Binding tableAGENTrow to document thatsystem_promptis now threaded alongsideproviderandmodel, and thatNode._execute_agent()injects it into the context dict.features/compiler_system_prompt.feature(new) — 3 BDD scenariossystem_promptis threaded into each AGENT node'smetadataon compile.system_promptin nodeconfigtakes precedence viasetdefaultsemantics.process_message()receivessystem_promptin its context dict when the node's metadata contains it.features/steps/compiler_system_prompt_steps.py(new) — step definitions_CapturingAgent: records the context dict received byprocess_message()._CapturingProviderRegistry: returns the same_CapturingAgentinstance for a given provider/model pair, allowing the test to inspect the received context post-execution.@when("the actor configuration is compiled")fromsmoke_steps.py(Behave loads all step files together).Quality gates
All gates pass on branch
fix/compiler-thread-system-prompt:nox -s lintnox -s typechecknox -s unit_testsnox -s coverage_reportnox -s security_scannox -s dead_codenox -s complexitySelf-QA Implementation Notes (Cycles 1–2)
Cycle 1
Review findings (0C / 3M / 5m / 2n — Request Changes):
system_prompt(compiler + runtime levels). The advertisedis not Nonefix had no regression guard.state.metadata = {"system_prompt": None}overriding a compiled default at runtime.setdefault("system_prompt", None)unconditionally inserted"system_prompt": Noneinto every AGENT node's metadata even when the actor had nosystem_prompt, silently changing metadata shape.metadata.get("system_prompt")returnsAny; thestr | Noneannotation was aspirational with no runtime guard.system_promptwas absent fromignore_keys, allowing agent mutations to leak intometadata_updates.# Then steps for new scenarioscomment was a drafting artifact.metadata.get()type-safety gap is a pre-existing pattern (tracked as future improvement, no action).Fixes applied:
compiler.py_map_node(): Guardedsetdefaultwithif actor_system_prompt is not None:so that actors without a top-levelsystem_promptno longer inject aNonekey into AGENT node metadata.nodes.py_execute_agent(): Replacedis not Nonewithisinstance(node_system_prompt, str)for defensive type safety; added"system_prompt"toignore_keys.compiler_system_prompt.feature: Scenario 6 updated to assert key absence (notNone); 3 new scenarios added for empty-string compile/runtime (M1) andNoneruntime override (M2).# Then steps — compilation assertions/# Then steps — runtime assertions);agent_nodes_foundguard added to all "each AGENT node" loops.All 7 quality gates passed: 17/17 scenarios (up from 14), coverage ≥ 97%.
Cycle 2
Review findings (0C / 0M / 3m / 3n — Approve):
system_promptin node metadata (theisinstanceguard's non-None branch).ignore_keyspreventssystem_promptfrom persisting tometadata_updates.None+ node-levelsystem_promptoverride (setdefault semantics when fallback is absent).isinstanceguard)._CapturingAgentuses shallow copy of context;deepcopywould be safer.@when('... containing system_prompt "{prompt}"')step pattern fragile for unquotedNone.Fixes applied:
None — Cycle 2 verdict was Approve. The remaining minor/nit findings do not affect correctness and the reviewer confirmed the PR is ready to merge.
Remaining Issues
The following items from Cycle 2 are open but non-blocking:
system_promptinjected viaNodeConfig.metadataignore_keysexclusion ofsystem_promptworkssystem_prompt+ per-node override combination_CapturingAgent.received_context = dict(context)should usedeepcopy"None"string vs unquotedNoneThese can be addressed as a follow-up in a separate ticket if desired. No action required before merge.
hurui200320 referenced this issue2026-06-03 06:48:39 +00:00
hurui200320 referenced this issue2026-06-12 03:13:59 +00:00