fix: harden amphibious template hooks & realign skills with new scaffold#194
Merged
Conversation
added 6 commits
April 18, 2026 11:15
- Add .github/workflows/skill-install-deps-check.yml that discovers each skills/*/scripts/deps*.ini dynamically and, per config, runs install-deps.sh in a fresh mktemp -d, asserting the DEPS_READY marker. A policy-guard step rejects any section whose source is not "default", so only public-PyPI references can reach main. - Rewrite skills/README.md as the top-level index for the skills system: skill list, directory layout, installer usage, deps.ini grammar, and the CI gate convention.
Helper code or inline logic between yields in on_workflow() previously crashed the entire run because the inner try only caught StopAsyncIteration. The generator is unrecoverable after a raise (asend would fail), so the fix mirrors full-fallback semantics: WORKFLOW mode re-raises; AMPHIFLOW mode hands off to on_agent(ctx); AMPHIFLOW without an on_agent override surfaces a clear RuntimeError tagged with the failing step index.
Replace the multi-file project layout (task.md, config.py, tools.py, workers.py, agents.py + skills/result/log dirs) with a single amphi.py emitted directly into the target directory. Runtime concerns (.env, __main__) are out of scope for the scaffold. The new template surfaces the framework's main building blocks — custom CognitiveContext, AmphibiousAutoma subclass, think_unit, CognitiveWorker, and both on_agent / on_workflow stubs — so a user discovers the architecture by reading the file rather than from external docstrings. CLI: drop required -n/--name; bridgic-amphibious create now writes ./amphi.py (or under --base-dir). --task is injected as a top-level "# Task: ..." comment when provided.
…or semantics Update SKILL.md and references to match recent code changes: - Scaffold CLI no longer takes -n/--name; only emits a single amphi.py in the target directory. Update CLI examples, flag table, and the Generated structure block accordingly. Add a brief note on the Python API signature. - Workflow Fallback Mechanism now distinguishes ActionCall tool failures (existing step-level fallback path) from generator-internal exceptions (helper / inline logic raises), which are unrecoverable and route to full on_agent fallback (or re-raise in pure WORKFLOW).
Empty `pass`-body overrides of `before_action` / `after_action` / `on_workflow` no longer break the framework: - worker `before_action` / `after_action` returning `None` is treated identically to `_DELEGATE` so the agent-level hook still runs - agent `before_action` returning `None` is treated as passthrough, preserving the original `decision_result` - `_has_workflow()` now requires `inspect.isasyncgenfunction`, so a coroutine-body `on_workflow: pass` is recognized as "not overridden" and `RunMode.AUTO` falls back to the agent path instead of crashing on the async-generator protocol
Extends the previous stub-override compatibility pass to two more hooks where an AI-generated `pass` body would silently corrupt behavior (rather than crash loudly): - `CognitiveWorker.observation` returning `None` is now treated identically to `_DELEGATE`, so the agent-level observation fallback still runs instead of `None` being written into `ctx.observation`. - `AmphibiousAutoma.action_custom_output` returning `None` is now treated as passthrough, preserving the original `decision_result` so a typed `output_schema` value is not silently dropped. Two new tests cover the canonical AI-generated `pass` shape for each hook.
tsingfei
approved these changes
Apr 29, 2026
NiceCode666
approved these changes
Apr 29, 2026
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.
Summary
This branch bundles two related streams of work that landed under
fix/skills-and-amphibious-fallback:user-code shape that previously crashed it.
amphi.pyand update thebridgic-amphibiousskill docs to match.A new CI gate is also added so PRs to
maincannot ship with a brokenskills
install-depsstep.Amphibious robustness
on_workflowhelper exceptions (anything raised between yields) arenow caught and routed:
on_agent(ctx).on_agentoverride → clearRuntimeError.before_action/after_actionreturningNoneistreated identically to
_DELEGATE(delegate to the agent-level hook).before_actionreturningNoneis treated as passthrough(the original
decision_resultis preserved).async def on_workflow(...): pass(a coroutine, not an asyncgenerator) is now recognized as not overridden via
inspect.isasyncgenfunction, soRunMode.AUTOfalls back to theagent path instead of crashing on the generator protocol.
Skills & scaffold
scaffold.pysimplified to emit a singleamphi.pywith anarchitecture stub.
skills/bridgic-amphibious/SKILL.mdand thearchitecture/api-referencedocuments updated to match the new scaffold and thehelper-error semantics above.
skills/README.md.CI
.github/workflows/skill-install-deps-check.ymlthatgates PRs targeting
mainon a successful skillsinstall-depsrun.Test plan
uv run pytest -q(97 passed, including 8 new stub-overridetests in
tests/test_stub_override_robustness.pyand 3 helper-errortests in
tests/test_workflow_helper_error.py)skill-install-deps-checkruns green against this branchamphi init) stillruns end-to-end against the updated
amphi.pytemplate